diff mbox series

[v2] bluetooth: hci_event: don't print an error on vendor events

Message ID 20220302183515.448334-1-caleb.connolly@linaro.org (mailing list archive)
State Deferred
Headers show
Series [v2] bluetooth: hci_event: don't print an error on vendor events | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: net/bluetooth/hci_event.c:6822 error: net/bluetooth/hci_event.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

Caleb Connolly March 2, 2022, 6:35 p.m. UTC
Since commit 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events"),
some devices see warnings being printed for vendor events, e.g.

[   75.806141] Bluetooth: hci0: setting up wcn399x
[   75.948311] Bluetooth: hci0: unexpected event 0xff length: 14 > 0
[   75.955552] Bluetooth: hci0: QCA Product ID   :0x0000000a
[   75.961369] Bluetooth: hci0: QCA SOC Version  :0x40010214
[   75.967417] Bluetooth: hci0: QCA ROM Version  :0x00000201
[   75.973363] Bluetooth: hci0: QCA Patch Version:0x00000001
[   76.000289] Bluetooth: hci0: QCA controller version 0x02140201
[   76.006727] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv
[   76.986850] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.013574] Bluetooth: hci0: QCA Downloading qca/oneplus6/crnv21.bin
[   77.024302] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.032681] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.040674] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.049251] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.057997] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.066320] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.075065] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.083073] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.091250] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.099417] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.110166] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.118672] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.127449] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.137190] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.146192] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.154242] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.163183] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.171202] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.179364] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.187259] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
[   77.198451] Bluetooth: hci0: QCA setup on UART is completed

Avoid printing the event length warning for vendor events, this reverts
to the previous behaviour where such warnings weren't printed.

Fixes: 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events")
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
Changes since v1:
 * Don't return early! Vendor events still get parsed despite the
   warning. I should have looked a little more closely at that...
---
 net/bluetooth/hci_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com March 2, 2022, 7 p.m. UTC | #1
This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----
error: patch failed: net/bluetooth/hci_event.c:6822
error: net/bluetooth/hci_event.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch


Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth
Marcel Holtmann March 2, 2022, 7:20 p.m. UTC | #2
Hi Caleb,

> Since commit 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events"),
> some devices see warnings being printed for vendor events, e.g.
> 
> [   75.806141] Bluetooth: hci0: setting up wcn399x
> [   75.948311] Bluetooth: hci0: unexpected event 0xff length: 14 > 0
> [   75.955552] Bluetooth: hci0: QCA Product ID   :0x0000000a
> [   75.961369] Bluetooth: hci0: QCA SOC Version  :0x40010214
> [   75.967417] Bluetooth: hci0: QCA ROM Version  :0x00000201
> [   75.973363] Bluetooth: hci0: QCA Patch Version:0x00000001
> [   76.000289] Bluetooth: hci0: QCA controller version 0x02140201
> [   76.006727] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv
> [   76.986850] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.013574] Bluetooth: hci0: QCA Downloading qca/oneplus6/crnv21.bin
> [   77.024302] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.032681] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.040674] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.049251] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.057997] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.066320] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.075065] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.083073] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.091250] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.099417] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.110166] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.118672] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.127449] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.137190] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.146192] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.154242] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.163183] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.171202] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.179364] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.187259] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> [   77.198451] Bluetooth: hci0: QCA setup on UART is completed
> 
> Avoid printing the event length warning for vendor events, this reverts
> to the previous behaviour where such warnings weren't printed.
> 
> Fixes: 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events")
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
> Changes since v1:
> * Don't return early! Vendor events still get parsed despite the
>   warning. I should have looked a little more closely at that...
> ---
> net/bluetooth/hci_event.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-stable tree.

Regards

Marcel
Luiz Augusto von Dentz March 2, 2022, 8:58 p.m. UTC | #3
Hi Marcel, Caleb,

