media: staging/imx: Fix NULL deref in find_pipeline_entity()
Steve Longerbeam
maintainerPATCH 1/1 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.
--- drivers/staging/media/imx/imx-media-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-utils.c +1 -1
@@ -842,7 +842,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; }
Signature · 1 line
2.17.1
Quoted 18 lines · Steve Longerbeam
Fix a cut&paste error in
find_pipeline_entity(). The start entity must be passed tomedia_entity_to_video_device()infind_pipeline_entity(), notpad->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 <[email protected]>Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/imx-media-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/imx/imx-media-utils.c +0
-0
drivers/staging/media/imx/imx-media-utils.c find_pipeline_entity(struct media_entity *start, u32 grp_id, · line 848
Quoted 8 lines
drivers/staging/media/imx/imx-media-utils.c +1
-1@@ -842,7 +842,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; }
regards
Philipp
Quoted 18 lines · Steve Longerbeam
Fix a cut&paste error in
find_pipeline_entity(). The start entity must be passed tomedia_entity_to_video_device()infind_pipeline_entity(), notpad->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 <[email protected]>Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/imx-media-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/imx/imx-media-utils.c +0
-0
drivers/staging/media/imx/imx-media-utils.c find_pipeline_entity(struct media_entity *start, u32 grp_id, · line 845
Quoted 5 lines
drivers/staging/media/imx/imx-media-utils.c +1
-1@@ -842,7 +842,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);
Can we also remove the "pad = NULL" assignment at the start of the function? Otherwise static checkers and new versions of GCC will warn that the assignment isn't used. Plus removing the initialization will prevent bugs like this in the future.
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel