Skip to contentSkip to conversation

media: mc: Fix graph walk in media_pipeline_start

git:media_stage/master Hans Verkuil 1 participant 1 message Apr 10, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: mc: Fix graph walk in media_pipeline_start
Author:  Tomi Valkeinen <[email protected]>
Date:    Mon Mar 18 11:50:59 2024 +0200

The graph walk tries to follow all links, even if they are not between pads. This causes a crash with, e.g. a MEDIA_LNK_FL_ANCILLARY_LINK link.

Fix this by allowing the walk to proceed only for MEDIA_LNK_FL_DATA_LINK links.

Cc [email protected] # for 6.1 and later
Fixes ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()")
 drivers/media/mc/mc-entity.c | 6 ++++++
 1 file changed, 6 insertions(+)

---

drivers/media/mc/mc-entity.c +6 -0
index 0e28b9a7936e..96dd0f6ccd0d 100644
@@ -619,6 +619,12 @@ static int media_pipeline_explore_next_link(struct media_pipeline *pipe,
 	link = list_entry(entry->links, typeof(*link), list);
 	last_link = media_pipeline_walk_pop(walk);
 
+	if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
+		dev_dbg(walk->mdev->dev,
+			"media pipeline: skipping link (not data-link)\n");
+		return 0;
+	}
+
 	dev_dbg(walk->mdev->dev,
 		"media pipeline: exploring link '%s':%u -> '%s':%u\n",
 		link->source->entity->name, link->source->index,