[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o7unczd4.fsf@toke.dk>
Date: Fri, 07 Oct 2022 19:33:43 +0200
From: Toke Høiland-Jørgensen <toke@...nel.org>
To: Fedor Pchelkin <pchelkin@...ras.ru>,
Kalle Valo <kvalo@...eaurora.org>
Cc: Fedor Pchelkin <pchelkin@...ras.ru>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
ldv-project@...uxtesting.org,
Alan Stern <stern@...land.harvard.edu>
Subject: Re: [PATCH] ath9k: verify the expected usb_endpoints are present
Fedor Pchelkin <pchelkin@...ras.ru> writes:
> The bug arises when a USB device claims to be an ATH9K but doesn't
> have the expected endpoints. (In this case there was an interrupt
> endpoint where the driver expected a bulk endpoint.) The kernel
> needs to be able to handle such devices without getting an internal error.
>
> usb 1-1: BOGUS urb xfer, pipe 3 != type 1
> WARNING: CPU: 3 PID: 500 at drivers/usb/core/urb.c:493 usb_submit_urb+0xce2/0x1430 drivers/usb/core/urb.c:493
> Modules linked in:
> CPU: 3 PID: 500 Comm: kworker/3:2 Not tainted 5.10.135-syzkaller #0
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> Workqueue: events request_firmware_work_func
> RIP: 0010:usb_submit_urb+0xce2/0x1430 drivers/usb/core/urb.c:493
> Call Trace:
> ath9k_hif_usb_alloc_rx_urbs drivers/net/wireless/ath/ath9k/hif_usb.c:908 [inline]
> ath9k_hif_usb_alloc_urbs+0x75e/0x1010 drivers/net/wireless/ath/ath9k/hif_usb.c:1019
> ath9k_hif_usb_dev_init drivers/net/wireless/ath/ath9k/hif_usb.c:1109 [inline]
> ath9k_hif_usb_firmware_cb+0x142/0x530 drivers/net/wireless/ath/ath9k/hif_usb.c:1242
> request_firmware_work_func+0x12e/0x240 drivers/base/firmware_loader/main.c:1097
> process_one_work+0x9af/0x1600 kernel/workqueue.c:2279
> worker_thread+0x61d/0x12f0 kernel/workqueue.c:2425
> kthread+0x3b4/0x4a0 kernel/kthread.c:313
> ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:299
>
> Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
>
> Suggested-by: Alan Stern <stern@...land.harvard.edu>
> Signed-off-by: Fedor Pchelkin <pchelkin@...ras.ru>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---
> drivers/net/wireless/ath/ath9k/hif_usb.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 4d9002a9d082..2b26acf409fc 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -1332,6 +1332,20 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
> 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 *bulk_in, *bulk_out, *int_in, *int_out;
Please maintain the reverse x-mas tree ordering of the variable
definitions. See:
https://docs.kernel.org/process/maintainer-netdev.html#what-is-reverse-xmas-tree
Also, please make sure to add me directly to the Cc list when
resubmitting. Thanks!
-Toke
Powered by blists - more mailing lists