Skip to content
Commit 5464c3a0 authored by Ilya Maximets's avatar Ilya Maximets Committed by Daniel Borkmann
Browse files

xdp: fix potential deadlock on socket mutex



There are 2 call chains:

  a) xsk_bind --> xdp_umem_assign_dev
  b) unregister_netdevice_queue --> xsk_notifier

with the following locking order:

  a) xs->mutex --> rtnl_lock
  b) rtnl_lock --> xdp.lock --> xs->mutex

Different order of taking 'xs->mutex' and 'rtnl_lock' could produce a
deadlock here. Fix that by moving the 'rtnl_lock' before 'xs->lock' in
the bind call chain (a).

Reported-by: default avatar <syzbot+bf64ec93de836d7f4c2c@syzkaller.appspotmail.com>
Fixes: 455302d1 ("xdp: fix hang while unregistering device bound to xdp socket")
Signed-off-by: default avatarIlya Maximets <i.maximets@samsung.com>
Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 67571640
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment