aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-05-04 16:09:47 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-05-04 18:04:01 -0600
commit9dedf50dd0929207b5239488caaea0403089effe (patch)
tree679ac06dd5f8fee7a6ed9b47a02ab59d6ee011e8 /arch
parentwireguard: send/receive: cond_resched() when processing worker ringbuffers (diff)
downloadwireguard-linux-jd/shorter-socket-lock.tar.xz
wireguard-linux-jd/shorter-socket-lock.zip
wireguard: socket: do not hold locks while transmitting packetsjd/shorter-socket-lock
Before, we followed this pattern for using the udp_tunnel api: rcu_read_lock_bh(); sock = rcu_dereference(obj->sock); ... udp_tunnel_xmit_skb(..., sock, ...); rcu_read_unlock_bh(); This commit changes that to use a reference counter instead: rcu_read_lock_bh(); sock = rcu_dereference(obj->sock); sock_hold(sock); rcu_read_unlock_bh(); ... udp_tunnel_xmit_skb(..., sock, ...); sock_put(sock); The advantage of the latter approach is that we now no longer hold any locks while udp_tunnel_xmit_skb runs, since it could be somewhat slow on systems with advanced qdisc or netfilter configurations. This should avoid potential RCU stalls in those situations. This commit makes sure we're holding neither the rcu read lock nor the endpoint read lock when udp_tunnel_xmit_skb is called. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions