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

Commit 5400c044 authored by Johan Hedberg's avatar Johan Hedberg
Browse files

Bluetooth: mgmt: Fix set_fast_connectable error return



This patch ensures that Set Fast Connectable fails apropriately if we
are not already in a connectable state (which is a pre-requisite for
fast connectable).

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent b5235a65
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2560,6 +2560,13 @@ static int set_fast_connectable(struct sock *sk, u16 index,
	if (!hdev)
		return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
						MGMT_STATUS_INVALID_PARAMS);
	if (!hdev_is_powered(hdev))
		return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
						MGMT_STATUS_NOT_POWERED);

	if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
		return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
							MGMT_STATUS_REJECTED);

	hci_dev_lock(hdev);