aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-01-09 08:29:35 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-01-10 03:09:07 -0500
commit575b3a02e20a10bb8110378ef363a8a174018680 (patch)
tree677812b750e51e31090123be2320267d74582476 /net/bluetooth/mgmt.c
parent715a5bf2db4df4a7df64f420d21fb49ba146b3fa (diff)
Bluetooth: Fix checking for valid device class values
The two lowest bits of the minor device class value are reserved and should be zero, and the three highest bits of the major device class likewise. The management code should therefore test for this and return a proper "invalid params" error if the condition is not met. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1dd41d48eb66..f3fec4264dcf 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1430,6 +1430,12 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
1430 goto unlock; 1430 goto unlock;
1431 } 1431 }
1432 1432
1433 if ((cp->minor & 0x03) != 0 || (cp->major & 0xe0) != 0) {
1434 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
1435 MGMT_STATUS_INVALID_PARAMS);
1436 goto unlock;
1437 }
1438
1433 hdev->major_class = cp->major; 1439 hdev->major_class = cp->major;
1434 hdev->minor_class = cp->minor; 1440 hdev->minor_class = cp->minor;
1435 1441