提交 bd2d1334 编写于 作者: J Johan Hedberg 提交者: Gustavo F. Padovan

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: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
上级 889d07ee
...@@ -1619,6 +1619,11 @@ static int start_discovery(struct sock *sk, u16 index) ...@@ -1619,6 +1619,11 @@ static int start_discovery(struct sock *sk, u16 index)
hci_dev_lock_bh(hdev); 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); cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, index, NULL, 0);
if (!cmd) { if (!cmd) {
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册