* [PATCH] Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
@ 2025-01-28 21:08 Fedor Pchelkin
2025-01-29 20:20 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Fedor Pchelkin @ 2025-01-28 21:08 UTC (permalink / raw)
To: Luiz Augusto von Dentz, linux-bluetooth
Cc: Fedor Pchelkin, Marcel Holtmann, Johan Hedberg, linux-kernel,
lvc-project, stable
One of the possible ways to enable the input MTU auto-selection for L2CAP
connections is supposed to be through passing a special "0" value for it
as a socket option. Commit [1] added one of those into avdtp. However, it
simply wouldn't work because the kernel still treats the specified value
as invalid and denies the setting attempt. Recorded BlueZ logs include the
following:
bluetoothd[496]: profiles/audio/avdtp.c:l2cap_connect() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
[1]: https://github.com/bluez/bluez/commit/ae5be371a9f53fed33d2b34748a95a5498fd4b77
Found by Linux Verification Center (linuxtesting.org).
Fixes: 4b6e228e297b ("Bluetooth: Auto tune if input MTU is set to 0")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
net/bluetooth/l2cap_sock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 49f97d4138ea..46ea0bee2259 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -710,12 +710,12 @@ static bool l2cap_valid_mtu(struct l2cap_chan *chan, u16 mtu)
{
switch (chan->scid) {
case L2CAP_CID_ATT:
- if (mtu < L2CAP_LE_MIN_MTU)
+ if (mtu && mtu < L2CAP_LE_MIN_MTU)
return false;
break;
default:
- if (mtu < L2CAP_DEFAULT_MIN_MTU)
+ if (mtu && mtu < L2CAP_DEFAULT_MIN_MTU)
return false;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
2025-01-28 21:08 [PATCH] Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection Fedor Pchelkin
@ 2025-01-29 20:20 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2025-01-29 20:20 UTC (permalink / raw)
To: Fedor Pchelkin
Cc: luiz.dentz, linux-bluetooth, marcel, johan.hedberg, linux-kernel,
lvc-project, stable
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 29 Jan 2025 00:08:14 +0300 you wrote:
> One of the possible ways to enable the input MTU auto-selection for L2CAP
> connections is supposed to be through passing a special "0" value for it
> as a socket option. Commit [1] added one of those into avdtp. However, it
> simply wouldn't work because the kernel still treats the specified value
> as invalid and denies the setting attempt. Recorded BlueZ logs include the
> following:
>
> [...]
Here is the summary with links:
- Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
https://git.kernel.org/bluetooth/bluetooth-next/c/257a2b95631f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-29 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28 21:08 [PATCH] Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection Fedor Pchelkin
2025-01-29 20:20 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox