Bluetooth: L2CAP: Fix sending MPS that cannot be fully used

MPS shall never be bigger than MTU + 2 as the remaining bytes cannot
be used since the SDU is limited to length + MTU.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-10-11 13:58:13 +03:00 committed by Johan Hedberg
commit 5115cb16cf

View file

@ -635,7 +635,10 @@ static void l2cap_chan_rx_init(struct bt_l2cap_le_chan *chan)
}
}
chan->rx.mps = L2CAP_MAX_LE_MPS;
/* MPS shall not be bigger than MTU + 2 as the remaining bytes cannot
* be used.
*/
chan->rx.mps = min(chan->rx.mtu + 2, L2CAP_MAX_LE_MPS);
k_sem_init(&chan->rx.credits, 0, UINT_MAX);
}