Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Set HCI_PAIRABLE during power on for legacy ioctl

When the controller is brought up using legacy ioctl, the setting of
the HCI_PAIRABLE flag should happen then. Previously it was set during
enumeration and when retrieving device information.

This change also will not set the HCI_PAIRABLE flag when the controller
is used with the HCI User Channel operation.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>

authored by

Marcel Holtmann and committed by
Johan Hedberg
12aa4f0a 2e84d8db

+10 -6
+10 -6
net/bluetooth/hci_core.c
··· 2435 2435 */ 2436 2436 flush_workqueue(hdev->req_workqueue); 2437 2437 2438 + /* For controllers not using the management interface and that 2439 + * are brought up using legacy ioctl, set the HCI_PAIRABLE bit 2440 + * so that pairing works for them. Once the management interface 2441 + * is in use this bit will be cleared again and userspace has 2442 + * to explicitly enable it. 2443 + */ 2444 + if (!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) && 2445 + !test_bit(HCI_MGMT, &hdev->dev_flags)) 2446 + set_bit(HCI_PAIRABLE, &hdev->dev_flags); 2447 + 2438 2448 err = hci_dev_do_open(hdev); 2439 2449 2440 2450 done: ··· 2836 2826 if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) 2837 2827 flags &= ~BIT(HCI_UP); 2838 2828 2839 - if (!test_bit(HCI_MGMT, &hdev->dev_flags)) 2840 - set_bit(HCI_PAIRABLE, &hdev->dev_flags); 2841 - 2842 2829 (dr + n)->dev_id = hdev->id; 2843 2830 (dr + n)->dev_opt = flags; 2844 2831 ··· 2875 2868 flags = hdev->flags & ~BIT(HCI_UP); 2876 2869 else 2877 2870 flags = hdev->flags; 2878 - 2879 - if (!test_bit(HCI_MGMT, &hdev->dev_flags)) 2880 - set_bit(HCI_PAIRABLE, &hdev->dev_flags); 2881 2871 2882 2872 strcpy(di.name, hdev->name); 2883 2873 di.bdaddr = hdev->bdaddr;