Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mc: Fix graph walk in media_pipeline_start

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.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # for 6.1 and later
Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Tomi Valkeinen and committed by
Hans Verkuil
8a9d4201 34793224

+6
+6
drivers/media/mc/mc-entity.c
··· 619 619 link = list_entry(entry->links, typeof(*link), list); 620 620 last_link = media_pipeline_walk_pop(walk); 621 621 622 + if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) { 623 + dev_dbg(walk->mdev->dev, 624 + "media pipeline: skipping link (not data-link)\n"); 625 + return 0; 626 + } 627 + 622 628 dev_dbg(walk->mdev->dev, 623 629 "media pipeline: exploring link '%s':%u -> '%s':%u\n", 624 630 link->source->entity->name, link->source->index,