diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-08-17 17:41:44 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-09-08 13:07:53 -0400 |
commit | f94b665dcf15324f5ac8aa639e47be0829b6409d (patch) | |
tree | d510060cd994c4b9cd9e0e543f01a2024eadf524 /net/bluetooth | |
parent | b3ff670a44cc34c01e78900c42255511e4f232e6 (diff) |
Bluetooth: Ignore incoming data after initiating disconnection
When hci_chan_del is called the disconnection routines get scheduled
through a workqueue. If there's any incoming ACL data before the
routines get executed there's a chance that a new hci_chan is created
and the disconnection never happens. This patch adds a new hci_conn flag
to indicate that we're in the process of driving the connection down. We
set the flag in hci_chan_del and check for it in hci_chan_create so that
no new channels are created for the same connection.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index cb04a4e3c829..aaa7e388d026 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -1291,6 +1291,11 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn) | |||
1291 | 1291 | ||
1292 | BT_DBG("%s hcon %p", hdev->name, conn); | 1292 | BT_DBG("%s hcon %p", hdev->name, conn); |
1293 | 1293 | ||
1294 | if (test_bit(HCI_CONN_DROP, &conn->flags)) { | ||
1295 | BT_DBG("Refusing to create new hci_chan"); | ||
1296 | return NULL; | ||
1297 | } | ||
1298 | |||
1294 | chan = kzalloc(sizeof(*chan), GFP_KERNEL); | 1299 | chan = kzalloc(sizeof(*chan), GFP_KERNEL); |
1295 | if (!chan) | 1300 | if (!chan) |
1296 | return NULL; | 1301 | return NULL; |
@@ -1318,6 +1323,7 @@ void hci_chan_del(struct hci_chan *chan) | |||
1318 | 1323 | ||
1319 | /* Force the connection to be immediately dropped */ | 1324 | /* Force the connection to be immediately dropped */ |
1320 | conn->disc_timeout = 0; | 1325 | conn->disc_timeout = 0; |
1326 | set_bit(HCI_CONN_DROP, &conn->flags); | ||
1321 | 1327 | ||
1322 | hci_conn_drop(conn); | 1328 | hci_conn_drop(conn); |
1323 | hci_conn_put(conn); | 1329 | hci_conn_put(conn); |