All of lore.kernel.org
 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-15 17:45 ` bluez.test.bot
  2026-09-16 18:00 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ 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 related	[flat|nested] 3+ messages in thread

* RE: 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-15 17:45 ` bluez.test.bot
  2026-09-16 18:00 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-09-15 17:45 UTC (permalink / raw)
  To: linux-bluetooth, qwe.aldo

[-- Attachment #1: Type: text/plain, Size: 3111 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1165737/

---Test result---

Test Summary:
CheckPatch                    PASS      0.60 seconds
VerifyFixes                   PASS      0.08 seconds
VerifySignedoff               PASS      0.08 seconds
GitLint                       PASS      0.24 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      29.76 seconds
CheckAllWarning               PASS      33.34 seconds
CheckSparse                   PASS      35.91 seconds
BuildKernel32                 PASS      29.37 seconds
CheckKernelLLVM               PASS      34.86 seconds
TestRunnerSetup               PASS      792.23 seconds
TestRunner_l2cap-tester       FAIL      8.63 seconds
TestRunner_iso-tester         FAIL      8.02 seconds
TestRunner_bnep-tester        FAIL      7.98 seconds
TestRunner_mgmt-tester        FAIL      7.93 seconds
TestRunner_rfcomm-tester      FAIL      7.88 seconds
TestRunner_sco-tester         FAIL      7.99 seconds
TestRunner_ioctl-tester       FAIL      7.95 seconds
TestRunner_mesh-tester        FAIL      7.84 seconds
TestRunner_smp-tester         FAIL      8.02 seconds
TestRunner_userchan-tester    FAIL      8.06 seconds
TestRunner_6lowpan-tester     FAIL      8.00 seconds
IncrementalBuild              PASS      27.88 seconds

Details
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_bnep-tester - FAIL
Desc: Run bnep-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_rfcomm-tester - FAIL
Desc: Run rfcomm-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_ioctl-tester - FAIL
Desc: Run ioctl-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_smp-tester - FAIL
Desc: Run smp-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_userchan-tester - FAIL
Desc: Run userchan-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_6lowpan-tester - FAIL
Desc: Run 6lowpan-tester with test-runner
Output:
No test result found


https://github.com/bluez/bluetooth-next/pull/777

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ 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-15 17:45 ` bluez.test.bot
@ 2026-09-16 18:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

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

Thread overview: 3+ 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-15 17:45 ` bluez.test.bot
2026-09-16 18:00 ` [PATCH] " patchwork-bot+bluetooth

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.