summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRaphael Pinsonneault-Thibeault <rpthibeault@gmail.com>2025-10-24 12:29:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-13 15:34:36 -0500
commitcf2c2acec1cf456c3d11c11a7589e886a0f963a9 (patch)
treee36729b79618e05756b91e36b49616e8203e288e /net
parentc849e6941fec2742a7c7e1634f25e530e39acea7 (diff)
downloadlinux-cf2c2acec1cf456c3d11c11a7589e886a0f963a9.tar.gz
linux-cf2c2acec1cf456c3d11c11a7589e886a0f963a9.tar.bz2
linux-cf2c2acec1cf456c3d11c11a7589e886a0f963a9.zip
Bluetooth: hci_event: validate skb length for unknown CC opcode
[ Upstream commit 5c5f1f64681cc889d9b13e4a61285e9e029d6ab5 ] In hci_cmd_complete_evt(), if the command complete event has an unknown opcode, we assume the first byte of the remaining skb->data contains the return status. However, parameter data has previously been pulled in hci_event_func(), which may leave the skb empty. If so, using skb->data[0] for the return status uses un-init memory. The fix is to check skb->len before using skb->data. Reported-by: syzbot+a9a4bedfca6aa9d7fa24@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=a9a4bedfca6aa9d7fa24 Tested-by: syzbot+a9a4bedfca6aa9d7fa24@syzkaller.appspotmail.com Fixes: afcb3369f46ed ("Bluetooth: hci_event: Fix vendor (unknown) opcode status handling") Signed-off-by: Raphael Pinsonneault-Thibeault <rpthibeault@gmail.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_event.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ccc73742de35..498b7e4c76d5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4210,6 +4210,13 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, void *data,
}
if (i == ARRAY_SIZE(hci_cc_table)) {
+ if (!skb->len) {
+ bt_dev_err(hdev, "Unexpected cc 0x%4.4x with no status",
+ *opcode);
+ *status = HCI_ERROR_UNSPECIFIED;
+ return;
+ }
+
/* Unknown opcode, assume byte 0 contains the status, so
* that e.g. __hci_cmd_sync() properly returns errors
* for vendor specific commands send by HCI drivers.