diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-07 16:13:37 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-08 10:02:08 -0500 |
commit | bd2d1334e1dd64765b29f9e1b592777c410ed121 (patch) | |
tree | 116a8fd6bd554e0dffa070eb13bcad9fb6cc7fc5 /net/bluetooth/mgmt.c | |
parent | 889d07ee57e950790cbec81df7b4f9d8691ee0b4 (diff) |
Bluetooth: Fix response for mgmt_start_discovery when powered off
We should return a ENETDOWN status response if the adapter is powered
off (i.e. the HCI_UP flag isn't set).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index e33b12e09270..af077abdfa98 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1619,6 +1619,11 @@ static int start_discovery(struct sock *sk, u16 index) | |||
1619 | 1619 | ||
1620 | hci_dev_lock_bh(hdev); | 1620 | hci_dev_lock_bh(hdev); |
1621 | 1621 | ||
1622 | if (!test_bit(HCI_UP, &hdev->flags)) { | ||
1623 | err = cmd_status(sk, index, MGMT_OP_START_DISCOVERY, ENETDOWN); | ||
1624 | goto failed; | ||
1625 | } | ||
1626 | |||
1622 | cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, index, NULL, 0); | 1627 | cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, index, NULL, 0); |
1623 | if (!cmd) { | 1628 | if (!cmd) { |
1624 | err = -ENOMEM; | 1629 | err = -ENOMEM; |