OSDN Git Service

media: uvcvideo: Don't expose unsupported formats to userspace
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 20 Apr 2023 09:45:59 +0000 (10:45 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 2 Jun 2023 17:48:02 +0000 (18:48 +0100)
commit81f3affa19d6ab0c32aef46b053838219eef7e71
tree2e2b64b8eb598dbd6a1294708667edfba531aa3b
parentb37a356df86b9e56d30cef4673cba2621c7b7a1e
media: uvcvideo: Don't expose unsupported formats to userspace

When the uvcvideo driver encounters a format descriptor with an unknown
format GUID, it creates a corresponding struct uvc_format instance with
the fcc field set to 0. Since commit 50459f103edf ("media: uvcvideo:
Remove format descriptions"), the driver relies on the V4L2 core to
provide the format description string, which the V4L2 core can't do
without a valid 4CC. This triggers a WARN_ON.

As a format with a zero 4CC can't be selected, it is unusable for
applications. Ignore the format completely without creating a uvc_format
instance, which fixes the warning.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217252
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2180107
Fixes: 50459f103edf ("media: uvcvideo: Remove format descriptions")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/uvc/uvc_driver.c