From: y2k <y2k@desarrollaria.com>
To: marcel@holtmann.org
Cc: luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Bluetooth: L2CAP: missing NULL guard in remaining l2cap_chan_ops callbacks
Date: Fri, 08 May 2026 22:21:40 +0200 [thread overview]
Message-ID: <8e1c30806d274ac3cfebce2816057875.y2k@desarrollaria.com> (raw)
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
reply other threads:[~2026-05-08 20:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e1c30806d274ac3cfebce2816057875.y2k@desarrollaria.com \
--to=y2k@desarrollaria.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox