summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-11-07 23:13:37 +0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-08 13:02:08 -0200
commitbd2d1334e1dd64765b29f9e1b592777c410ed121 (patch)
tree116a8fd6bd554e0dffa070eb13bcad9fb6cc7fc5 /net
parent889d07ee57e950790cbec81df7b4f9d8691ee0b4 (diff)
downloadblackbird-op-linux-bd2d1334e1dd64765b29f9e1b592777c410ed121.tar.gz
blackbird-op-linux-bd2d1334e1dd64765b29f9e1b592777c410ed121.zip
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')
-rw-r--r--net/bluetooth/mgmt.c5
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)
hci_dev_lock_bh(hdev);
+ if (!test_bit(HCI_UP, &hdev->flags)) {
+ err = cmd_status(sk, index, MGMT_OP_START_DISCOVERY, ENETDOWN);
+ goto failed;
+ }
+
cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, index, NULL, 0);
if (!cmd) {
err = -ENOMEM;
OpenPOWER on IntegriCloud