]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Bluetooth: l2cap: fix MPS check in l2cap_ecred_reconf_req
authorDudu Lu <phx0fer@gmail.com>
Wed, 15 Apr 2026 10:43:55 +0000 (18:43 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 6 May 2026 20:20:38 +0000 (16:20 -0400)
The L2CAP specification states that if more than one channel is being
reconfigured, the MPS shall not be decreased. The current check has
two issues:

1) The comparison uses >= (greater-than-or-equal), which incorrectly
   rejects reconfiguration requests where the MPS stays the same.
   Since the spec says MPS "shall be greater than or equal to the
   current MPS", only a strict decrease (remote_mps > mps) should be
   rejected. Keeping the same MPS is valid.

2) The multi-channel guard uses `&& i` (loop index) to approximate
   "more than one channel", but this incorrectly allows MPS decrease
   for the first channel (i==0) even when multiple channels are being
   reconfigured. Replace with `&& num_scid > 1` which correctly
   checks whether the request covers more than one channel.

Fixes: 7accb1c4321a ("Bluetooth: L2CAP: Fix invalid response to L2CAP_ECRED_RECONF_REQ")
Signed-off-by: Dudu Lu <phx0fer@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/l2cap_core.c

index 77dec104a9c367775890563aec6a1d54b8b289ed..b15374b951fa027a267f63d9f88e2e4293b0b051 100644 (file)
@@ -5428,7 +5428,7 @@ static inline int l2cap_ecred_reconf_req(struct l2cap_conn *conn,
                 * configured, the MPS field may be less than the current MPS
                 * of that channel.
                 */
-               if (chan[i]->remote_mps >= mps && i) {
+               if (chan[i]->remote_mps > mps && num_scid > 1) {
                        BT_ERR("chan %p decreased MPS %u -> %u", chan[i],
                               chan[i]->remote_mps, mps);
                        result = L2CAP_RECONF_INVALID_MPS;