Re: [PATCH 1/2] media: uvcvideo: Fix NULL deref on events for uninitialized controls
From: Wei Jie LAW
Date: Mon Sep 07 2026 - 04:19:47 EST
On Mon, 7 Sept 2026 at 09:00:35, Ricardo Ribalda <ribalda@xxxxxxxxxxxx> wrote:
>
> Could you provide more info on how you reproduced the error?
The device I used is a Facedancer UVC gadget in a QEMU VM running
v6.12.105 + KASAN. It has:
- a Video Control interface with an Extension Unit: id 3, one control
declared in bmControls, GUID not matching any known mapping,
- a status interrupt IN endpoint.
The crash is fully device-driven; from the host side the only
thing needed is a process that keeps the video device open -- any
camera application will do (no ioctl, and no privileges beyond normal
camera access: the opener can be any active desktop user).
Userspace never sends UVCIOC_CTRL_MAP / UVCIOC_CTRL_QUERY for that GUID,
so the XU control stays exactly as uvc_ctrl_init_chain() kzalloc'ed it
(XUs are initialized lazily by uvc_ctrl_init_ctrl(), which skips them).
Something then opens /dev/videoN, which arms the status URB, and the
device sends this 16-byte control change event:
bStatusType = 1 (control)
bOriginator = 3 (the XU)
bEvent = 0
bSelector = 0
bAttribute = 0 (VALUE_CHANGE)
bValue[11]
The worker dies before it can resubmit the status URB, so one open()
gives one oops and the endpoint goes quiet; closing and reopening the
node repeats it. The oops does not depend on KASAN -- it is a plain NULL
walk on any kernel.
> nit: I would not add the comment.
Sure! Will remove the comments in a V2 patch, which I will submit later
along with the [2/2] patch request since it's a duplicate of yours.
Regards,
Wei Jie