Bluetooth: Mgmt Device Found Event
authorAndre Guedes <andre.guedes@openbossa.org>
Tue, 30 Apr 2013 18:29:40 +0000 (15:29 -0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Sat, 22 Jun 2013 23:23:52 +0000 (00:23 +0100)
We only want to send Mgmt Device Found Events if we are running the
Device Discovery procedure (started by the MGMT Start Discovery
Command). Inquiry or LE scanning triggered by HCI raw interface (e.g.
hcitool) or kernel internals should not send Mgmt Device Found Events.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/mgmt.c

index 69d17205745b9389494c6ebff3cb0aa8ef209a71..7ae737fcf5e7dc2ff949d00dab65bfff48e05a29 100644 (file)
@@ -4180,6 +4180,9 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
        struct mgmt_ev_device_found *ev = (void *) buf;
        size_t ev_size;
 
+       if (!hci_discovery_active(hdev))
+               return -EPERM;
+
        /* Leave 5 bytes for a potential CoD field */
        if (sizeof(*ev) + eir_len + 5 > sizeof(buf))
                return -EINVAL;