]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_state_change_cb()
authorSiwei Zhang <oss@fourdim.xyz>
Wed, 15 Apr 2026 20:51:36 +0000 (16:51 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 6 May 2026 20:21:04 +0000 (16:21 -0400)
Add the same NULL guard already present in
l2cap_sock_resume_cb() and l2cap_sock_ready_cb().

Fixes: 89bc500e41fc ("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>
net/bluetooth/l2cap_sock.c

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