Linux Media Controller development
 help / color / mirror / Atom feed
From: Anthony McGivern <anthony.mcgivern@arm.com>
To: Linus Walleij <linusw@kernel.org>
Cc: linux-media@vger.kernel.org,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Nayden Kanchev <nayden.kanchev@arm.com>,
	Konstantin Babin <konstantin.babin@arm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	laurent.pinchart@ideasonboard.com,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH] media: mc: Reject disconnected pads on an active pipeline
Date: Thu, 3 Dec 2026 12:23:16 +0000	[thread overview]
Message-ID: <2b553d9f-eef5-45d5-97db-7fc2ee6debaa@arm.com> (raw)
In-Reply-To: <CAD++jLn_GiBe0d49tGFQvV=_EWvKm5nJ+SFcEdG4zAYfnzbA+Q@mail.gmail.com>


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
> <anthony.mcgivern@arm.com> wrote:
> 
>> From: Anthony McGivern <Anthony.McGivern@arm.com>
>>
>> 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 <Anthony.McGivern@arm.com>
> 
> 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

      reply	other threads:[~2026-12-03 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 16:37 [PATCH] media: mc: Reject disconnected pads on an active pipeline Anthony McGivern
2026-12-03  8:05 ` Linus Walleij
2026-12-03 12:23   ` Anthony McGivern [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=2b553d9f-eef5-45d5-97db-7fc2ee6debaa@arm.com \
    --to=anthony.mcgivern@arm.com \
    --cc=hverkuil@kernel.org \
    --cc=konstantin.babin@arm.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linusw@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vincenzo.frascino@arm.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