Skip to content

media: Revert 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()")

Hans Verkuil linux-media stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Revert "media: v4l2-dev: fix error handling in __video_register_device()"drivers/media/v4l2-core/v4l2-dev.c+7 -70 replies
2/2media: v4l2-core: v4l2-dev: add comments on device_register fail.drivers/media/v4l2-core/v4l2-dev.c+14 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLaurent Pinchart
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] media: Revert 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()")

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/[email protected]/

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(-)
Signature · 1 line
2.53.0