Skip to contentSkip to conversation

Bluetooth: Fix Add Device response status

PATCH Superseded Jakub Pawlowski 2 participants 3 messages Jul 13, 2015 – Jul 30, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix Add Device response status

Make sure that MGMT_STATUS_INVALID_PARAMS is returned when non identity address is passed to ADD_DEVICE. Right now MGMT_STATUS_FAILED is returned, which might be misleading.

---
 net/bluetooth/mgmt.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/bluetooth/mgmt.c +7 -0
index 7998fb2..47462bf 100644
@@ -6226,6 +6226,13 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
 	else
 		auto_conn = HCI_AUTO_CONN_REPORT;
 
+	/* Allow only identity addresses */
+	if (!hci_is_identity_address(&cp->addr.bdaddr, addr_type)) {
+		err = cmd->cmd_complete(cmd, MGMT_STATUS_INVALID_PARAMS);
+		mgmt_pending_remove(cmd);
+		goto unlock;
+	}
+
 	/* If the connection parameters don't exist for this device,
 	 * they will be created and configured with defaults.
 	 */
Signature · 1 line
2.1.4
maintainer
#1 lore raw

Hi Jakub,

Quoted 14 lines

Make sure that MGMT_STATUS_INVALID_PARAMS is returned when non identity address is passed to ADD_DEVICE. Right now MGMT_STATUS_FAILED is returned, which might be misleading.

---
net/bluetooth/mgmt.c | 7 +++++++

1 file changed, 7 insertions(+)
net/bluetooth/mgmt.c +0 -0
index 7998fb2..47462bf 100644

net/bluetooth/mgmt.c static int add_device(struct sock *sk, struct hci_dev *hdev, · line 6235

Quoted 10 lines
net/bluetooth/mgmt.c +7 -0
@@ -6226,6 +6226,13 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
 	else
 		auto_conn = HCI_AUTO_CONN_REPORT;
 
+	/* Allow only identity addresses */
+	if (!hci_is_identity_address(&cp->addr.bdaddr, addr_type)) {
+		err = cmd->cmd_complete(cmd, MGMT_STATUS_INVALID_PARAMS);
+		mgmt_pending_remove(cmd);
+		goto unlock;
+	}
+

did we loose this patch or is it no longer needed?

Regards

Marcel

#2 lore raw
Quoted 19 lines · Marcel Holtmann

Hi Jakub,

Quoted 17 lines

Make sure that MGMT_STATUS_INVALID_PARAMS is returned when non identity address is passed to ADD_DEVICE. Right now MGMT_STATUS_FAILED is returned, which might be misleading.

---
net/bluetooth/mgmt.c | 7 +++++++

1 file changed, 7 insertions(+)
net/bluetooth/mgmt.c +0 -0
index 7998fb2..47462bf 100644
@@ -6226,6 +6226,13 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
      else
              auto_conn = HCI_AUTO_CONN_REPORT;
 
Quoted 10 lines

net/bluetooth/mgmt.c static int add_device(struct sock *sk, struct hci_dev *hdev, · line 6235

Quoted 7 lines
net/bluetooth/mgmt.c +7 -0
+     /* Allow only identity addresses */
+     if (!hci_is_identity_address(&cp->addr.bdaddr, addr_type)) {
+             err = cmd->cmd_complete(cmd, MGMT_STATUS_INVALID_PARAMS);
+             mgmt_pending_remove(cmd);
+             goto unlock;
+     }
+

did we loose this patch or is it no longer needed?

It's no longer needed, it was squashed with other patch. Thanks,
Jakub

Quoted 4 lines

Regards

Marcel