diff options
author | Baskov Evgeniy <baskov@ispras.ru> | 2020-11-13 17:06:25 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-12-03 07:45:49 +0100 |
commit | 0862d95b437b7687622bfc274e410549853825c3 (patch) | |
tree | 821f57a159a9947affabe1a16af96b8c3fee8c87 /drivers | |
parent | media: cedrus: Add support for VP8 decoding (diff) | |
download | linux-0862d95b437b7687622bfc274e410549853825c3.tar.xz linux-0862d95b437b7687622bfc274e410549853825c3.zip |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 9b22dd8e34f4..026111505f5a 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2862,6 +2862,8 @@ static int s5p_jpeg_probe(struct platform_device *pdev) return -ENOMEM; jpeg->variant = jpeg_get_drv_data(&pdev->dev); + if (!jpeg->variant) + return -ENODEV; mutex_init(&jpeg->lock); spin_lock_init(&jpeg->slock); |