Skip to content

Commit

Permalink
Bluetooth: mgmt: Fix set_fast_connectable error return
Browse files Browse the repository at this point in the history
This patch ensures that Set Fast Connectable fails apropriately if we
are not already in a connectable state (which is a pre-requisite for
fast connectable).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Johan Hedberg committed Feb 21, 2012
1 parent b5235a6 commit 5400c04
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,13 @@ static int set_fast_connectable(struct sock *sk, u16 index,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
MGMT_STATUS_INVALID_PARAMS);
if (!hdev_is_powered(hdev))
return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
MGMT_STATUS_NOT_POWERED);

if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
MGMT_STATUS_REJECTED);

hci_dev_lock(hdev);

Expand Down

0 comments on commit 5400c04

Please sign in to comment.