From: Xiang Mei <xmei5@asu.edu>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
co+9782320f78c23f40@bugs.sh, Xiang Mei <xmei5@asu.edu>,
stable@vger.kernel.org
Subject: [PATCH] media: em28xx: reject audio endpoint with zero packet size
Date: Sat, 12 Sep 2026 17:29:45 -0700 [thread overview]
Message-ID: <20260913002945.338569-1-xmei5@asu.edu> (raw)
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: stable@vger.kernel.org
Reported-by: co+9782320f78c23f40@bugs.sh
Closes: https://lore.kernel.org/all/51lCz4R7QyTUKbh4mhXNaNzX0evpk0siOzbh%40bugs.sh/
Assisted-by: Claude:claude-opus-5
Signed-off-by: Xiang Mei <xmei5@asu.edu>
---
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,
--
2.43.0
reply other threads:[~2026-09-13 0:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260913002945.338569-1-xmei5@asu.edu \
--to=xmei5@asu.edu \
--cc=co+9782320f78c23f40@bugs.sh \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox