From: "Alexandre Courbot" <gnurou@gmail.com>
To: "Nick Rogers" <nick@getfieldwork.ai>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Brian Daniels" <briandaniels@google.com>,
<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: v4l2-ioctl: zero the ext control built for VIDIOC_{G,S}_CTRL
Date: Fri, 25 Sep 2026 10:07:33 +0900 [thread overview]
Message-ID: <DLNZU3AQ6BPI.3HCOHX5HXVIAN@gmail.com> (raw)
In-Reply-To: <20260923160936.33445-1-nick@getfieldwork.ai>
On Thu Sep 24, 2026 at 1:09 AM JST, Nick Rogers wrote:
> When a driver implements the extended control ioctls but has no control
> handler, v4l_g_ctrl() and v4l_s_ctrl() pass VIDIOC_G_CTRL and
> VIDIOC_S_CTRL on as a single struct v4l2_ext_control built on the stack.
> Only its id and value are set, and check_ext_ctrls() clears reserved[0]
> and reserved2[0]; the control's size and the rest of both structures are
> left uninitialized.
>
> A driver that forwards the controls rather than handling them through
> the control framework sees that stack garbage. The virtio-media driver
> under review takes a nonzero size as a payload to copy from userspace,
> so VIDIOC_G_CTRL and VIDIOC_S_CTRL fail with -EINVAL through it whenever
> the stack is dirty. GStreamer's V4L2 encoders set their profile with
> VIDIOC_S_CTRL, and cannot negotiate against such a device.
>
> Zero-initialize both structures.
>
> Assisted-by: Claude:claude-opus-5-5
nit: per the kernel guidelines [1], this should be
Assisted-by: LLM
[1] https://docs.kernel.org/process/coding-assistants.html#attribution
prev parent reply other threads:[~2026-09-25 1:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 16:09 [PATCH] media: v4l2-ioctl: zero the ext control built for VIDIOC_{G,S}_CTRL Nick Rogers
2026-09-23 17:15 ` Nicolas Dufresne
2026-09-25 0:57 ` Alexandre Courbot
2026-09-25 1:07 ` Alexandre Courbot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DLNZU3AQ6BPI.3HCOHX5HXVIAN@gmail.com \
--to=gnurou@gmail.com \
--cc=briandaniels@google.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nick@getfieldwork.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.