Skip to content

Commit 08bb4da

Browse files
Alain Michaudholtmann
authored andcommitted
Bluetooth: guard against controllers sending zero'd events
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 <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 8a208b2 commit 08bb4da

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/bluetooth/hci_event.c

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

5871+
if (!event) {
5872+
bt_dev_warn(hdev, "Received unexpected HCI Event 00000000");
5873+
goto done;
5874+
}
5875+
58715876
if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) {
58725877
struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
58735878
opcode = __le16_to_cpu(cmd_hdr->opcode);
@@ -6079,6 +6084,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
60796084
req_complete_skb(hdev, status, opcode, orig_skb);
60806085
}
60816086

6087+
done:
60826088
kfree_skb(orig_skb);
60836089
kfree_skb(skb);
60846090
hdev->stat.evt_rx++;

0 commit comments

Comments
 (0)