]> git.baikalelectronics.ru Git - kernel.git/commit
l2tp: prevent lockdep issue in l2tp_tunnel_register()
authorEric Dumazet <edumazet@google.com>
Tue, 17 Jan 2023 11:01:31 +0000 (11:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:24 +0000 (08:34 +0100)
commit1b35a070c98bfce00c179bacc0e211aea0b32e11
tree2d8a6d1446f6bc2489a2c180f538f805b4cb3c96
parent9431f0f3dc9d0afb1e93c336c0745a907748d01f
l2tp: prevent lockdep issue in l2tp_tunnel_register()

[ Upstream commit e93be9c839fc20b0320b47ecd0becda8a785ef58 ]

lockdep complains with the following lock/unlock sequence:

     lock_sock(sk);
     write_lock_bh(&sk->sk_callback_lock);
[1]  release_sock(sk);
[2]  write_unlock_bh(&sk->sk_callback_lock);

We need to swap [1] and [2] to fix this issue.

Fixes: 872a37ad8c70 ("l2tp: close all race conditions in l2tp_tunnel_register()")
Reported-by: syzbot+bbd35b345c7cab0d9a08@syzkaller.appspotmail.com
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/netdev/20230114030137.672706-1-xiyou.wangcong@gmail.com/T/#m1164ff20628671b0f326a24cb106ab3239c70ce3
Cc: Cong Wang <cong.wang@bytedance.com>
Cc: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/l2tp/l2tp_core.c