All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] media: Revert 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()")
@ 2026-07-17 13:42 Hans Verkuil
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Hans Verkuil @ 2026-07-17 13:42 UTC (permalink / raw)
  To: linux-media
  Cc: Guangshuo Li, Laurent Pinchart, Mauro Carvalho Chehab,
	Sakari Ailus, Ma Ke, Kees Cook

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


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

end of thread, other threads:[~2026-07-17 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 13:42 [PATCH 0/2] media: Revert 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()") Hans Verkuil
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

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.