Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: L2CAP: Reject mode changes on connected channels
@ 2026-10-08 14:17 Siwei Zhang
  2026-10-08 14:59 ` Siwei Zhang
  2026-10-08 15:26 ` [v1] " bluez.test.bot
  0 siblings, 2 replies; 3+ messages in thread
From: Siwei Zhang @ 2026-10-08 14:17 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Siwei Zhang

Allowing mode changes on already-connected channel will
skip necessary initialization on the new mode, resulting
NULL ptr dereference.

Cc: stable@vger.kernel.org
Closes: https://sashiko.dev/#/patchset/20261007144717.3832330-1-oss%40fourdim.xyz
Fixes: f2fcfcd67025 ("Bluetooth: Add configuration support for ERTM and Streaming mode")
Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
---
Please apply https://lore.kernel.org/linux-bluetooth/20261007144717.3832330-1-oss@fourdim.xyz/
as well, thank you.

 net/bluetooth/l2cap_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index cb4ec42f99e3..2cb3f59112f5 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3876,7 +3876,8 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
 		}
 	}
 
-	if (chan->mode == L2CAP_MODE_BASIC && chan->mode != rfc.mode)
+	if ((chan->mode == L2CAP_MODE_BASIC || chan->state == BT_CONNECTED) &&
+	    chan->mode != rfc.mode)
 		return -ECONNREFUSED;
 
 	chan->mode = rfc.mode;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-08 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 14:17 [PATCH v1] Bluetooth: L2CAP: Reject mode changes on connected channels Siwei Zhang
2026-10-08 14:59 ` Siwei Zhang
2026-10-08 15:26 ` [v1] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox