* [PATCH for v5.6] v4l2-mem2mem.c: fix broken links
@ 2020-02-04 18:13 Hans Verkuil
2020-02-04 19:39 ` Nicolas Dufresne
0 siblings, 1 reply; 2+ messages in thread
From: Hans Verkuil @ 2020-02-04 18:13 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: Nicolas Dufresne
The topology that v4l2_m2m_register_media_controller() creates for a
processing block actually created a source-to-source link and a sink-to-sink
link instead of two source-to-sink links.
Unfortunately v4l2-compliance never checked for such bad links, so this
went unreported for quite some time.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Nicolas Dufresne <nicolas@ndufresne.ca>
Cc: <stable@vger.kernel.org> # for v4.19 and up
---
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
index 1afd9c6ad908..cc34c5ab7009 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -880,12 +880,12 @@ int v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
goto err_rel_entity1;
/* Connect the three entities */
- ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 1,
+ ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 0,
MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
if (ret)
goto err_rel_entity2;
- ret = media_create_pad_link(&m2m_dev->proc, 0, &m2m_dev->sink, 0,
+ ret = media_create_pad_link(&m2m_dev->proc, 1, &m2m_dev->sink, 0,
MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
if (ret)
goto err_rm_links0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for v5.6] v4l2-mem2mem.c: fix broken links
2020-02-04 18:13 [PATCH for v5.6] v4l2-mem2mem.c: fix broken links Hans Verkuil
@ 2020-02-04 19:39 ` Nicolas Dufresne
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dufresne @ 2020-02-04 19:39 UTC (permalink / raw)
To: Hans Verkuil, Linux Media Mailing List
Le mardi 04 février 2020 à 19:13 +0100, Hans Verkuil a écrit :
> The topology that v4l2_m2m_register_media_controller() creates for a
> processing block actually created a source-to-source link and a sink-to-sink
> link instead of two source-to-sink links.
>
> Unfortunately v4l2-compliance never checked for such bad links, so this
> went unreported for quite some time.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Reported-by: Nicolas Dufresne <nicolas@ndufresne.ca>
> Cc: <stable@vger.kernel.org> # for v4.19 and up
> ---
> diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-
> core/v4l2-mem2mem.c
> index 1afd9c6ad908..cc34c5ab7009 100644
> --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
> +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
> @@ -880,12 +880,12 @@ int v4l2_m2m_register_media_controller(struct
> v4l2_m2m_dev *m2m_dev,
> goto err_rel_entity1;
>
> /* Connect the three entities */
> - ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 1,
> + ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 0,
I think local defines to give a name to these 0 and 1 indexes would be more
readable. Note, I could not test your patch as Hantro does not use this code
path. But I'm not worried, this is covered by virtual drivers and tests.
> MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
> if (ret)
> goto err_rel_entity2;
>
> - ret = media_create_pad_link(&m2m_dev->proc, 0, &m2m_dev->sink, 0,
> + ret = media_create_pad_link(&m2m_dev->proc, 1, &m2m_dev->sink, 0,
> MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
> if (ret)
> goto err_rm_links0;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-04 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 18:13 [PATCH for v5.6] v4l2-mem2mem.c: fix broken links Hans Verkuil
2020-02-04 19:39 ` Nicolas Dufresne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).