From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47CD93C456D for ; Mon, 4 May 2026 13:22:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777900939; cv=none; b=GDo2wCruO3UxVLNSs7RgNTIGM/EsKj/yegFSKgXuWWaGY/kMNbU3jwmW6ymirHKixkGEnmShf8Eb9iUMLUZo1iCJEdwaLbW62CtOEYgMzF7QGoSPxV2qDiyQuONRt/G90bFmSgfnzZ6wKdV6LNkSEDufCTcbfLCjQT+tjBY6kLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777900939; c=relaxed/simple; bh=W3CN97qP6afD4yAvPDQST1Pd9/ZzjfuD1DjcKlTqkzg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=khPEsIhKtHH+VCNzXm76d2JSZAcVwj6hrBKCq+wCAP9R+0u6DB6Hts0CeOIaRfVmC2ZSN8hOF+wO0I7fH5FLyjcI4DSBvUkx+foVex9EGEFi2R7EbD3dhsQ9/K8oyBRbiX75jr2BCzWfqSG8dHpRIKqL0i9OdHcQWfQGEk+GeSA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=u+gbxfDK; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="u+gbxfDK" Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9BE399C; Mon, 4 May 2026 15:22:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1777900934; bh=W3CN97qP6afD4yAvPDQST1Pd9/ZzjfuD1DjcKlTqkzg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u+gbxfDKkGiuuV+daWhi8gI1qOtijL4wzs0GPGpCb+uQNvvkgJSDHp9Sq7vVudwL6 f6tiy5OoHVRXO/7q3goROJRY+3KaIn+akk34GFMAYfilvYSRc8Kb63lwtNdOX4sDKo jL79G/MFo5uBLiC7ZUR0JvohkO7nxa3UnaZ7ZDXY= Date: Mon, 4 May 2026 16:22:14 +0300 From: Laurent Pinchart To: Sakari Ailus Cc: linux-media@vger.kernel.org, David Heidelberg , Hans Verkuil , Tomi Valkeinen , Jacopo Mondi Subject: Re: [PATCH 1/1] media: v4l2-subdev: Fail {enable,disable}_streams and s_streaming nicely Message-ID: <20260504132214.GA1371451@killaraus.ideasonboard.com> References: <20260504123503.417044-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260504123503.417044-1-sakari.ailus@linux.intel.com> On Mon, May 04, 2026 at 03:35:03PM +0300, 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. > > Reported-by: David Heidelberg > Fixes: b62949ddaa52 ("media: subdev: Support single-stream case in v4l2_subdev_enable/disable_streams()") > Cc: stable@vger.kernel.org > Signed-off-by: Sakari Ailus > --- > since v2: > > - Move the check, with checking the pad ops, to > v4l2_subdev_s_stream_helper(). > > drivers/media/v4l2-core/v4l2-subdev.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c > index 831c69c958b8..3b726f044d3f 100644 > --- a/drivers/media/v4l2-core/v4l2-subdev.c > +++ b/drivers/media/v4l2-core/v4l2-subdev.c > @@ -2504,6 +2504,10 @@ int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable) > u64 source_mask = 0; > int pad_index = -1; > > + if (WARN_ON_ONCE(!v4l2_subdev_has_op(sd, pad, enable_streams) || > + !v4l2_subdev_has_op(sd, pad, disable_streams))) Is this indicates a clear bug, I would use WARN_ON() instead of WARN_ON_ONCE(). Up to you. Reviewed-by: Laurent Pinchart > + return -ENOIOCTLCMD; > + > /* > * Find the source pad. This helper is meant for subdevs that have a > * single source pad, so failures shouldn't happen, but catch them -- Regards, Laurent Pinchart