Re: WARNING in hif_usb_send/usb_submit_urb
From: Alan Stern
Date: Fri Oct 09 2020 - 21:40:08 EST
On Fri, Oct 09, 2020 at 05:56:09PM -0700, syzbot wrote:
> Hello,
>
> syzbot tried to test the proposed patch but the build/boot failed:
Oops. One more try, with the typos fixed.
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v5.9-rc8
Index: usb-devel/drivers/net/wireless/ath/ath9k/hif_usb.c
===================================================================
--- usb-devel.orig/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ usb-devel/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1307,6 +1307,20 @@ static int ath9k_hif_usb_probe(struct us
struct usb_device *udev = interface_to_usbdev(interface);
struct hif_device_usb *hif_dev;
int ret = 0;
+ struct usb_host_interface *alt;
+ struct usb_endpoint_descriptor *epd;
+
+ /* Verify the expected endpoints are present */
+ alt = interface->cur_altsetting;
+ if (!usb_find_int_in_endpoint(alt, &epd) ||
+ usb_endpoint_num(epd) != USB_REG_IN_PIPE ||
+ !usb_find_int_out_endpoint(alt, &epd) ||
+ usb_endpoint_num(epd) != USB_REG_OUT_PIPE ||
+ !usb_find_bulk_in_endpoint(alt, &epd) ||
+ usb_endpoint_num(epd) != USB_WLAN_RX_PIPE ||
+ !usb_find_bulk_out_endpoint(alt, &epd) ||
+ usb_endpoint_num(epd) != USB_WLAN_TX_PIPE)
+ return -ENODEV;
if (id->driver_info == STORAGE_DEVICE)
return send_eject_command(interface);