Skip to content

Commit 0862d95

Browse files
summaryInfomchehab
authored andcommitted
media: s5p-jpeg: handle error condition in s5p_jpeg_probe
If an error happens in jpeg_get_drv_data(), i.e. match fails, jpeg->variant field is NULL, so we cannot access it. Consider device probe failed if jpeg->variant is NULL. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Baskov Evgeniy <baskov@ispras.ru> Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 3c39a16 commit 0862d95

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/media/platform/s5p-jpeg/jpeg-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,8 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
28622862
return -ENOMEM;
28632863

28642864
jpeg->variant = jpeg_get_drv_data(&pdev->dev);
2865+
if (!jpeg->variant)
2866+
return -ENODEV;
28652867

28662868
mutex_init(&jpeg->lock);
28672869
spin_lock_init(&jpeg->slock);

0 commit comments

Comments
 (0)