Bluetooth: Check HCI_PERIODIC_INQ in start_discovery
authorAndre Guedes <aguedespe@gmail.com>
Wed, 21 Mar 2012 03:03:37 +0000 (00:03 -0300)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 9 May 2012 03:41:34 +0000 (00:41 -0300)
This patch adds a HCI_PERIODIC_INQ check to start_discovery.
If periodic inquiry is enabled, we fail MGMT Start Discovery
command with MGMT_STATUS_BUSY code.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
net/bluetooth/mgmt.c

index 2975a10fca07ee6490cbcffc7ad82e0e7a157d3e..4bb0a130e7d9c93e4184031b12b199d6b2c2efdb 100644 (file)
@@ -2315,6 +2315,12 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
                goto failed;
        }
 
+       if (test_bit(HCI_PERIODIC_INQ, &hdev->dev_flags)) {
+               err = cmd_status(sk, hdev->id, MGMT_OP_START_DISCOVERY,
+                                MGMT_STATUS_BUSY);
+               goto failed;
+       }
+
        if (hdev->discovery.state != DISCOVERY_STOPPED) {
                err = cmd_status(sk, hdev->id, MGMT_OP_START_DISCOVERY,
                                 MGMT_STATUS_BUSY);