Skip to content
/ linux Public

Commit b5c20c8

Browse files
ceggers-arrigregkh
authored andcommitted
Bluetooth: LE L2CAP: Disconnect if received packet's SDU exceeds IMTU
[ Upstream commit e1d9a66 ] Core 6.0, Vol 3, Part A, 3.4.3: "If the SDU length field value exceeds the receiver's MTU, the receiver shall disconnect the channel..." This fixes L2CAP/LE/CFC/BV-26-C (running together with 'l2test -r -P 0x0027 -V le_public -I 100'). Fixes: aac23bf ("Bluetooth: Implement LE L2CAP reassembly") Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d30acb4 commit b5c20c8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6610,8 +6610,10 @@ static int l2cap_ecred_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
66106610
return -ENOBUFS;
66116611
}
66126612

6613-
if (chan->imtu < skb->len) {
6614-
BT_ERR("Too big LE L2CAP PDU");
6613+
if (skb->len > chan->imtu) {
6614+
BT_ERR("Too big LE L2CAP PDU: len %u > %u", skb->len,
6615+
chan->imtu);
6616+
l2cap_send_disconn_req(chan, ECONNRESET);
66156617
return -ENOBUFS;
66166618
}
66176619

@@ -6637,7 +6639,9 @@ static int l2cap_ecred_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
66376639
sdu_len, skb->len, chan->imtu);
66386640

66396641
if (sdu_len > chan->imtu) {
6640-
BT_ERR("Too big LE L2CAP SDU length received");
6642+
BT_ERR("Too big LE L2CAP SDU length: len %u > %u",
6643+
skb->len, sdu_len);
6644+
l2cap_send_disconn_req(chan, ECONNRESET);
66416645
err = -EMSGSIZE;
66426646
goto failed;
66436647
}

0 commit comments

Comments
 (0)