From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, David Heidelberg <david@ixit.cz>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Subject: Re: [PATCH v2 1/1] media: v4l2-subdev: Fail {enable,disable}_streams and s_streaming nicely
Date: Mon, 23 Mar 2026 13:10:42 +0200 [thread overview]
Message-ID: <20260323111042.GC1514659@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260323105655.743792-1-sakari.ailus@linux.intel.com>
On Mon, Mar 23, 2026 at 12:56:55PM +0200, Sakari Ailus wrote:
> If a sub-device does not set enable_streams() and disable_streams() pad
> ops while it sets the s_stream() video op to
> v4l2_subdev_s_stream_helper(), enabling or disabling streaming either way
> on the sub-device will result calling v4l2_subdev_s_stream_helper() and
> v4l2_subdev_{enable,disable}_streams() recursively, exhausting the stack.
> Return -ENOIOCTLCMD in this case to handle the situation gracefully.
This is not a valid use case, right ? Can we WARN() ?
> Reported-by: David Heidelberg <david@ixit.cz>
> Fixes: b62949ddaa52 ("media: subdev: Support single-stream case in v4l2_subdev_enable/disable_streams()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> since v1:
>
> - Better patch description.
>
> drivers/media/v4l2-core/v4l2-subdev.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 831c69c958b8..f8ea4afc6cbb 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -2334,11 +2334,13 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
>
> /* Fallback on .s_stream() if .enable_streams() isn't available. */
> use_s_stream = !v4l2_subdev_has_op(sd, pad, enable_streams);
> -
> - if (!use_s_stream)
> + if (!use_s_stream) {
> state = v4l2_subdev_lock_and_get_active_state(sd);
> - else
> + } else {
> + if (!v4l2_subdev_has_op(sd, video, s_stream))
> + return -ENOIOCTLCMD;
> state = NULL;
> + }
>
> /*
> * Verify that the requested streams exist and that they are not
> @@ -2435,11 +2437,13 @@ int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad,
>
> /* Fallback on .s_stream() if .disable_streams() isn't available. */
> use_s_stream = !v4l2_subdev_has_op(sd, pad, disable_streams);
> -
> - if (!use_s_stream)
> + if (!use_s_stream) {
> state = v4l2_subdev_lock_and_get_active_state(sd);
> - else
> + } else {
> + if (!v4l2_subdev_has_op(sd, video, s_stream))
> + return -ENOIOCTLCMD;
> state = NULL;
> + }
>
> /*
> * Verify that the requested streams exist and that they are not
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-03-23 11:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 10:56 [PATCH v2 1/1] media: v4l2-subdev: Fail {enable,disable}_streams and s_streaming nicely Sakari Ailus
2026-03-23 11:10 ` Laurent Pinchart [this message]
2026-03-23 11:44 ` Sakari Ailus
2026-03-25 14:07 ` Laurent Pinchart
2026-03-25 16:13 ` 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=20260323111042.GC1514659@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=david@ixit.cz \
--cc=hverkuil+cisco@kernel.org \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen+renesas@ideasonboard.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