aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-11-17 13:52:19 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-17 19:53:15 -0500
commitc19a495c8bccc15acd299f26d72b5d51eb3acb1d (patch)
tree8d730eb6198e2a68e5283f4476aca677c3025293 /net
parentee7b9053bd69ff43cbc87a9bb987f4d92dc2c29f (diff)
Bluetooth: Fix BR/EDR-only address checks for remote OOB data
For now the mgmt commands dealing with remote OOB data are strictly BR/EDR-only. This patch fixes missing checks for the passed address type so that any non-BR/EDR value triggers the appropriate error response. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b84c0923ec62..258c9826e78c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3589,6 +3589,14 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3589 struct mgmt_cp_add_remote_oob_data *cp = data; 3589 struct mgmt_cp_add_remote_oob_data *cp = data;
3590 u8 status; 3590 u8 status;
3591 3591
3592 if (cp->addr.type != BDADDR_BREDR) {
3593 err = cmd_complete(sk, hdev->id,
3594 MGMT_OP_ADD_REMOTE_OOB_DATA,
3595 MGMT_STATUS_INVALID_PARAMS,
3596 &cp->addr, sizeof(cp->addr));
3597 goto unlock;
3598 }
3599
3592 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, 3600 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr,
3593 cp->hash, cp->randomizer); 3601 cp->hash, cp->randomizer);
3594 if (err < 0) 3602 if (err < 0)
@@ -3602,6 +3610,14 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3602 struct mgmt_cp_add_remote_oob_ext_data *cp = data; 3610 struct mgmt_cp_add_remote_oob_ext_data *cp = data;
3603 u8 status; 3611 u8 status;
3604 3612
3613 if (cp->addr.type != BDADDR_BREDR) {
3614 err = cmd_complete(sk, hdev->id,
3615 MGMT_OP_ADD_REMOTE_OOB_DATA,
3616 MGMT_STATUS_INVALID_PARAMS,
3617 &cp->addr, sizeof(cp->addr));
3618 goto unlock;
3619 }
3620
3605 err = hci_add_remote_oob_ext_data(hdev, &cp->addr.bdaddr, 3621 err = hci_add_remote_oob_ext_data(hdev, &cp->addr.bdaddr,
3606 cp->hash192, 3622 cp->hash192,
3607 cp->randomizer192, 3623 cp->randomizer192,
@@ -3620,6 +3636,7 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3620 MGMT_STATUS_INVALID_PARAMS); 3636 MGMT_STATUS_INVALID_PARAMS);
3621 } 3637 }
3622 3638
3639unlock:
3623 hci_dev_unlock(hdev); 3640 hci_dev_unlock(hdev);
3624 return err; 3641 return err;
3625} 3642}
@@ -3633,6 +3650,11 @@ static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3633 3650
3634 BT_DBG("%s", hdev->name); 3651 BT_DBG("%s", hdev->name);
3635 3652
3653 if (cp->addr.type != BDADDR_BREDR)
3654 return cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
3655 MGMT_STATUS_INVALID_PARAMS,
3656 &cp->addr, sizeof(cp->addr));
3657
3636 hci_dev_lock(hdev); 3658 hci_dev_lock(hdev);
3637 3659
3638 if (!bacmp(&cp->addr.bdaddr, BDADDR_ANY)) { 3660 if (!bacmp(&cp->addr.bdaddr, BDADDR_ANY)) {