openwrt/target/linux/bcm27xx/patches-5.15/950-0767-media-entity-Skip-non-data-links-in-graph-iteration.patch

30 lines
1.0 KiB
Diff
Raw Normal View History

From 74a4bd2caa37f07786cdf3e86ad9f7cbc6977b31 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Wed, 2 Mar 2022 22:03:00 +0000
Subject: [PATCH] media: entity: Skip non-data links in graph iteration
When iterating over the media graph, don't follow links that are not
data links.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
drivers/media/mc/mc-entity.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -313,6 +313,12 @@ static void media_graph_walk_iter(struct
link = list_entry(link_top(graph), typeof(*link), list);
+ /* If the link is not a data link, don't follow it */
+ if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
+ link_top(graph) = link_top(graph)->next;
+ return;
+ }
+
/* The link is not enabled so we do not follow. */
if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
link_top(graph) = link_top(graph)->next;