mirror of
https://github.com/torvalds/linux.git
synced 2026-09-27 11:02:03 +02:00
Bluetooth: hci_sock: reject out-of-range OCF values
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: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
0fcd4dad55
commit
e93fad891c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user