Skip to contentSkip to conversation

Bluetooth: Reject device class changes when BR/EDR is not available

PATCH New Marcel Holtmann 1 participant 1 message Oct 3, 2013

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Reject device class changes when BR/EDR is not available

On LE only controllers or dual mode controllers with BR/EDR disabled, it makes no sense to allow programming of the minor and major class values. In these cases, just reject the operation.

---
 net/bluetooth/mgmt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/bluetooth/mgmt.c +4 -3
index e93d19a..9dbf185 100644
@@ -1753,13 +1753,14 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
 	struct mgmt_cp_set_dev_class *cp = data;
 	struct pending_cmd *cmd;
 	struct hci_request req;
+	u8 status;
 	int err;
 
 	BT_DBG("request for %s", hdev->name);
 
-	if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
-		return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
-				  MGMT_STATUS_NOT_SUPPORTED);
+	status = mgmt_bredr_support(hdev);
+	if (status)
+		return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, status);
 
 	hci_dev_lock(hdev);
 
Signature · 1 line
1.8.3.1