aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-13 03:40:37 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-13 15:05:46 +0200
commit58b47c6907be93ea458f52b5c3dd2edc55f6e495 (patch)
treebb6cb9e851b66afe58fa04b43d68299ea0b35dba /src/compat/compat.h
parenttools: support getentropy(3) (diff)
downloadwireguard-monolithic-historical-58b47c6907be93ea458f52b5c3dd2edc55f6e495.tar.xz
wireguard-monolithic-historical-58b47c6907be93ea458f52b5c3dd2edc55f6e495.zip
skb_reset: do not free socket memory with preemption disabled
It turns out that calling skb_orphan (via skb_scrub_packet(xnet=true)) might result in a call to schedule(), since it will wake up waiting socket writers in userspace. This means that everything explodes, since we're calling this with preemption disabled. Work around this by removing the spinlocks in the consumers -- they're the sole consumers and so don't need the spinlocks anyway -- and then move skb_orphan to the consumption thread, which doesn't have preemption disabled. (When we move to a proper lockless mpmc ring buffer, we won't even have spinlocks anyway.) Since we don't actually need to call skb_orphan except on tx, so that net_cls does the right thing (see net/netfilter/xt_cgroup.c and its check of skb->sk), just explictly orphan the packet in the one place where that's actually necessary, and otherwise don't orphan it. This leaves us without a call to skb_orphan on the rx path, where we don't need it and can't use it anyway because preemption is disabled for netif_receive_skb. This effectively reworks 740319127f14793a13ad385e8150cd98c715c20c.
Diffstat (limited to 'src/compat/compat.h')
0 files changed, 0 insertions, 0 deletions