* [PATCH] bluetooth: bfusb: Check the endpoint type at probe
@ 2022-05-13 12:43 Zheyu Ma
2022-05-13 12:53 ` Marcel Holtmann
2022-05-13 14:07 ` [PATCH v2] Bluetooth: " Zheyu Ma
0 siblings, 2 replies; 4+ messages in thread
From: Zheyu Ma @ 2022-05-13 12:43 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz; +Cc: linux-bluetooth, linux-kernel, Zheyu Ma
The driver reported an warning in usb_submit_urb() which is caused by
wrong endpoint type.
[ 3.295630] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
[ 3.295916] WARNING: CPU: 0 PID: 33 at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
[ 3.298155] RIP: 0010:usb_submit_urb+0xcd9/0x18b0
[ 3.302451] Call Trace:
[ 3.302580] <TASK>
[ 3.302698] bfusb_rx_submit+0x24e/0x390 [bfusb]
[ 3.302938] bfusb_open+0x50/0x90 [bfusb]
Fix this by checking the endpoint type at first.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
drivers/bluetooth/bfusb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index cab93935cc7f..447b6876c552 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -613,7 +613,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
bulk_out_ep = &intf->cur_altsetting->endpoint[0];
bulk_in_ep = &intf->cur_altsetting->endpoint[1];
- if (!bulk_out_ep || !bulk_in_ep) {
+ if (!bulk_out_ep || !bulk_in_ep ||
+ !usb_endpoint_is_bulk_out(&bulk_out_ep->desc) ||
+ !usb_endpoint_is_bulk_in(&bulk_in_ep->desc)) {
BT_ERR("Bulk endpoints not found");
goto done;
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bluetooth: bfusb: Check the endpoint type at probe
2022-05-13 12:43 [PATCH] bluetooth: bfusb: Check the endpoint type at probe Zheyu Ma
@ 2022-05-13 12:53 ` Marcel Holtmann
2022-05-13 13:25 ` Zheyu Ma
2022-05-13 14:07 ` [PATCH v2] Bluetooth: " Zheyu Ma
1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2022-05-13 12:53 UTC (permalink / raw)
To: Zheyu Ma; +Cc: Johan Hedberg, Luiz Augusto von Dentz, BlueZ, linux-kernel
Hi Zheyu,
> The driver reported an warning in usb_submit_urb() which is caused by
> wrong endpoint type.
>
> [ 3.295630] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
> [ 3.295916] WARNING: CPU: 0 PID: 33 at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
> [ 3.298155] RIP: 0010:usb_submit_urb+0xcd9/0x18b0
> [ 3.302451] Call Trace:
> [ 3.302580] <TASK>
> [ 3.302698] bfusb_rx_submit+0x24e/0x390 [bfusb]
> [ 3.302938] bfusb_open+0x50/0x90 [bfusb]
>
> Fix this by checking the endpoint type at first.
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
> drivers/bluetooth/bfusb.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
> index cab93935cc7f..447b6876c552 100644
> --- a/drivers/bluetooth/bfusb.c
> +++ b/drivers/bluetooth/bfusb.c
> @@ -613,7 +613,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
> bulk_out_ep = &intf->cur_altsetting->endpoint[0];
> bulk_in_ep = &intf->cur_altsetting->endpoint[1];
>
> - if (!bulk_out_ep || !bulk_in_ep) {
> + if (!bulk_out_ep || !bulk_in_ep ||
> + !usb_endpoint_is_bulk_out(&bulk_out_ep->desc) ||
> + !usb_endpoint_is_bulk_in(&bulk_in_ep->desc)) {
> BT_ERR("Bulk endpoints not found");
> goto done;
> }
how are you getting this. This driver only works on one specific piece of hardware.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bluetooth: bfusb: Check the endpoint type at probe
2022-05-13 12:53 ` Marcel Holtmann
@ 2022-05-13 13:25 ` Zheyu Ma
0 siblings, 0 replies; 4+ messages in thread
From: Zheyu Ma @ 2022-05-13 13:25 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Johan Hedberg, Luiz Augusto von Dentz, BlueZ, Linux Kernel Mailing List
On Fri, May 13, 2022 at 8:53 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Zheyu,
>
> > The driver reported an warning in usb_submit_urb() which is caused by
> > wrong endpoint type.
> >
> > [ 3.295630] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
> > [ 3.295916] WARNING: CPU: 0 PID: 33 at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
> > [ 3.298155] RIP: 0010:usb_submit_urb+0xcd9/0x18b0
> > [ 3.302451] Call Trace:
> > [ 3.302580] <TASK>
> > [ 3.302698] bfusb_rx_submit+0x24e/0x390 [bfusb]
> > [ 3.302938] bfusb_open+0x50/0x90 [bfusb]
> >
> > Fix this by checking the endpoint type at first.
> >
> > Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> > ---
> > drivers/bluetooth/bfusb.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
> > index cab93935cc7f..447b6876c552 100644
> > --- a/drivers/bluetooth/bfusb.c
> > +++ b/drivers/bluetooth/bfusb.c
> > @@ -613,7 +613,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
> > bulk_out_ep = &intf->cur_altsetting->endpoint[0];
> > bulk_in_ep = &intf->cur_altsetting->endpoint[1];
> >
> > - if (!bulk_out_ep || !bulk_in_ep) {
> > + if (!bulk_out_ep || !bulk_in_ep ||
> > + !usb_endpoint_is_bulk_out(&bulk_out_ep->desc) ||
> > + !usb_endpoint_is_bulk_in(&bulk_in_ep->desc)) {
> > BT_ERR("Bulk endpoints not found");
> > goto done;
> > }
>
> how are you getting this. This driver only works on one specific piece of hardware.
Actually, I used a virtual device to test the driver, and got the above warning.
The USB device may be programmable and malicious, so the driver should
carefully treat the input that the device provided.
Regards,
Zheyu Ma
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] Bluetooth: bfusb: Check the endpoint type at probe
2022-05-13 12:43 [PATCH] bluetooth: bfusb: Check the endpoint type at probe Zheyu Ma
2022-05-13 12:53 ` Marcel Holtmann
@ 2022-05-13 14:07 ` Zheyu Ma
1 sibling, 0 replies; 4+ messages in thread
From: Zheyu Ma @ 2022-05-13 14:07 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz; +Cc: linux-bluetooth, linux-kernel, Zheyu Ma
The driver reported an warning in usb_submit_urb() which is caused by
wrong endpoint type.
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
RIP: 0010:usb_submit_urb+0xcd9/0x18b0
Call Trace:
<TASK>
bfusb_rx_submit+0x24e/0x390 [bfusb]
bfusb_open+0x50/0x90 [bfusb]
Fix this by checking the endpoint type at first.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
Changes in v2:
- Format the commit message
---
drivers/bluetooth/bfusb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index cab93935cc7f..447b6876c552 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -613,7 +613,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
bulk_out_ep = &intf->cur_altsetting->endpoint[0];
bulk_in_ep = &intf->cur_altsetting->endpoint[1];
- if (!bulk_out_ep || !bulk_in_ep) {
+ if (!bulk_out_ep || !bulk_in_ep ||
+ !usb_endpoint_is_bulk_out(&bulk_out_ep->desc) ||
+ !usb_endpoint_is_bulk_in(&bulk_in_ep->desc)) {
BT_ERR("Bulk endpoints not found");
goto done;
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-13 14:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 12:43 [PATCH] bluetooth: bfusb: Check the endpoint type at probe Zheyu Ma
2022-05-13 12:53 ` Marcel Holtmann
2022-05-13 13:25 ` Zheyu Ma
2022-05-13 14:07 ` [PATCH v2] Bluetooth: " Zheyu Ma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®