]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Dec 2018 04:24:16 +0000 (20:24 -0800)
commit723096ec30e60d46336a1ca5142d8e14c7cd4d8e
treefbe09ebb46b892704e3cf8b0d7cafc963aa6c0b4
parenta5a708cce2134a72f7f405ac43f04d376ec521b5
netrom: fix locking in nr_find_socket()

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>
net/netrom/af_netrom.c