From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 3/8] Bluetooth: Use hci_disconnect for immediate disconnection from SMP
Date: Mon, 18 Aug 2014 20:33:29 +0300 [thread overview]
Message-ID: <1408383214-16366-4-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1408383214-16366-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
Relying on the l2cap_conn_del procedure (triggered through the
l2cap_conn_shutdown API) to get the connection disconnected is not
reliable as it depends on all users releasing (through hci_conn_drop)
and that there's at least one user (so hci_conn_drop is called at least
one time).
A much simpler and more reliable solution is to call hci_disconnect()
directly from the SMP code when we want to disconnect. One side-effect
this has is that it prevents any SMP Failure PDU from being sent before
the disconnection, however neither one of the scenarios where
l2cap_conn_shutdown was used really requires this.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 07ca4ce0943b..496584921fdc 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -829,7 +829,7 @@ static void smp_timeout(struct work_struct *work)
BT_DBG("conn %p", conn);
- l2cap_conn_shutdown(conn, ETIMEDOUT);
+ hci_disconnect(conn->hcon, HCI_ERROR_REMOTE_USER_TERM);
}
static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
@@ -1569,7 +1569,7 @@ static int smp_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
if (smp)
cancel_delayed_work_sync(&smp->security_timer);
- l2cap_conn_shutdown(chan->conn, -err);
+ hci_disconnect(chan->conn->hcon, HCI_ERROR_AUTH_FAILURE);
}
return err;
--
1.9.3
next prev parent reply other threads:[~2014-08-18 17:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 17:33 [PATCH 0/8] Bluetooth: SMP & disconnection fixes johan.hedberg
2014-08-18 17:33 ` [PATCH 1/8] Bluetooth: Remove hci_conn_hold/drop from hci_chan johan.hedberg
2014-08-18 17:33 ` [PATCH 2/8] Bluetooth: Set discon_timeout to 0 in l2cap_conn_del johan.hedberg
2014-08-18 17:33 ` johan.hedberg [this message]
2014-08-18 17:33 ` [PATCH 4/8] Bluetooth: Remove unused l2cap_conn_shutdown API johan.hedberg
2014-08-18 17:33 ` [PATCH 5/8] Bluetooth: Fix SMP error and response to be mutually exclusive johan.hedberg
2014-08-18 17:33 ` [PATCH 6/8] Bluetooth: Update hci_disconnect() to return an error value johan.hedberg
2014-08-18 17:33 ` [PATCH 7/8] Bluetooth: Use hci_disconnect() for mgmt_disconnect_device() johan.hedberg
2014-08-18 17:33 ` [PATCH 8/8] Bluetooth: Move clock offset reading into hci_disconnect() johan.hedberg
2014-08-18 21:09 ` [PATCH 0/8] Bluetooth: SMP & disconnection fixes Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408383214-16366-4-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).