Bluetooth: Check that scan window is smaller or equal than scan interval
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Oct 2013 16:55:32 +0000 (09:55 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 14 Oct 2013 18:35:47 +0000 (21:35 +0300)
The scan window parameter for connection establishment and passive
scanning needs to be smaller or equal than the scan interval.

Instead of waiting for a controller to reject these values later on,
just reject them right away.

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

index 813012f..861e389 100644 (file)
@@ -3493,6 +3493,10 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
                return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
                                  MGMT_STATUS_INVALID_PARAMS);
 
+       if (window > interval)
+               return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
+                                 MGMT_STATUS_INVALID_PARAMS);
+
        hci_dev_lock(hdev);
 
        hdev->le_scan_interval = interval;