Skip to content

Commit e1d9a66

Browse files
ceggers-arriVudentz
authored andcommitted
Bluetooth: LE L2CAP: Disconnect if received packet's SDU exceeds IMTU
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 <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent c38b8f5 commit e1d9a66

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

net/bluetooth/l2cap_core.c

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

6665-
if (chan->imtu < skb->len) {
6666-
BT_ERR("Too big LE L2CAP PDU");
6665+
if (skb->len > chan->imtu) {
6666+
BT_ERR("Too big LE L2CAP PDU: len %u > %u", skb->len,
6667+
chan->imtu);
6668+
l2cap_send_disconn_req(chan, ECONNRESET);
66676669
return -ENOBUFS;
66686670
}
66696671

@@ -6689,7 +6691,9 @@ static int l2cap_ecred_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
66896691
sdu_len, skb->len, chan->imtu);
66906692

66916693
if (sdu_len > chan->imtu) {
6692-
BT_ERR("Too big LE L2CAP SDU length received");
6694+
BT_ERR("Too big LE L2CAP SDU length: len %u > %u",
6695+
skb->len, sdu_len);
6696+
l2cap_send_disconn_req(chan, ECONNRESET);
66936697
err = -EMSGSIZE;
66946698
goto failed;
66956699
}

0 commit comments

Comments
 (0)