aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/mgmt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 402cb0026f5d..f590dfbe9e07 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2532,12 +2532,19 @@ static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data,
2532{ 2532{
2533 struct mgmt_cp_set_device_id *cp = data; 2533 struct mgmt_cp_set_device_id *cp = data;
2534 int err; 2534 int err;
2535 __u16 source;
2535 2536
2536 BT_DBG("%s", hdev->name); 2537 BT_DBG("%s", hdev->name);
2537 2538
2539 source = __le16_to_cpu(cp->source);
2540
2541 if (source > 0x0002)
2542 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEVICE_ID,
2543 MGMT_STATUS_INVALID_PARAMS);
2544
2538 hci_dev_lock(hdev); 2545 hci_dev_lock(hdev);
2539 2546
2540 hdev->devid_source = __le16_to_cpu(cp->source); 2547 hdev->devid_source = source;
2541 hdev->devid_vendor = __le16_to_cpu(cp->vendor); 2548 hdev->devid_vendor = __le16_to_cpu(cp->vendor);
2542 hdev->devid_product = __le16_to_cpu(cp->product); 2549 hdev->devid_product = __le16_to_cpu(cp->product);
2543 hdev->devid_version = __le16_to_cpu(cp->version); 2550 hdev->devid_version = __le16_to_cpu(cp->version);