From: Steve Longerbeam Date: Wed, 26 Jun 2019 18:52:25 +0000 (-0400) Subject: media: staging/imx: Fix NULL deref in find_pipeline_entity() X-Git-Tag: v5.4-rc1~145^2~261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02c25c003405776084d440c30041a33836b74710;p=platform%2Fkernel%2Flinux-rpi.git media: staging/imx: Fix NULL deref in find_pipeline_entity() 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 Signed-off-by: Steve Longerbeam Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 9088c4b..4cc6a74 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -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; }