<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/media/usb/uvc/uvc_ctrl.c, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2023-09-14T21:31:55Z</updated>
<entry>
<title>media: uvcvideo: Fix OOB read</title>
<updated>2023-09-14T21:31:55Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-07-20T17:46:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=41ebaa5e0eebea4c3bac96b72f9f8ae0d77c0bdb'/>
<id>urn:sha1:41ebaa5e0eebea4c3bac96b72f9f8ae0d77c0bdb</id>
<content type='text'>
If the index provided by the user is bigger than the mask size, we might do
an out of bound read.

CC: stable@kernel.org
Fixes: 40140eda661e ("media: uvcvideo: Implement mask for V4L2_CTRL_TYPE_MENU")
Reported-by: Zubin Mithra &lt;zsm@chromium.org&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>usb: uvc: move media/v4l2-uvc.h to usb/uvc.h</title>
<updated>2023-01-31T08:40:42Z</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2023-01-26T23:14:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e1d5d71d189f290343fb1f18eecf77335c5d1ef3'/>
<id>urn:sha1:e1d5d71d189f290343fb1f18eecf77335c5d1ef3</id>
<content type='text'>
Since the headerfile is only used in usb devices it is better
placed with the other usb files.

Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Reviewed-by: Daniel Scally &lt;dan.scally@ideasonboard.com&gt;
Tested-by: Daniel Scally &lt;dan.scally@ideasonboard.com&gt;
Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20230126231456.3402323-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Fix race condition with usb_kill_urb</title>
<updated>2023-01-15T21:45:15Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T14:31:29Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=619d9b710cf06f7a00a17120ca92333684ac45a8'/>
<id>urn:sha1:619d9b710cf06f7a00a17120ca92333684ac45a8</id>
<content type='text'>
usb_kill_urb warranties that all the handlers are finished when it
returns, but does not protect against threads that might be handling
asynchronously the urb.

For UVC, the function uvc_ctrl_status_event_async() takes care of
control changes asynchronously.

If the code is executed in the following order:

CPU 0					CPU 1
===== 					=====
uvc_status_complete()
					uvc_status_stop()
uvc_ctrl_status_event_work()
					uvc_status_start() -&gt; FAIL

Then uvc_status_start will keep failing and this error will be shown:

&lt;4&gt;[    5.540139] URB 0000000000000000 submitted while active
drivers/usb/core/urb.c:378 usb_submit_urb+0x4c3/0x528

Let's improve the current situation, by not re-submiting the urb if
we are stopping the status event. Also process the queued work
(if any) during stop.

CPU 0					CPU 1
===== 					=====
uvc_status_complete()
					uvc_status_stop()
					uvc_status_start()
uvc_ctrl_status_event_work() -&gt; FAIL

Hopefully, with the usb layer protection this should be enough to cover
all the cases.

Cc: stable@vger.kernel.org
Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
Reviewed-by: Yunke Cao &lt;yunkec@chromium.org&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Use standard names for menus</title>
<updated>2023-01-15T21:45:15Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T13:52:58Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=716c330433e3ad6074d057092b98c09a989e17d8'/>
<id>urn:sha1:716c330433e3ad6074d057092b98c09a989e17d8</id>
<content type='text'>
Instead of duplicating the menu info, use the one from the core.
Also, do not use extra memory for 1:1 mappings.

Suggested-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Fix power line control for Lenovo Integrated Camera</title>
<updated>2023-01-15T21:45:14Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T13:52:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a7c28150af42798263a30bedbe46f201b46fb486'/>
<id>urn:sha1:a7c28150af42798263a30bedbe46f201b46fb486</id>
<content type='text'>
The device does not implement the power line frequenyc control
correctly. It is a UVC 1.5 device, but implements the control as a UVC
1.1 device.

Add the corresponding control mapping override.

Bus 003 Device 002: ID 30c9:0093 Lenovo Integrated Camera
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x30c9
  idProduct          0x0093
  bcdDevice            0.07
  iManufacturer           3 Lenovo
  iProduct                1 Integrated Camera
  iSerial                 2 8SSC21J75356V1SR2830069
  bNumConfigurations      1

Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Refactor power_line_frequency_controls_limited</title>
<updated>2023-01-15T21:45:14Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T13:52:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3aa8628eb78a63d0bf93e159846e9c92bccc8f69'/>
<id>urn:sha1:3aa8628eb78a63d0bf93e159846e9c92bccc8f69</id>
<content type='text'>
Move the control mapping to uvc_ctrl.c. This way we do not have
references to UVC controls or V4L2 controls in uvc_driver.c.

This also fixes a bug introduced in commit 382075604a68 ("media:
uvcvideo: Limit power line control for Quanta UVC Webcam"). The
offending commit caused the power line control menu entries to have
incorrect indices compared to the V4L2_CID_POWER_LINE_FREQUENCY_*
enumeration. Now that the limited mapping reuses the correct menu_info
array, the indices correctly map to the V4L2 control specification.

Fixes: 382075604a68 ("media: uvcvideo: Limit power line control for Quanta UVC Webcam")
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Refactor uvc_ctrl_mappings_uvcXX</title>
<updated>2023-01-15T21:45:14Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T13:52:55Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=96a160b068e09b4ed5a32e2179e5219fc3545eca'/>
<id>urn:sha1:96a160b068e09b4ed5a32e2179e5219fc3545eca</id>
<content type='text'>
Convert the array of structs into an array of pointers, that way the
mappings can be reused.

Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Implement mask for V4L2_CTRL_TYPE_MENU</title>
<updated>2023-01-15T21:45:13Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-05T13:52:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=40140eda661ea4be219ef194a4f43b7b5e3bbd27'/>
<id>urn:sha1:40140eda661ea4be219ef194a4f43b7b5e3bbd27</id>
<content type='text'>
Replace the count with a mask field that lets us choose not only the max
value, but also the minimum value and what values are valid in between.

Suggested-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Refactor __uvc_ctrl_add_mapping</title>
<updated>2023-01-15T21:45:12Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-03T14:36:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=252d50da337ba97019574b1e830879d5dd5121d2'/>
<id>urn:sha1:252d50da337ba97019574b1e830879d5dd5121d2</id>
<content type='text'>
Simplify the exit code with a common error tag freeing all the memory.

Suggested-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
<entry>
<title>media: uvcvideo: Fix handling on Bitmask controls</title>
<updated>2023-01-15T21:45:12Z</updated>
<author>
<name>Ricardo Ribalda</name>
<email>ribalda@chromium.org</email>
</author>
<published>2023-01-03T14:36:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7faf8ae4277156da32eada72c07f5edeb82cd9e4'/>
<id>urn:sha1:7faf8ae4277156da32eada72c07f5edeb82cd9e4</id>
<content type='text'>
Minimum and step values for V4L2_CTRL_TYPE_BITMASK controls should be 0.
There is no need to query the camera firmware about this and maybe get
invalid results.

Also value should be masked to the max value advertised by the
hardware.

Finally, handle UVC 1.5 mask controls that use MAX instead of RES to
describe the valid bits.

Fixes v4l2-compliane:
Control ioctls (Input 0):
                fail: v4l2-test-controls.cpp(97): minimum must be 0 for a bitmask control
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL

Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
</content>
</entry>
</feed>
