[Nak/cmt] [Trusty][pull request] (upstream) Bluetooth: Add quirk for disabling Delete Stored Link Key command

Andy Whitcroft apw at canonical.com
Fri Jul 25 10:07:34 UTC 2014


On Thu, Jul 24, 2014 at 07:53:03PM -0300, Rafael David Tinoco wrote:
> From 33893530d67d4aa8a887d1dde9d262844fe127b1 Mon Sep 17 00:00:00 2001
> From: Marcel Holtmann <marcel at holtmann.org>
> Date: Fri, 3 Jan 2014 03:02:35 -0800
> Subject: Bluetooth: Add quirk for disabling Delete Stored Link Key command
> 
> BugLink: http://bugs.launchpad.net/bugs/1221995
> 
> Bluetooth: Add quirk for disabling Delete Stored Link Key command
> 
> Some controller pretend they support the Delete Stored Link Key command,
> but in reality they really don't support it.
> 
>   < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7
>       bdaddr 00:00:00:00:00:00 all 1
>   > HCI Event: Command Complete (0x0e) plen 4
>       Delete Stored Link Key (0x03|0x0012) ncmd 1
>       status 0x11 deleted 0
>       Error: Unsupported Feature or Parameter Value
> 
> Not correctly supporting this command causes the controller setup to
> fail and will make a device not work. However sending the command for
> controller that handle stored link keys is important. This quirk
> allows a driver to disable the command if it knows that this command
> handling is broken.
> 
> OriginalAuthor: Marcel Holtmann <marcel at holtmann.org>
> Signed-off-by: Marcel Holtmann <marcel at holtmann.org>
> (cherry-picked from commit f9f462faa02777f497eb25255683a94e0c054de6 v3.14-rc1)
> Signed-off-by: Johan Hedberg <johan.hedberg at intel.com>
> Signed-off-by: Rafael Tinoco <rafael.tinoco at canonical.com>
> ---
>  include/net/bluetooth/hci.h | 3 ++-
>  net/bluetooth/hci_core.c    | 7 ++++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 1784c48..1096dda 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -83,7 +83,8 @@
>  enum {
>  	HCI_QUIRK_RESET_ON_CLOSE,
>  	HCI_QUIRK_RAW_DEVICE,
> -	HCI_QUIRK_FIXUP_BUFFER_SIZE
> +	HCI_QUIRK_FIXUP_BUFFER_SIZE,
> +	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
>  };
>  
>  /* HCI device flags */
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 6ccc4eb..bb4483d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1261,8 +1261,13 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
>  	 * as supported send it. If not supported assume that the controller
>  	 * does not have actual support for stored link keys which makes this
>  	 * command redundant anyway.
> +	 *
> +	 * Some controllers indicate that they support handling deleting
> +	 * stored link keys, but they don't. The quirk lets a driver
> +	 * just disable this command.
>  	 */
> -	if (hdev->commands[6] & 0x80) {
> +	if (hdev->commands[6] & 0x80 &&
> +	    !test_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks)) {
>  		struct hci_cp_delete_stored_link_key cp;
>  
>  		bacpy(&cp.bdaddr, BDADDR_ANY);
> -- 
> 1.9.1
> 
> 

This patch just adds a quirk with no quirk table to use it?  Is there
some way this quirk can be set from userspace or is there a followup
patch which uses this.  If so it makes more sense to submit these
together.

Looking at the bug this has also not actually been tested by anyone as
far as I can see, just Margarita asserting this is the fix.  But as I
say I do not see how this can be active.

>From a quick grep in v3.16-rc6 it seems that the only commit which would
use this new quirk is the one below, which does sound related, so you
would need that one too:

  commit 81cac64ba258ae823f52cfaec0cad26ecb31adc3
  Author: Marcel Holtmann <marcel at holtmann.org>
  Date:   Fri Jan 3 03:02:36 2014 -0800

    Bluetooth: Deal with USB devices that are faking CSR vendor

So probabally the one you submitted with that one might fix this, but
this would need testing by someone with the hardware.  So the next step
would be to make some test kernels with both applied and solicit testing
on the bug.  If that works resubmit the pair here.

-apw




More information about the kernel-team mailing list