Skip to content

Commit e500a98

Browse files
Alain Michaudgregkh
authored andcommitted
Bluetooth: guard against controllers sending zero'd events
[ Upstream commit 08bb4da ] Some controllers have been observed to send zero'd events under some conditions. This change guards against this condition as well as adding a trace to facilitate diagnosability of this condition. Signed-off-by: Alain Michaud <alainm@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 12b28ad commit e500a98

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

net/bluetooth/hci_event.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,6 +5257,11 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
52575257
u8 status = 0, event = hdr->evt, req_evt = 0;
52585258
u16 opcode = HCI_OP_NOP;
52595259

5260+
if (!event) {
5261+
bt_dev_warn(hdev, "Received unexpected HCI Event 00000000");
5262+
goto done;
5263+
}
5264+
52605265
if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) {
52615266
struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
52625267
opcode = __le16_to_cpu(cmd_hdr->opcode);
@@ -5468,6 +5473,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
54685473
req_complete_skb(hdev, status, opcode, orig_skb);
54695474
}
54705475

5476+
done:
54715477
kfree_skb(orig_skb);
54725478
kfree_skb(skb);
54735479
hdev->stat.evt_rx++;

0 commit comments

Comments
 (0)