All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: linux-media@vger.kernel.org
Cc: Mauricio Faria de Oliveira <mfo@igalia.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCHv2 0/6] media: em28xx: fix lifecycle issues
Date: Tue, 16 Jun 2026 15:10:26 +0200	[thread overview]
Message-ID: <cover.1781615432.git.hverkuil+cisco@kernel.org> (raw)

The first patch fixes (I believe) a bug in v4l2-async that
was introduced back in 2013. Sakari, can you take a look at this?

The second patch switches the em28xx driver to use the v4l2_device
release callback, letting the v4l2 core do all the refcounting
until the last user is gone and it is safe to free all memory.

The third patch drops the 'users' counter and uses the internal
v4l2_fh counter instead. The fourth patch switches
video_unregister_device to vb2_video_unregister_device: this
ensures all streaming is stopped when the video device is unregistered.

The fifth patch fixes a use-after-freed, and the last patch correctly
gives the vb2 buffers back to the vb2 framework if start_streaming
fails.

This has all been tested on my em28xx device.

Regards,

	Hans

Hans Verkuil (6):
  media: core: v4l2-async.c: unreg subdev if asc_list is empty
  media: em28xx: use v4l2_device release callback
  media: em28xx: drop 'users' field
  media: em28xx: use vb2_video_unregister_device
  media: em28xx: dev_info->pr_info since dev has been freed
  media: em28xx: requeue buffers if start_streaming fails

 drivers/media/usb/em28xx/em28xx-cards.c |   2 +-
 drivers/media/usb/em28xx/em28xx-video.c | 114 +++++++++++++++---------
 drivers/media/usb/em28xx/em28xx.h       |   2 -
 drivers/media/v4l2-core/v4l2-async.c    |   4 +-
 4 files changed, 74 insertions(+), 48 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-06-16 13:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 13:10 Hans Verkuil [this message]
2026-06-16 13:10 ` [PATCHv2 1/6] media: core: v4l2-async.c: unreg subdev if asc_list is empty Hans Verkuil
2026-06-16 15:15   ` Sakari Ailus
2026-06-16 13:10 ` [PATCHv2 2/6] media: em28xx: use v4l2_device release callback Hans Verkuil
2026-06-16 13:10 ` [PATCHv2 3/6] media: em28xx: drop 'users' field Hans Verkuil
2026-06-16 13:10 ` [PATCHv2 4/6] media: em28xx: use vb2_video_unregister_device Hans Verkuil
2026-06-16 13:10 ` [PATCHv2 5/6] media: em28xx: dev_info->pr_info since dev has been freed Hans Verkuil
2026-06-16 13:10 ` [PATCHv2 6/6] media: em28xx: requeue buffers if start_streaming fails Hans Verkuil

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=cover.1781615432.git.hverkuil+cisco@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mfo@igalia.com \
    --cc=sakari.ailus@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.