Skip to contentSkip to conversation

Bluetooth: Check that scan window is smaller or equal than scan interval

PATCH Applied Marcel Holtmann 2 participants 2 messages Oct 14, 2013

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Check that scan window is smaller or equal than scan interval

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.

---
 net/bluetooth/mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)
net/bluetooth/mgmt.c +4 -0
index caa552c..40c85ed 100644
@@ -3423,6 +3423,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;
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Marcel,

Quoted 10 lines · Marcel Holtmann

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.

---
 net/bluetooth/mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied to bluetooth-next. Thanks.

Johan