Browse Source

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 <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Johan Hedberg 9 years ago
parent
commit
ab0c127fbb
1 changed files with 1 additions and 1 deletions
  1. 1 1
      net/bluetooth/l2cap_core.c

+ 1 - 1
net/bluetooth/l2cap_core.c

@@ -239,7 +239,7 @@ static u16 l2cap_alloc_cid(struct l2cap_conn *conn)
 	else
 	else
 		dyn_end = L2CAP_CID_DYN_END;
 		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))
 		if (!__l2cap_get_chan_by_scid(conn, cid))
 			return cid;
 			return cid;
 	}
 	}