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

Fixes: 80808e431e1e ("Bluetooth: Add l2cap_chan_ops abstraction")
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 879c9f90269a87c95d55e3563c493ce34a1f4956..cf590a67d3641c77f0eb25118ddb9593692fb6f6 100644 (file)
@@ -1498,6 +1498,9 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan)
 {
        struct sock *sk, *parent = chan->data;
 
+       if (!parent)
+               return NULL;
+
        lock_sock(parent);
 
        /* Check for backlog size */