* [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
@ 2020-11-13 16:06 Baskov Evgeiny
2020-11-13 16:59 ` Andrzej Pietrasiewicz
2020-11-13 21:35 ` Jacek Anaszewski
0 siblings, 2 replies; 4+ messages in thread
From: Baskov Evgeiny @ 2020-11-13 16:06 UTC (permalink / raw)
To: Andrzej Pietrasiewicz
Cc: Baskov Evgeiny, Jacek Anaszewski, Sylwester Nawrocki,
Mauro Carvalho Chehab, linux-arm-kernel, linux-media,
linux-kernel, ldv-project
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 Evgeiny <baskov@ispras.ru>
---
drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 ++
1 file changed, 2 insertions(+)
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);
--
2.29.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
2020-11-13 16:06 [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe Baskov Evgeiny
@ 2020-11-13 16:59 ` Andrzej Pietrasiewicz
2020-11-13 21:35 ` Jacek Anaszewski
1 sibling, 0 replies; 4+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-11-13 16:59 UTC (permalink / raw)
To: Baskov Evgeiny
Cc: Jacek Anaszewski, Sylwester Nawrocki, Mauro Carvalho Chehab,
linux-arm-kernel, linux-media, linux-kernel, ldv-project
Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
W dniu 13.11.2020 o 17:06, Baskov Evgeiny pisze:
> 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 Evgeiny <baskov@ispras.ru>
> ---
> drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
2020-11-13 16:06 [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe Baskov Evgeiny
2020-11-13 16:59 ` Andrzej Pietrasiewicz
@ 2020-11-13 21:35 ` Jacek Anaszewski
2020-11-14 7:30 ` baskov
1 sibling, 1 reply; 4+ messages in thread
From: Jacek Anaszewski @ 2020-11-13 21:35 UTC (permalink / raw)
To: Baskov Evgeiny, Andrzej Pietrasiewicz
Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, linux-arm-kernel,
linux-media, linux-kernel, ldv-project
Hi Evgeiny,
Thank you for the patch.
There is a typo in the subject: s/hangle/handle/
Otherwise:
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
On 11/13/20 5:06 PM, Baskov Evgeiny wrote:
> 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.
--
Best regards,
Jacek Anaszewski
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
2020-11-13 21:35 ` Jacek Anaszewski
@ 2020-11-14 7:30 ` baskov
0 siblings, 0 replies; 4+ messages in thread
From: baskov @ 2020-11-14 7:30 UTC (permalink / raw)
To: Jacek Anaszewski
Cc: Andrzej Pietrasiewicz, Sylwester Nawrocki, Mauro Carvalho Chehab,
linux-arm-kernel, linux-media, linux-kernel, ldv-project
On 2020-11-14 00:35, Jacek Anaszewski wrote:
> There is a typo in the subject: s/hangle/handle/
Thanks for pointing out, sorry for that.
Apparently, there is also a typo in my name -> s/Evgeiny/Evgeniy/
--
Respectfully,
Baskov Evgeniy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-14 7:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 16:06 [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe Baskov Evgeiny
2020-11-13 16:59 ` Andrzej Pietrasiewicz
2020-11-13 21:35 ` Jacek Anaszewski
2020-11-14 7:30 ` baskov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome