mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_sock: reject out-of-range OCF values
@ 2026-09-15 16:03 Aldo Ariel Panzardo
  2026-09-16 18:00 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Aldo Ariel Panzardo @ 2026-09-15 16:03 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, stable, Aldo Ariel Panzardo

The raw HCI socket security filter has 128 OCF bits per supported OGF,
but masks the 10-bit OCF with 127 before looking up the command. An
unprivileged socket can therefore submit a reserved OCF that aliases an
allowlisted command modulo 128.

A conforming controller should reject reserved opcodes. Nevertheless,
the security decision must apply to the opcode that will actually be
sent, especially since controller-specific behavior is outside the host
stack's control.

Reject OCF values that cannot be represented by the security filter
instead of aliasing them onto an unrelated command.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
---
 net/bluetooth/hci_sock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 070ca388f9..6413593eee 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1881,7 +1881,8 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 		u16 ocf = hci_opcode_ocf(opcode);
 
 		if (((ogf > HCI_SFLT_MAX_OGF) ||
-		     !hci_test_bit(ocf & HCI_FLT_OCF_BITS,
+		     (ocf > HCI_FLT_OCF_BITS) ||
+		     !hci_test_bit(ocf,
 				   &hci_sec_filter.ocf_mask[ogf])) &&
 		    !capable(CAP_NET_RAW)) {
 			err = -EPERM;
-- 
2.43.0


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

* Re: [PATCH] Bluetooth: hci_sock: reject out-of-range OCF values
  2026-09-15 16:03 [PATCH] Bluetooth: hci_sock: reject out-of-range OCF values Aldo Ariel Panzardo
@ 2026-09-16 18:00 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-16 18:00 UTC (permalink / raw)
  To: Aldo Ariel Panzardo; +Cc: luiz.dentz, linux-bluetooth, linux-kernel, stable

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 15 Sep 2026 13:03:58 -0300 you wrote:
> The raw HCI socket security filter has 128 OCF bits per supported OGF,
> but masks the 10-bit OCF with 127 before looking up the command. An
> unprivileged socket can therefore submit a reserved OCF that aliases an
> allowlisted command modulo 128.
> 
> A conforming controller should reject reserved opcodes. Nevertheless,
> the security decision must apply to the opcode that will actually be
> sent, especially since controller-specific behavior is outside the host
> stack's control.
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_sock: reject out-of-range OCF values
    https://git.kernel.org/bluetooth/bluetooth-next/c/e93fad891c72

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-09-16 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 16:03 [PATCH] Bluetooth: hci_sock: reject out-of-range OCF values Aldo Ariel Panzardo
2026-09-16 18:00 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®