]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: L2CAP: Fix checked range when allocating new CID
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 2 Nov 2015 12:39:16 +0000 (14:39 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Nov 2015 03:04:07 +0000 (04:04 +0100)
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>
net/bluetooth/l2cap_core.c

index 8fd36f59dcdef344d02d5d6f27df5a4af4d561e5..fdb7989e29976742a6617b7c54b87c7562aa5a06 100644 (file)
@@ -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;
        }