Skip to content

Commit 202e2ff

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 a941594 commit 202e2ff

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
@@ -5853,6 +5853,11 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
58535853
u8 status = 0, event = hdr->evt, req_evt = 0;
58545854
u16 opcode = HCI_OP_NOP;
58555855

5856+
if (!event) {
5857+
bt_dev_warn(hdev, "Received unexpected HCI Event 00000000");
5858+
goto done;
5859+
}
5860+
58565861
if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) {
58575862
struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
58585863
opcode = __le16_to_cpu(cmd_hdr->opcode);
@@ -6064,6 +6069,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
60646069
req_complete_skb(hdev, status, opcode, orig_skb);
60656070
}
60666071

6072+
done:
60676073
kfree_skb(orig_skb);
60686074
kfree_skb(skb);
60696075
hdev->stat.evt_rx++;

0 commit comments

Comments
 (0)