On Sat Sep 12 17:29:45 2026 -0700, Xiang Mei wrote:
> em28xx_audio_urb_init() divides by the audio endpoint's wMaxPacketSize
> without checking it, so a USB device that declares a zero-sized audio
> endpoint divides by zero at probe time.
> 
> Reject a zero-sized audio endpoint like a missing one; the caller already
> unwinds on a negative return.
> 
>   Oops: divide error: 0000 [#1] SMP NOPTI
>   Workqueue: usb_hub_wq hub_event
>   RIP: 0010:em28xx_audio_init (drivers/media/usb/em28xx/em28xx-audio.c:718)
>   Call Trace:
>    em28xx_init_extension (drivers/media/usb/em28xx/em28xx-core.c:1248)
>    em28xx_init_dev.isra.0 (drivers/media/usb/em28xx/em28xx-cards.c:3887)
>    em28xx_usb_probe (drivers/media/usb/em28xx/em28xx-cards.c:4258)
>    usb_probe_interface (drivers/usb/core/driver.c:396)
>    ...
>    usb_set_configuration (drivers/usb/core/message.c:2268)
>    usb_generic_driver_probe (drivers/usb/core/generic.c:250)
>    usb_probe_device (drivers/usb/core/driver.c:291)
>    ...
>    usb_new_device (drivers/usb/core/hub.c:2703)
>    hub_event (drivers/usb/core/hub.c:5961)
>    process_one_work (kernel/workqueue.c:3322)
>    worker_thread (kernel/workqueue.c:3486)
>    kthread (kernel/kthread.c:436)
>    ret_from_fork (arch/x86/kernel/process.c:158)
>    ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
>   Kernel panic - not syncing: Fatal exception
> 
> Fixes: 1b3fd2d34266 ("[media] em28xx-audio: don't hardcode audio URB 
> calculus")
> Cc: [email protected]
> Reported-by: [email protected]
> Closes: 
> https://lore.kernel.org/all/51lCz4R7QyTUKbh4mhXNaNzX0evpk0siOzbh%40bugs.sh/
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Xiang Mei <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/usb/em28xx/em28xx-audio.c | 7 +++++++
 1 file changed, 7 insertions(+)

---

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index ccff6be5599e..7f0c5826ce5e 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -693,6 +693,13 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
        }
 
        ep_size = em28xx_audio_ep_packet_size(udev, ep);
+       if (ep_size == 0) {
+               dev_err(&dev->intf->dev,
+                       "Audio endpoint 0x%02x has a zero packet size\n",
+                       EM28XX_EP_AUDIO);
+               return -ENODEV;
+       }
+
        interval = 1 << (ep->bInterval - 1);
 
        dev_info(&dev->intf->dev,
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to