]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
netrom: fix locking in nr_find_socket()
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 29 Dec 2018 21:56:38 +0000 (13:56 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit96729dd44d0956c3166174fdf1265cb89a7c08d9
tree0f8a9938924aeb78a2a70684a30573eecc8c37ee
parent454e55c95fa54050f6e45832882e76366ece1869
netrom: fix locking in nr_find_socket()

BugLink: https://bugs.launchpad.net/bugs/1837257
[ Upstream commit 7314f5480f3e37e570104dc5e0f28823ef849e72 ]

nr_find_socket(), nr_find_peer() and nr_find_listener() lock the
sock after finding it in the global list. However, the call path
requires BH disabled for the sock lock consistently.

Actually the locking is unnecessary at this point, we can just hold
the sock refcnt to make sure it is not gone after we unlock the global
list, and lock it later only when needed.

Reported-and-tested-by: syzbot+f621cda8b7e598908efa@syzkaller.appspotmail.com
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/netrom/af_netrom.c