Skip to content

Commit 5c61419

Browse files
pchelkin91Vudentz
authored andcommitted
Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
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]: bluez/bluez@ae5be37 Found by Linux Verification Center (linuxtesting.org). Fixes: 4b6e228 ("Bluetooth: Auto tune if input MTU is set to 0") Cc: [email protected] Signed-off-by: Fedor Pchelkin <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 7de119b commit 5c61419

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/bluetooth/l2cap_sock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,12 +710,12 @@ static bool l2cap_valid_mtu(struct l2cap_chan *chan, u16 mtu)
710710
{
711711
switch (chan->scid) {
712712
case L2CAP_CID_ATT:
713-
if (mtu < L2CAP_LE_MIN_MTU)
713+
if (mtu && mtu < L2CAP_LE_MIN_MTU)
714714
return false;
715715
break;
716716

717717
default:
718-
if (mtu < L2CAP_DEFAULT_MIN_MTU)
718+
if (mtu && mtu < L2CAP_DEFAULT_MIN_MTU)
719719
return false;
720720
}
721721

0 commit comments

Comments
 (0)