linux-stable/net/xdp
Ilya Maximets 455302d1c9 xdp: fix hang while unregistering device bound to xdp socket
Device that bound to XDP socket will not have zero refcount until the
userspace application will not close it. This leads to hang inside
'netdev_wait_allrefs()' if device unregistering requested:

  # ip link del p1
  < hang on recvmsg on netlink socket >

  # ps -x | grep ip
  5126  pts/0    D+   0:00 ip link del p1

  # journalctl -b

  Jun 05 07:19:16 kernel:
  unregister_netdevice: waiting for p1 to become free. Usage count = 1

  Jun 05 07:19:27 kernel:
  unregister_netdevice: waiting for p1 to become free. Usage count = 1
  ...

Fix that by implementing NETDEV_UNREGISTER event notification handler
to properly clean up all the resources and unref device.

This should also allow socket killing via ss(8) utility.

Fixes: 965a990984 ("xsk: add support for bind for Rx")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-07-03 15:10:55 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
xdp_umem.c xdp: fix hang while unregistering device bound to xdp socket 2019-07-03 15:10:55 +02:00
xdp_umem.h xdp: fix hang while unregistering device bound to xdp socket 2019-07-03 15:10:55 +02:00
xsk.c xdp: fix hang while unregistering device bound to xdp socket 2019-07-03 15:10:55 +02:00
xsk.h xsk: add sock_diag interface for AF_XDP 2019-01-25 01:50:03 +01:00
xsk_diag.c xsk: fix potential crash in xsk_diag_put_umem() 2019-03-07 10:36:37 +01:00
xsk_queue.c net: xsk: add a simple buffer reuse queue 2018-09-25 13:13:15 -07:00
xsk_queue.h xsk: Properly terminate assignment in xskq_produce_flush_desc 2019-06-26 14:39:05 +02:00