From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> The aosp_capable flag shall only be changed while at the setup stage otherwise it can possible take no effect. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> --- include/net/bluetooth/hci_core.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index eb5d4ea88c3a..ac81745d2ac4 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1283,11 +1283,16 @@ static inline int hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode) return 0; } -static inline void hci_set_aosp_capable(struct hci_dev *hdev) +static inline int hci_set_aosp_capable(struct hci_dev *hdev) { + if (!hci_dev_test_flag(hdev, HCI_SETUP)) + return -EPERM; + #if IS_ENABLED(CONFIG_BT_AOSPEXT) hdev->aosp_capable = true; #endif + + return 0; } int hci_dev_open(__u16 dev); -- 2.31.1