* [PATCH v3] bluetooth: guard against controllers sending zero'd events
@ 2020-03-03 15:55 Alain Michaud
2020-03-04 7:28 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Alain Michaud @ 2020-03-03 15:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Alain Michaud
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>
---
net/bluetooth/hci_event.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 591e7477e925..a40ed31f6eb8 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5868,6 +5868,11 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
u8 status = 0, event = hdr->evt, req_evt = 0;
u16 opcode = HCI_OP_NOP;
+ if (!event) {
+ bt_dev_warn(hdev, "Received unexpected HCI Event 00000000");
+ goto done;
+ }
+
if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) {
struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
opcode = __le16_to_cpu(cmd_hdr->opcode);
@@ -6079,6 +6084,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
req_complete_skb(hdev, status, opcode, orig_skb);
}
+done:
kfree_skb(orig_skb);
kfree_skb(skb);
hdev->stat.evt_rx++;
--
2.25.1.481.gfbce0eb801-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] bluetooth: guard against controllers sending zero'd events
2020-03-03 15:55 [PATCH v3] bluetooth: guard against controllers sending zero'd events Alain Michaud
@ 2020-03-04 7:28 ` Marcel Holtmann
2020-03-04 14:52 ` Alain Michaud
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2020-03-04 7:28 UTC (permalink / raw)
To: Alain Michaud; +Cc: linux-bluetooth
Hi Alain,
> 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>
> ---
>
> net/bluetooth/hci_event.c | 6 ++++++
> 1 file changed, 6 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] bluetooth: guard against controllers sending zero'd events
2020-03-04 7:28 ` Marcel Holtmann
@ 2020-03-04 14:52 ` Alain Michaud
0 siblings, 0 replies; 3+ messages in thread
From: Alain Michaud @ 2020-03-04 14:52 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Alain Michaud, BlueZ
Thanks Marcel.
On Wed, Mar 4, 2020 at 2:28 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Alain,
>
> > 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>
> > ---
> >
> > net/bluetooth/hci_event.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
>
> patch has been applied to bluetooth-next tree.
>
> Regards
>
> Marcel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-04 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 15:55 [PATCH v3] bluetooth: guard against controllers sending zero'd events Alain Michaud
2020-03-04 7:28 ` Marcel Holtmann
2020-03-04 14:52 ` Alain Michaud
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.