Skip to content

Commit 32bd343

Browse files
fourdimgregkh
authored andcommitted
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_get_sndtimeo_cb()
commit 78a88d4 upstream. Add the same NULL guard already present in l2cap_sock_resume_cb() and l2cap_sock_ready_cb(). Fixes: 8d836d7 ("Bluetooth: Access sk_sndtimeo indirectly in l2cap_core.c") Cc: stable@kernel.org Signed-off-by: Siwei Zhang <oss@fourdim.xyz> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1810e42 commit 32bd343

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/bluetooth/l2cap_sock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,9 @@ static long l2cap_sock_get_sndtimeo_cb(struct l2cap_chan *chan)
17471747
{
17481748
struct sock *sk = chan->data;
17491749

1750+
if (!sk)
1751+
return 0;
1752+
17501753
return READ_ONCE(sk->sk_sndtimeo);
17511754
}
17521755

0 commit comments

Comments
 (0)