[PATCH v2 0/2] media: uvcvideo: Fix race condition on metadata buffers

From: Ricardo Ribalda

Date: Mon Jun 29 2026 - 13:45:48 EST


This series fixes a race condition when calling streamoff only on the
metada queue while streaming.

The first patch fixes the race condition and the second patch replaces a
busy wait with a waitqueue. It is probably overkilled and this is why it
is a follow-up patch.

Feel free to apply the first patch, both, or squash them into one patch.

Regards!!

Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
---
Changes in v2:
- Use a new flag in_flight to avoid keeping the spinlock for long
periods of time
- Link to v1: https://lore.kernel.org/r/20250714-uvc-racemeta-v1-1-360de2e15a9a@xxxxxxxxxxxx

---
Ricardo Ribalda (2):
media: uvcvideo: Fix race condition for meta buffer list
media: uvcvideo: Use wait queue for metadata streamoff

drivers/media/usb/uvc/uvc_queue.c | 11 +++++++++++
drivers/media/usb/uvc/uvc_video.c | 32 +++++++++++++++++++++++++++++++-
drivers/media/usb/uvc/uvcvideo.h | 3 +++
3 files changed, 45 insertions(+), 1 deletion(-)
---
base-commit: 253355887a1ab0ac8f33b356c7c1140eee554d18
change-id: 20250714-uvc-racemeta-fee2e69bbfcd

Best regards,
--
Ricardo Ribalda <ribalda@xxxxxxxxxxxx>