All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: L2CAP: Fix missing options not using most recent value
@ 2025-03-17 17:41 Luiz Augusto von Dentz
  2025-03-17 18:37 ` [v1] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-17 17:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

According to the core specification the most recent value, not its
default, must be used in case it is missing on L2CAP_CONFIGURATION_REQ:

 'Any missing configuration parameters are assumed to have their most
 recently explicitly or implicitly accepted values.'

Fixes: c1360a1cf351 ("Bluetooth: use bit operation on conf_state")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7b4adab353cf..7719f263f5c4 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3385,6 +3385,20 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data, size_t data
 
 	BT_DBG("chan %p", chan);
 
+	/* 4.4. L2CAP_CONFIGURATION_REQ (code 0x04):
+	 * ...
+	 * Any missing configuration parameters are assumed to have their most
+	 * recently explicitly or implicitly accepted values.
+	 */
+
+	/* If MTU has been previously set, use it instead of default. */
+	if (test_bit(CONF_MTU_DONE, &chan->conf_state))
+		mtu = chan->omtu;
+
+	/* If Mode has been previously set, use it instead of default. */
+	if (test_bit(CONF_MODE_DONE, &chan->conf_state))
+		rfc.mode = chan->mode;
+
 	while (len >= L2CAP_CONF_OPT_SIZE) {
 		len -= l2cap_get_conf_opt(&req, &type, &olen, &val);
 		if (len < 0)
-- 
2.48.1


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

end of thread, other threads:[~2025-03-17 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 17:41 [PATCH v1] Bluetooth: L2CAP: Fix missing options not using most recent value Luiz Augusto von Dentz
2025-03-17 18:37 ` [v1] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.