* Bluetooth: L2CAP: missing NULL guard in remaining l2cap_chan_ops callbacks
@ 2026-05-08 20:21 y2k
0 siblings, 0 replies; only message in thread
From: y2k @ 2026-05-08 20:21 UTC (permalink / raw)
To: marcel; +Cc: luiz.dentz, linux-bluetooth, linux-kernel
Commits 0a120d961663, 78a88d43dab8, and 2ff1a41a912d added NULL guards
for chan->data in l2cap_sock_new_connection_cb(), l2cap_sock_get_sndtimeo_cb(),
and l2cap_sock_state_change_cb() respectively.
The same NULL guard is still missing in five other l2cap_chan_ops callbacks
in net/bluetooth/l2cap_sock.c:
- l2cap_sock_defer_cb() (.defer)
- l2cap_sock_suspend_cb() (.suspend)
- l2cap_sock_set_shutdown_cb() (.set_shutdown)
- l2cap_sock_get_peer_pid_cb() (.get_peer_pid)
- l2cap_sock_filter() (.filter)
All five dereference chan->data directly without checking for NULL:
struct sock *sk = chan->data;
lock_sock(sk); /* or direct sk-> access */
The fix mirrors the existing guards:
struct sock *sk = chan->data;
if (!sk)
return; /* or appropriate return value */
Fixes: 80808e431e1e ("Bluetooth: Add l2cap_chan_ops abstraction")
Reported-by: y2k <y2k@desarrollaria.com>
Thanks,
y2k
y2k@desarrollaria.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-08 20:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 20:21 Bluetooth: L2CAP: missing NULL guard in remaining l2cap_chan_ops callbacks y2k
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox