]> git.baikalelectronics.ru Git - kernel.git/commit
media: uvcvideo: Fix memory leak if uvc_ctrl_add_mapping fails
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 1 Apr 2022 16:44:58 +0000 (18:44 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 8 May 2022 05:09:48 +0000 (07:09 +0200)
commit5216e278a7b064e8c4e8702925ecd67bce9046dd
tree3e8e60837e5054a45ebaea9187aad281a5060db7
parente209b2919deb5a0c159031efe142507bfb8a63c6
media: uvcvideo: Fix memory leak if uvc_ctrl_add_mapping fails

Move all the life cycle of the name to add_mapping. This simplifies
the error handling inside uvc_ioctl_ctrl_map and solves a memory leak
when kemmdup fails.

Also make sure that for custom controls, the user provides a valid name.

Fixes: 07adedb5c606 ("media: uvcvideo: Use control names from framework")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/uvc/uvc_ctrl.c
drivers/media/usb/uvc/uvc_v4l2.c