All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: linux-media@vger.kernel.org
Cc: Guangshuo Li <lgs201920130244@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Ma Ke <make24@iscas.ac.cn>, Kees Cook <kees@kernel.org>
Subject: [PATCH 0/2] media: Revert 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()")
Date: Fri, 17 Jul 2026 15:42:44 +0200	[thread overview]
Message-ID: <cover.1784295766.git.hverkuil+cisco@kernel.org> (raw)

That commit exchanged a memory leak with a double-free scenario,
and it is not something that is easily fixable. Revert it, since it
is still better to leak memory than get into a double-free.

See this email discussion for more info:

https://lore.kernel.org/linux-media/20260520090624.1071139-1-lgs201920130244@gmail.com/

I tried to come up with a reliable method to handle this cleanly in the
v4l2 core, but the only way to do this properly would be to split
video_register_device into two parts: an init and a registration part.
And then convert all drivers to use the new functions.

That's a very big job, and so for now just revert the patch and add comments
explaining why it is reverted.

Regards,

	Hans

Hans Verkuil (2):
  Revert "media: v4l2-dev: fix error handling in
    __video_register_device()"
  media: v4l2-core: v4l2-dev: add comments on device_register fail.

 drivers/media/v4l2-core/v4l2-dev.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-07-17 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 13:42 Hans Verkuil [this message]
2026-07-17 13:42 ` [PATCH 1/2] Revert "media: v4l2-dev: fix error handling in __video_register_device()" Hans Verkuil
2026-07-17 13:42 ` [PATCH 2/2] media: v4l2-core: v4l2-dev: add comments on device_register fail 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.1784295766.git.hverkuil+cisco@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=kees@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=mchehab@kernel.org \
    --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.