media: staging/imx: Fix NULL deref in find_pipeline_entity()
authorSteve Longerbeam <slongerbeam@gmail.com>
Wed, 26 Jun 2019 18:52:25 +0000 (14:52 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 23 Jul 2019 15:42:39 +0000 (11:42 -0400)
Fix a cut&paste error in find_pipeline_entity(). The start entity must be
passed to media_entity_to_video_device() in find_pipeline_entity(), not
pad->entity. The pad is only put to use later, after determining the start
entity is not the entity being searched for.

Fixes: 3ef46bc97ca2 ("media: staging/imx: Improve pipeline searching")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/imx/imx-media-utils.c

index 9088c4b..4cc6a74 100644 (file)
@@ -841,7 +841,7 @@ find_pipeline_entity(struct media_entity *start, u32 grp_id,
                if (sd->grp_id & grp_id)
                        return &sd->entity;
        } else if (buftype && is_media_entity_v4l2_video_device(start)) {
-               vfd = media_entity_to_video_device(pad->entity);
+               vfd = media_entity_to_video_device(start);
                if (buftype == vfd->queue->type)
                        return &vfd->entity;
        }