From: Christian Eggers Date: Wed, 25 Feb 2026 17:07:26 +0000 (+0100) Subject: Bluetooth: L2CAP: CoC: Disconnect if received packet size exceeds MPS X-Git-Tag: v7.1-rc1~173^2~12^2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=728a3d128325bad286b1e4f191026e8de8d12a85;p=thirdparty%2Fkernel%2Flinux.git Bluetooth: L2CAP: CoC: Disconnect if received packet size exceeds MPS Core 6.0, Vol 3, Part A, 3.4.3: "... If the payload size of any K-frame exceeds the receiver's MPS, the receiver shall disconnect the channel..." This fixes L2CAP/LE/CFC/BV-27-C (running together with 'l2test -r -P 0x0027 -V le_public -I 100'). Signed-off-by: Christian Eggers Signed-off-by: Luiz Augusto von Dentz Tested-by: Christian Eggers --- diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 95c65fece39bd..9916ae6abef04 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -6705,6 +6705,13 @@ static int l2cap_ecred_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb) return -ENOBUFS; } + if (skb->len > chan->mps) { + BT_ERR("Too big LE L2CAP MPS: len %u > %u", skb->len, + chan->mps); + l2cap_send_disconn_req(chan, ECONNRESET); + return -ENOBUFS; + } + chan->rx_credits--; BT_DBG("chan %p: rx_credits %u -> %u", chan, chan->rx_credits + 1, chan->rx_credits);