Bluetooth: Fix not updating scan rsp when adv off
authorMichał Narajowski <michal.narajowski@codecoup.pl>
Thu, 22 Sep 2016 14:01:39 +0000 (16:01 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 22 Sep 2016 15:48:23 +0000 (17:48 +0200)
Scan response data should not be updated unless there
is an advertising instance.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index 63f42f4..19b8a5e 100644 (file)
@@ -3159,7 +3159,7 @@ static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data,
        /* The name is stored in the scan response data and so
         * no need to udpate the advertising data here.
         */
-       if (lmp_le_capable(hdev))
+       if (lmp_le_capable(hdev) && hci_dev_test_flag(hdev, HCI_ADVERTISING))
                __hci_req_update_scan_rsp_data(&req, hdev->cur_adv_instance);
 
        err = hci_req_run(&req, set_name_complete);