mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 02:21:15 +00:00
Bluetooth: Disabling discoverable with timeout is invalid
Add one extra sanity check to ensure that the supplied timeout value is actually valid in this context. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
f51d5b2489
commit
24c54a9052
1 changed files with 5 additions and 2 deletions
|
@ -850,13 +850,16 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
|
||||||
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
|
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
|
||||||
MGMT_STATUS_INVALID_PARAMS);
|
MGMT_STATUS_INVALID_PARAMS);
|
||||||
|
|
||||||
|
timeout = get_unaligned_le16(&cp->timeout);
|
||||||
|
if (!cp->val && timeout > 0)
|
||||||
|
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
|
||||||
|
MGMT_STATUS_INVALID_PARAMS);
|
||||||
|
|
||||||
hdev = hci_dev_get(index);
|
hdev = hci_dev_get(index);
|
||||||
if (!hdev)
|
if (!hdev)
|
||||||
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
|
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
|
||||||
MGMT_STATUS_INVALID_PARAMS);
|
MGMT_STATUS_INVALID_PARAMS);
|
||||||
|
|
||||||
timeout = get_unaligned_le16(&cp->timeout);
|
|
||||||
|
|
||||||
hci_dev_lock(hdev);
|
hci_dev_lock(hdev);
|
||||||
|
|
||||||
if (!hdev_is_powered(hdev) && timeout > 0) {
|
if (!hdev_is_powered(hdev) && timeout > 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue