Skip to content

Commit

Permalink
Bluetooth: Fix response for mgmt_start_discovery when powered off
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hedberg authored and Gustavo F. Padovan committed Nov 8, 2011
1 parent 889d07e commit bd2d133
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bd2d133

Please sign in to comment.