Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd2d1334 authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan
Browse files

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 889d07ee
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;