linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix removing Long Term Key
@ 2013-07-25 18:14 Claudio Takahasi
  2013-07-25 18:25 ` Marcel Holtmann
  2013-07-25 19:34 ` Claudio Takahasi
  0 siblings, 2 replies; 6+ messages in thread
From: Claudio Takahasi @ 2013-07-25 18:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

This patch fixes authentication failure on LE link re-connection when
BlueZ acts as slave (peripheral). LTK is removed from the internal list
after its first use causing PIN or Key missing reply when re-connecting
the link. The LE Long Term Key Request event indicates that the master
is attempting to encrypt or re-encrypt the link.

Pre-condition: BlueZ host paired and running as slave.
How to reproduce(master):
  1) Establish an ACL LE encrypted link
  2) Disconnect the link
  3) Try to re-establish the ACL LE encrypted link

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
---
 net/bluetooth/hci_event.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ae78738..ccb93dd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3558,7 +3558,8 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp);
 
-	if (ltk->type & HCI_SMP_STK) {
+	/* Use short term key only once */
+	if (ltk->type == HCI_SMP_STK_SLAVE) {
 		list_del(&ltk->list);
 		kfree(ltk);
 	}
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-05 18:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-25 18:14 [PATCH] Bluetooth: Fix removing Long Term Key Claudio Takahasi
2013-07-25 18:25 ` Marcel Holtmann
2013-07-25 19:34 ` Claudio Takahasi
2013-07-25 20:27   ` Claudio Takahasi
2013-08-16  3:29     ` Vinicius Costa Gomes
2014-03-05 18:58   ` Johan Hedberg

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).