aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-04-25 16:30:17 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2013-04-26 13:00:02 +0300
commitc068b9bb796876e72e7b06cd540103911522a4e4 (patch)
treea43239633710c642583f0140e9b79d14bb3ed015
parent0172cf3a2341800ffa3a7463fcc5ce6e6956c9c3 (diff)
downloadbluetooth-next-c068b9bb796876e72e7b06cd540103911522a4e4.tar.gz
Bluetooth: Fix EBUSY condition test in l2cap_chan_connect
The current test in l2cap_chan_connect is intended to protect against multiple conflicting connect attempts. However, it assumes that there will ever only be a single CID that is connected to, which is not true. We do need to check for conflicts with connect attempts to the same destination CID but this check is not in anyway specific to LE but can be applied to BR/EDR as well. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--net/bluetooth/l2cap_core.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 8f73837b58e551..f7221ee74345cd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1811,16 +1811,10 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
goto done;
}
- if (hcon->type == LE_LINK) {
- err = 0;
-
- if (!list_empty(&conn->chan_l)) {
- err = -EBUSY;
- hci_conn_drop(hcon);
- }
-
- if (err)
- goto done;
+ if (cid && __l2cap_get_chan_by_dcid(conn, cid)) {
+ hci_conn_drop(hcon);
+ err = -EBUSY;
+ goto done;
}
/* Update source addr of the socket */