Re: WARNING in hif_usb_send/usb_submit_urb

From: Alan Stern
Date: Fri Oct 09 2020 - 21:46:59 EST


On Fri, Oct 09, 2020 at 02:55:08PM -0700, syzbot wrote:
> Hello,
>
> syzbot tried to test the proposed patch but the build/boot failed:
>
> drivers/net/wireless/ath/ath9k/hif_usb.c:1319:7: error: implicit declaration of function 'usb_find_bulk_in'; did you mean 'usb_fill_bulk_urb'? [-Werror=implicit-function-declaration]

Let's try again, using a different repository.

#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);