[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1246b424-eaf7-8d32-c151-7e101a127753@gmail.com>
Date: Fri, 13 Nov 2020 17:59:29 +0100
From: Andrzej Pietrasiewicz <andrzejtp2010@...il.com>
To: Baskov Evgeiny <baskov@...ras.ru>
Cc: Jacek Anaszewski <jacek.anaszewski@...il.com>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: Re: [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@...il.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@...ras.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);
>
Powered by blists - more mailing lists