mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] media: em28xx: fix multiple disconnect races and UAFs
@ 2026-10-22 19:31 Nguyen Duy Nhat Anh
  2026-10-22 19:33 ` [PATCH 1/3] media: em28xx: check dev->disconnected in em28xx_v4l2_open() Nguyen Duy Nhat Anh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nguyen Duy Nhat Anh @ 2026-10-22 19:31 UTC (permalink / raw)
  To: mchehab; +Cc: llinux-media, linux-kernel, Nguyen Duy Nhat Anh

This patch series addresses three distinct lifecycle and race condition bugs in
the em28xx driver triggered during concurrent USB disconnect and userspace
file operations (open/close).

Fixing the initial refcount underflow (addressed in Patch 3/3) allowed
syzbot re-testing to progress further down the teardown pipeline, which
subsequently unveiled two deeper Use-After-Free (UAF) bugs in sequence
(Patches 1/3 and 2/3). 

Summary of changes in the patches:

1. media: em28xx: check dev->disconnected in em28xx_v4l2_open()
   Rejects open() attempts with -ENODEV when the device is disconnected,
   preventing hardware register I/O on freed dev->intf memory.

2. media: em28xx: clear v4l2_dev.mdev on media device unregister
   Zeros out v4l2_dev.mdev in em28xx_unregister_media_device() before freeing
   dev->media_dev, avoiding a dangling pointer read in v4l2_release() during
   file close.

3. media: em28xx: fix refcount underflow in em28xx_free_v4l2()
   Removes v4l2_device_unregister() from the v4l2_dev release callback
   em28xx_free_v4l2() and invokes it in em28xx_v4l2_fini() instead, eliminating
   an illegal double-decrement on a zero reference count.

Nguyen Duy Nhat Anh (3):
  media: em28xx: check dev->disconnected in em28xx_v4l2_open()
  media: em28xx: clear v4l2_dev.mdev on media device unregister
  media: em28xx: fix refcount underflow in em28xx_free_v4l2()

 drivers/media/usb/em28xx/em28xx-cards.c | 2 ++
 drivers/media/usb/em28xx/em28xx-video.c | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH 0/3] media: em28xx: fix multiple disconnect races and UAFs
@ 2026-10-22 19:46 Nguyen Duy Nhat Anh
  2026-10-22 19:48 ` [PATCH 1/3] media: em28xx: check dev->disconnected in em28xx_v4l2_open() Nguyen Duy Nhat Anh
  0 siblings, 1 reply; 5+ messages in thread
From: Nguyen Duy Nhat Anh @ 2026-10-22 19:46 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Nguyen Duy Nhat Anh

This patch series addresses three distinct lifecycle and race condition bugs in
the em28xx driver triggered during concurrent USB disconnect and userspace
file operations (open/close).

Fixing the initial refcount underflow (addressed in Patch 3/3) allowed
syzbot re-testing to progress further down the teardown pipeline, which
subsequently unveiled two deeper Use-After-Free (UAF) bugs in sequence
(Patches 1/3 and 2/3). 

Summary of changes in the patches:

1. media: em28xx: check dev->disconnected in em28xx_v4l2_open()
   Rejects open() attempts with -ENODEV when the device is disconnected,
   preventing hardware register I/O on freed dev->intf memory.

2. media: em28xx: clear v4l2_dev.mdev on media device unregister
   Zeros out v4l2_dev.mdev in em28xx_unregister_media_device() before freeing
   dev->media_dev, avoiding a dangling pointer read in v4l2_release() during
   file close.

3. media: em28xx: fix refcount underflow in em28xx_free_v4l2()
   Removes v4l2_device_unregister() from the v4l2_dev release callback
   em28xx_free_v4l2() and invokes it in em28xx_v4l2_fini() instead, eliminating
   an illegal double-decrement on a zero reference count.

Nguyen Duy Nhat Anh (3):
  media: em28xx: check dev->disconnected in em28xx_v4l2_open()
  media: em28xx: clear v4l2_dev.mdev on media device unregister
  media: em28xx: fix refcount underflow in em28xx_free_v4l2()

 drivers/media/usb/em28xx/em28xx-cards.c | 2 ++
 drivers/media/usb/em28xx/em28xx-video.c | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-22 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 19:31 [PATCH 0/3] media: em28xx: fix multiple disconnect races and UAFs Nguyen Duy Nhat Anh
2026-10-22 19:33 ` [PATCH 1/3] media: em28xx: check dev->disconnected in em28xx_v4l2_open() Nguyen Duy Nhat Anh
2026-10-22 19:34 ` [PATCH 2/3] media: em28xx: clear v4l2_dev.mdev on media device unregister Nguyen Duy Nhat Anh
2026-10-22 19:35 ` [PATCH 3/3] media: em28xx: fix refcount underflow in em28xx_free_v4l2() Nguyen Duy Nhat Anh
2026-10-22 19:46 [PATCH 0/3] media: em28xx: fix multiple disconnect races and UAFs Nguyen Duy Nhat Anh
2026-10-22 19:48 ` [PATCH 1/3] media: em28xx: check dev->disconnected in em28xx_v4l2_open() Nguyen Duy Nhat Anh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®