From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com,
Prabhakar <prabhakar.csengg@gmail.com>,
"Kate Hsuan" <hpa@redhat.com>,
"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Tommaso Merciai" <tomm.merciai@gmail.com>,
"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Julien Massot" <julien.massot@collabora.com>,
"Naushir Patuck" <naush@raspberrypi.com>,
"Yan, Dongcheng" <dongcheng.yan@intel.com>,
"Stefan Klug" <stefan.klug@ideasonboard.com>,
"Mirela Rabulea" <mirela.rabulea@nxp.com>,
"André Apitzsch" <git@apitzsch.eu>,
"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
"Mehdi Djait" <mehdi.djait@linux.intel.com>,
"Ricardo Ribalda Delgado" <ribalda@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Jacopo Mondi" <jacopo.mondi@ideasonboard.com>,
"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
"David Plowman" <david.plowman@raspberrypi.com>,
"Yu, Ong Hock" <ong.hock.yu@intel.com>,
"Ng, Khai Wen" <khai.wen.ng@intel.com>,
"Jai Luthra" <jai.luthra@ideasonboard.com>,
"Rishikesh Donadkar" <r-donadkar@ti.com>,
"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
"Antti Laakso" <antti.laakso@linux.intel.com>
Subject: Re: [PATCH 1/1] media: subdev: Make get_fmt on INTERNAL pads without STREAMS an error
Date: Wed, 7 Oct 2026 11:43:35 +0200 [thread overview]
Message-ID: <ae109b76-67f8-456d-a233-796f50cadcb1@kernel.org> (raw)
In-Reply-To: <20261006092950.690101-1-sakari.ailus@linux.intel.com>
On 06/10/2026 11:29, Sakari Ailus wrote:
> Internal pads should only be accessible to file handles with
> V4L2_SUBDEV_CLIENT_CAP_STREAMS flag set. Return an error otherwise.
>
> Fixes: 49cdf56876d3 ("media: mc: Add INTERNAL pad flag")
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/v4l2-core/v4l2-subdev.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index a07d77e584c3..7cb5a40f0f8c 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -854,8 +854,13 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
> case VIDIOC_SUBDEV_G_FMT: {
> struct v4l2_subdev_format *format = arg;
>
> - if (!client_supports_streams)
> + if (!client_supports_streams) {
> + if (format->pad < sd->entity.num_pads &&
> + sd->entity.pads[format->pad].flags & MEDIA_PAD_FL_INTERNAL)
> + return -EINVAL;
> +
> format->stream = 0;
> + }
>
> memset(format->reserved, 0, sizeof(format->reserved));
> memset(format->format.reserved, 0, sizeof(format->format.reserved));
>
There is no documentation that I can find that says that MEDIA_PAD_FL_INTERNAL is only available
if V4L2_SUBDEV_CLIENT_CAP_STREAMS is set.
I think this needs some more thought: if internal pads are only available if that cap is set,
then I expect that a lot more ioctls will need this check. In that case the check should become
a helper function.
But how does this affect e.g. G_TOPOLOGY or ENUM_LINKS? If the cap is not set, should internal
pads still be reported?
And you need checks in v4l2-compliance, ensuring that trying to access internal pads without
that cap will indeed fail.
Ideally you would like to have this emulated in vimc as well.
In other words, I think this needs more work, both in the core and w.r.t. documentation.
Regards,
Hans
next prev parent reply other threads:[~2026-10-07 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 9:29 [PATCH 1/1] media: subdev: Make get_fmt on INTERNAL pads without STREAMS an error Sakari Ailus
2026-10-07 9:43 ` Hans Verkuil [this message]
2026-10-07 9:48 ` Sakari Ailus
2026-10-07 10:14 ` Hans Verkuil
2026-10-08 12:26 ` Sakari Ailus
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=ae109b76-67f8-456d-a233-796f50cadcb1@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=antti.laakso@linux.intel.com \
--cc=benjamin.mugnier@foss.st.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dave.stevenson@raspberrypi.com \
--cc=david.plowman@raspberrypi.com \
--cc=dongcheng.yan@intel.com \
--cc=git@apitzsch.eu \
--cc=hansg@kernel.org \
--cc=heimir.sverrisson@gmail.com \
--cc=hpa@redhat.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=jai.luthra@ideasonboard.com \
--cc=julien.massot@collabora.com \
--cc=khai.wen.ng@intel.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=mirela.rabulea@nxp.com \
--cc=mkorpershoek@kernel.org \
--cc=naush@raspberrypi.com \
--cc=ong.hock.yu@intel.com \
--cc=prabhakar.csengg@gmail.com \
--cc=r-donadkar@ti.com \
--cc=ribalda@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stefan.klug@ideasonboard.com \
--cc=sylvain.petinot@foss.st.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tomm.merciai@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox