Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_state_change_cb()

Add the same NULL guard already present in
l2cap_sock_resume_cb() and l2cap_sock_ready_cb().

Fixes: 89bc500e41 ("Bluetooth: Add state tracking to struct l2cap_chan")
Cc: stable@kernel.org
Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Siwei Zhang 2026-04-15 16:51:36 -04:00 committed by Luiz Augusto von Dentz
parent 91b5a598b5
commit 2ff1a41a91

View File

@ -1657,6 +1657,9 @@ static void l2cap_sock_state_change_cb(struct l2cap_chan *chan, int state,
{ {
struct sock *sk = chan->data; struct sock *sk = chan->data;
if (!sk)
return;
sk->sk_state = state; sk->sk_state = state;
if (err) if (err)