From: Johan Hedberg Date: Mon, 2 Nov 2015 12:39:16 +0000 (+0200) Subject: Bluetooth: L2CAP: Fix checked range when allocating new CID X-Git-Tag: KARO-TXUL-2015-12-04~98^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0076e53f7f55a8f5c39db88250628bfc24375c77;p=karo-tx-linux.git Bluetooth: L2CAP: Fix checked range when allocating new CID The 'dyn_end' value is also a valid CID so it should be included in the range of values checked. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 8fd36f59dcde..fdb7989e2997 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -239,7 +239,7 @@ static u16 l2cap_alloc_cid(struct l2cap_conn *conn) else dyn_end = L2CAP_CID_DYN_END; - for (cid = L2CAP_CID_DYN_START; cid < dyn_end; cid++) { + for (cid = L2CAP_CID_DYN_START; cid <= dyn_end; cid++) { if (!__l2cap_get_chan_by_scid(conn, cid)) return cid; }