]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
rxrpc: Fix deadlock around release of dst cached on udp tunnel
authorDavid Howells <dhowells@redhat.com>
Fri, 29 Jan 2021 23:53:50 +0000 (23:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 30 Jan 2021 05:38:11 +0000 (21:38 -0800)
commit5399d52233c47905bbf97dcbaa2d7a9cc31670ba
tree4088b819c5d3187877155b590e5edef2f7c9af36
parent8d520b4de3edca4f4fb242b5ddc659b6a9b9e65e
rxrpc: Fix deadlock around release of dst cached on udp tunnel

AF_RXRPC sockets use UDP ports in encap mode.  This causes socket and dst
from an incoming packet to get stolen and attached to the UDP socket from
whence it is leaked when that socket is closed.

When a network namespace is removed, the wait for dst records to be cleaned
up happens before the cleanup of the rxrpc and UDP socket, meaning that the
wait never finishes.

Fix this by moving the rxrpc (and, by dependence, the afs) private
per-network namespace registrations to the device group rather than subsys
group.  This allows cached rxrpc local endpoints to be cleared and their
UDP sockets closed before we try waiting for the dst records.

The symptom is that lines looking like the following:

unregister_netdevice: waiting for lo to become free

get emitted at regular intervals after running something like the
referenced syzbot test.

Thanks to Vadim for tracking this down and work out the fix.

Reported-by: syzbot+df400f2f24a1677cd7e0@syzkaller.appspotmail.com
Reported-by: Vadim Fedorenko <vfedorenko@novek.ru>
Fixes: 5271953cad31 ("rxrpc: Use the UDP encap_rcv hook")
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Vadim Fedorenko <vfedorenko@novek.ru>
Link: https://lore.kernel.org/r/161196443016.3868642.5577440140646403533.stgit@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
fs/afs/main.c
net/rxrpc/af_rxrpc.c