public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Claudio Takahasi <claudio.takahasi@openbossa.org>,
	Johan Hedberg <johan.hedberg@intel.com>
Subject: [PATCH 3.13 14/32] Bluetooth: Fix removing Long Term Key
Date: Sun, 20 Apr 2014 19:13:31 -0700	[thread overview]
Message-ID: <20140421021135.821158652@linuxfoundation.org> (raw)
In-Reply-To: <20140421021133.865086647@linuxfoundation.org>

3.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Claudio Takahasi <claudio.takahasi@openbossa.org>

commit 5981a8821b774ada0be512fd9bad7c241e17657e upstream.

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 (fails)

> HCI Event: LE Meta Event (0x3e) plen 19
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Slave (0x01)
...
@ Device Connected: 00:02:72:DC:29:C9 (1) flags 0x0000
> HCI Event: LE Meta Event (0x3e) plen 13
      LE Long Term Key Request (0x05)
        Handle: 64
        Random number: 875be18439d9aa37
        Encryption diversifier: 0x76ed
< HCI Command: LE Long Term Key Request Reply (0x08|0x001a) plen 18
        Handle: 64
        Long term key: 2aa531db2fce9f00a0569c7d23d17409
> HCI Event: Command Complete (0x0e) plen 6
      LE Long Term Key Request Reply (0x08|0x001a) ncmd 1
        Status: Success (0x00)
        Handle: 64
> HCI Event: Encryption Change (0x08) plen 4
        Status: Success (0x00)
        Handle: 64
        Encryption: Enabled with AES-CCM (0x01)
...
@ Device Disconnected: 00:02:72:DC:29:C9 (1) reason 3
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
        Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Advertise Enable (0x08|0x000a) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Slave (0x01)
...
@ Device Connected: 00:02:72:DC:29:C9 (1) flags 0x0000
> HCI Event: LE Meta Event (0x3e) plen 13
      LE Long Term Key Request (0x05)
        Handle: 64
        Random number: 875be18439d9aa37
        Encryption diversifier: 0x76ed
< HCI Command: LE Long Term Key Request Neg Reply (0x08|0x001b) plen 2
        Handle: 64
> HCI Event: Command Complete (0x0e) plen 6
      LE Long Term Key Request Neg Reply (0x08|0x001b) ncmd 1
        Status: Success (0x00)
        Handle: 64
> HCI Event: Disconnect Complete (0x05) plen 4
        Status: Success (0x00)
        Handle: 64
        Reason: Authentication Failure (0x05)
@ Device Disconnected: 00:02:72:DC:29:C9 (1) reason 0

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/bluetooth/hci_event.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3596,7 +3596,13 @@ static void hci_le_ltk_request_evt(struc
 
 	hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp);
 
-	if (ltk->type & HCI_SMP_STK) {
+	/* Ref. Bluetooth Core SPEC pages 1975 and 2004. STK is a
+	 * temporary key used to encrypt a connection following
+	 * pairing. It is used during the Encrypted Session Setup to
+	 * distribute the keys. Later, security can be re-established
+	 * using a distributed LTK.
+	 */
+	if (ltk->type == HCI_SMP_STK_SLAVE) {
 		list_del(&ltk->list);
 		kfree(ltk);
 	}



  parent reply	other threads:[~2014-04-21  4:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21  2:13 [PATCH 3.13 00/32] 3.13.11-stable review Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 01/32] user namespace: fix incorrect memory barriers Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 02/32] Char: ipmi_bt_sm, fix infinite loop Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 03/32] x86, hyperv: Bypass the timer_irq_works() check Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 04/32] x86: Adjust irq remapping quirk for older revisions of 5500/5520 chipsets Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 05/32] PCI: designware: Fix RC BAR to be single 64-bit non-prefetchable memory BAR Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 06/32] PCI: designware: Fix iATU programming for cfg1, io and mem viewport Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 07/32] ACPI / button: Add ACPI Button event via netlink routine Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 08/32] PCI: Enable INTx in pci_reenable_device() only when MSI/MSI-X not enabled Greg Kroah-Hartman
2014-04-21 14:24   ` Ben Hutchings
2014-04-22 16:32     ` Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 09/32] staging: comedi: 8255_pci: initialize MITE data window Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 10/32] tty: Set correct tty name in active sysfs attribute Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 11/32] tty: Fix low_latency BUG Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 12/32] SCSI: sd: dont fail if the device doesnt recognize SYNCHRONIZE CACHE Greg Kroah-Hartman
2014-04-21  2:13 ` Greg Kroah-Hartman [this message]
2014-04-21  2:13 ` [PATCH 3.13 15/32] ima: restore the original behavior for sending data with ima template Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 16/32] backing_dev: fix hung task on sync Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 17/32] bdi: avoid oops on device removal Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 18/32] xfs: fix directory hash ordering bug Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 19/32] Btrfs: skip submitting barrier for missing device Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 20/32] Btrfs: fix deadlock with nested trans handles Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 21/32] ext4: fix error return from ext4_ext_handle_uninitialized_extents() Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 22/32] ext4: fix partial cluster handling for bigalloc file systems Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 23/32] ext4: fix premature freeing of partial clusters split across leaf blocks Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 24/32] jffs2: Fix segmentation fault found in stress test Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 25/32] jffs2: Fix crash due to truncation of csize Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 26/32] jffs2: avoid soft-lockup in jffs2_reserve_space_gc() Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 27/32] jffs2: remove from wait queue after schedule() Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 28/32] sparc32: fix build failure for arch_jump_label_transform Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 29/32] sparc64: dont treat 64-bit syscall return codes as 32-bit Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 30/32] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 31/32] wait: fix reparent_leader() vs EXIT_DEAD->EXIT_ZOMBIE race Greg Kroah-Hartman
2014-04-21  2:13 ` [PATCH 3.13 32/32] exit: call disassociate_ctty() before exit_task_namespaces() Greg Kroah-Hartman
2014-04-21 13:25 ` [PATCH 3.13 00/32] 3.13.11-stable review Guenter Roeck
2014-04-21 19:03   ` Greg Kroah-Hartman
2014-04-22  1:06 ` Guenter Roeck
2014-04-22  1:14   ` Greg Kroah-Hartman
2014-04-22 15:48 ` Shuah Khan
2014-04-22 19:36   ` Greg Kroah-Hartman

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=20140421021135.821158652@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=claudio.takahasi@openbossa.org \
    --cc=johan.hedberg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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