media: vimc: fix start stream when link is disabled
authorHelen Fornazier <helen.koike@collabora.com>
Fri, 7 Dec 2018 17:56:41 +0000 (12:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:52:34 +0000 (08:52 +0100)
[ Upstream commit e159b6074c82fe31b79aad672e02fa204dbbc6d8 ]

If link is disabled, media_entity_remote_pad returns NULL, causing a
NULL pointer deference.
Ignore links that are not enabled instead.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/vimc/vimc-common.c

index 204aa6f..fa8435a 100644 (file)
@@ -241,6 +241,8 @@ int vimc_pipeline_s_stream(struct media_entity *ent, int enable)
 
                /* Start the stream in the subdevice direct connected */
                pad = media_entity_remote_pad(&ent->pads[i]);
+               if (!pad)
+                       continue;
 
                if (!is_media_entity_v4l2_subdev(pad->entity))
                        return -EINVAL;