Re: WARNING in smsusb_start_streaming/usb_submit_urb
From: Nikita Zhandarovich
Date: Mon Apr 08 2024 - 07:11:07 EST
Try fixing current endpoint checking by testing endpoint type
as well.
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e
---
drivers/media/usb/siano/smsusb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index 723510520d09..daaac121c670 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -405,10 +405,10 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
struct usb_endpoint_descriptor *desc =
&intf->cur_altsetting->endpoint[i].desc;
- if (desc->bEndpointAddress & USB_DIR_IN) {
+ if (usb_endpoint_is_bulk_in(desc)) {
dev->in_ep = desc->bEndpointAddress;
align = usb_endpoint_maxp(desc) - sizeof(struct sms_msg_hdr);
- } else {
+ } else if (usb_endpoint_is_bulk_out(desc)) {
dev->out_ep = desc->bEndpointAddress;
}
}