On Wed, Mar 2, 2022 at 11:20 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Caleb,
>
> > Since commit 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events"),
> > some devices see warnings being printed for vendor events, e.g.
> >
> > [   75.806141] Bluetooth: hci0: setting up wcn399x
> > [   75.948311] Bluetooth: hci0: unexpected event 0xff length: 14 > 0
> > [   75.955552] Bluetooth: hci0: QCA Product ID   :0x0000000a
> > [   75.961369] Bluetooth: hci0: QCA SOC Version  :0x40010214
> > [   75.967417] Bluetooth: hci0: QCA ROM Version  :0x00000201
> > [   75.973363] Bluetooth: hci0: QCA Patch Version:0x00000001
> > [   76.000289] Bluetooth: hci0: QCA controller version 0x02140201
> > [   76.006727] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv
> > [   76.986850] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.013574] Bluetooth: hci0: QCA Downloading qca/oneplus6/crnv21.bin
> > [   77.024302] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.032681] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.040674] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.049251] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.057997] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.066320] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.075065] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.083073] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.091250] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.099417] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.110166] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.118672] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.127449] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.137190] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.146192] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.154242] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.163183] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.171202] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.179364] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.187259] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
> > [   77.198451] Bluetooth: hci0: QCA setup on UART is completed
> >
> > Avoid printing the event length warning for vendor events, this reverts
> > to the previous behaviour where such warnings weren't printed.
> >
> > Fixes: 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events")
> > Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> > ---
> > Changes since v1:
> > * Don't return early! Vendor events still get parsed despite the
> >   warning. I should have looked a little more closely at that...
> > ---
> > net/bluetooth/hci_event.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> patch has been applied to bluetooth-stable tree.
>
> Regards
>
> Marcel

I believe a proper fix has already been pushed to bluetooth-next:

https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=314d8cd2787418c5ac6b02035c344644f47b292b

HCI_EV_VENDOR shall be assumed to be variable length and that also
uses bt_dev_warn_ratelimited to avoid spamming the logs in case it
still fails.
Marcel Holtmann March 3, 2022, 12:37 p.m. UTC | #4
Hi Luiz,

>>> Since commit 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events"),
>>> some devices see warnings being printed for vendor events, e.g.
>>> 
>>> [   75.806141] Bluetooth: hci0: setting up wcn399x
>>> [   75.948311] Bluetooth: hci0: unexpected event 0xff length: 14 > 0
>>> [   75.955552] Bluetooth: hci0: QCA Product ID   :0x0000000a
>>> [   75.961369] Bluetooth: hci0: QCA SOC Version  :0x40010214
>>> [   75.967417] Bluetooth: hci0: QCA ROM Version  :0x00000201
>>> [   75.973363] Bluetooth: hci0: QCA Patch Version:0x00000001
>>> [   76.000289] Bluetooth: hci0: QCA controller version 0x02140201
>>> [   76.006727] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv
>>> [   76.986850] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.013574] Bluetooth: hci0: QCA Downloading qca/oneplus6/crnv21.bin
>>> [   77.024302] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.032681] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.040674] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.049251] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.057997] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.066320] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.075065] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.083073] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.091250] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.099417] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.110166] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.118672] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.127449] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.137190] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.146192] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.154242] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.163183] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.171202] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.179364] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.187259] Bluetooth: hci0: unexpected event 0xff length: 3 > 0
>>> [   77.198451] Bluetooth: hci0: QCA setup on UART is completed
>>> 
>>> Avoid printing the event length warning for vendor events, this reverts
>>> to the previous behaviour where such warnings weren't printed.
>>> 
>>> Fixes: 3e54c5890c87 ("Bluetooth: hci_event: Use of a function table to handle HCI events")
>>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>>> ---
>>> Changes since v1:
>>> * Don't return early! Vendor events still get parsed despite the
>>>  warning. I should have looked a little more closely at that...
>>> ---
>>> net/bluetooth/hci_event.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> patch has been applied to bluetooth-stable tree.
>> 
> I believe a proper fix has already been pushed to bluetooth-next:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=314d8cd2787418c5ac6b02035c344644f47b292b
> 
> HCI_EV_VENDOR shall be assumed to be variable length and that also
> uses bt_dev_warn_ratelimited to avoid spamming the logs in case it
> still fails.

ok, I reverted the patch and lets this go via net-next tree then. Stable can pick this up if it really becomes a larger problem.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index fc30f4c03d29..9b7c9ab77971 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6822,7 +6822,7 @@  static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,
 	 * possible to partially parse the event so leave to callback to
 	 * decide if that is acceptable.
 	 */
-	if (skb->len > ev->max_len)
+	if (skb->len > ev->max_len && event != HCI_EV_VENDOR)
 		bt_dev_warn(hdev, "unexpected event 0x%2.2x length: %u > %u",
 			    event, skb->len, ev->max_len);