From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796300601; b=VfJOTx0H4qOGehhe76ny7AvTVhW7g1ZfCAsA+eUQGVgHg9hRPDJ08paEkwdsTuXT1avj 0+4pvNDzFFxR4qvoGLDNZXJreDEbDuwKBcTfMKpo/1UkCTW757IurQJmT/7MIquxGR/WL rdhecVwhcaVyMWRUVy+2HEgQxWz5wE61nmCqG1Hb91NQwiIS+N+dr0rG5XAkru8z2tLYz 5KVfK1x/wMt1fw11jZ9+qlhWc4oVYZ7MA9VvPRmjo+qvY41g54vMu8yYFCV4BK6MS+h2o a4CgL8ES3t4xEeEawc8q0fp/KG2pX/wEBu529LIuQweE9hx6WDXnxJmmKxspdbMVD5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300601; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=6VoZXXllyxO9TaNI0VT67Uso9WjzlwdE/w4ye2y3MhU=; b=s94R+o0o8zxAohp07LmlTQWaClkqvt3px68ukA6ajnjfmfq3jujlp9mKmmdO0WSlckll 7m+HSQaqpf+rEZ+XAIvz4gbu+EbYyDLJpwfgpniqYN3jfw7/JHaK1gA7dNGygm2Vt9yoE g+HQRm1UhZTmOb1TEeU0a+hOxvi8rWWJnEs5A3rf/bu6eQto22Y7/dX+D4gKrBN9Akt24 LvYuc9iUhWBGRQKWNoO66a43m1qcuhkEKUyVybeoV6dhMbREOKkMBUKP148ty3mHaNQDf 6h5c5rUrrtJcmqiMxOUTyIGyOL+msveeFfA6wHAl9wOMjRrt6bqzJZJptxiMhpes2jw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Au3TttIv; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEB87606A32D for ; Thu, 3 Dec 2026 12:23:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BEB87606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Au3TttIv Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A5DE14BF; Thu, 3 Dec 2026 04:23:17 -0800 (PST) Received: from [10.33.48.23] (GM14V85S.arm.com [10.33.48.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 43CC03F86F; Thu, 3 Dec 2026 04:23:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796300600; bh=xZLHWkQQSCtTQRzQTrrnIUfzOxJuDXSJrcdd+qC8E/8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Au3TttIvaE74eQxbbLuflcGwvvXtwX54uw+188FvJyMPM3wtJj3PyCaUBJuuAIhCY o9Ww99lTOvkehhk2KGPvodm5tfbK0pbF7TVhXecv+jKfXYcQFdabOfbChL+TmstYua 9lsROfTsHWCo5pVJ47lof07BK5Pb4pvksO3jwbUM= Message-ID: <2b553d9f-eef5-45d5-97db-7fc2ee6debaa@arm.com> Date: Thu, 3 Dec 2026 12:23:16 +0000 X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: mc: Reject disconnected pads on an active pipeline To: Linus Walleij Cc: linux-media@vger.kernel.org, Vincenzo Frascino , Nayden Kanchev , Konstantin Babin , Mauro Carvalho Chehab , Hans Verkuil , laurent.pinchart@ideasonboard.com, Sakari Ailus References: <20261124-mali-c720-media-controller-fix-v1-1-961de9306170@arm.com> Content-Language: en-GB From: Anthony McGivern In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Linus, On 03/12/2026 08:05, Linus Walleij wrote: > Hi Anthony, > > thanks for your patch! > > On Tue, Nov 24, 2026 at 5:38 PM Anthony McGivern > wrote: > >> From: Anthony McGivern >> >> When starting an already active media pipeline, graph validation is skipped >> and its start count is incremented. This allows a disconnected origin pad >> to return success even though it does not belong to a pipeline. >> >> Reject a disconnected origin pad with -EINVAL before incrementing the >> start count. >> >> Signed-off-by: Anthony McGivern > > Maybe also mention that this will surely give a WARN_ON() splat > from __media_pipeline_stop() unless this patch is applied? > I suppose this is how you found it? Good point, yeah this indicated the issue to me initially as you have described. I also noticed this as the start_count would also be mistakenly incremented so any driver checks that depend on this could inadvertently pass. In any case, I will update the description in V2 to state this consequential WARN_ON(). Another thought would be how this differs to media_pipeline_alloc_start where instead a new pipe would be allocated and run through its own validation, thus failing for an unconnected pad if MUST_CONNECT is set. Maybe for that reason it is preferred to use the alloc_start variant? > > (...) >> /* >> - * If the pipeline has already been started, it is guaranteed to be >> - * valid, so just increase the start count. >> + * If the pipeline has already been started, ensure the pad is a part of the pipeline. >> + * If so, it is guaranteed to be valid, so just increase the start count. >> */ >> if (pipe->start_count) { >> + if (!origin->pipe) >> + return -EINVAL; > > Should this be -ENOLINK? > > I see this is used under similar circumstances (disconnected > node/pad) in the media framework. > > Some media maintainer maybe can confirm. Yeah that does sound more reasonable, but I agree it would be good to clarify this. If so I can make the change in V2. > > Yours, > Linus Walleij Thanks, Anthony