All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Bluetooth: Only allow setting msft_opcode at setup stage
@ 2021-10-13  0:30 Luiz Augusto von Dentz
  2021-10-13  0:30 ` [PATCH v2 2/4] Bluetooth: Only allow setting AOSP capable " Luiz Augusto von Dentz
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2021-10-13  0:30 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The msft_opcode shall only be changed while at the setup stage otherwise
it can possible cause problems where different opcodes are used while
running.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
v2: Fix typos: s/extention/extension/g

 include/net/bluetooth/hci_core.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index dd8840e70e25..eb5d4ea88c3a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1272,11 +1272,15 @@ int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb);
 __printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...);
 __printf(2, 3) void hci_set_fw_info(struct hci_dev *hdev, const char *fmt, ...);
 
-static inline void hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode)
+static inline int hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode)
 {
+	if (!hci_dev_test_flag(hdev, HCI_SETUP))
+		return -EPERM;
+
 #if IS_ENABLED(CONFIG_BT_MSFTEXT)
 	hdev->msft_opcode = opcode;
 #endif
+	return 0;
 }
 
 static inline void hci_set_aosp_capable(struct hci_dev *hdev)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-13 21:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-13  0:30 [PATCH v2 1/4] Bluetooth: Only allow setting msft_opcode at setup stage Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 2/4] Bluetooth: Only allow setting AOSP capable " Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 3/4] Bluetooth: vhci: Add support for setting msft_opcode Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 4/4] Bluetooth: vhci: Add support for setting aosp_capable Luiz Augusto von Dentz
2021-10-13  6:45   ` Marcel Holtmann
2021-10-13 21:29     ` Luiz Augusto von Dentz
2021-10-13  2:11 ` [v2,1/4] Bluetooth: Only allow setting msft_opcode at setup stage bluez.test.bot
2021-10-13  6:35 ` [PATCH v2 1/4] " Marcel Holtmann
2021-10-13 21:10   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.