s5p-jpeg: hangle error condition in s5p_jpeg_probe
PATCH 1/1 s5p-jpeg: hangle 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).
--- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/s5p-jpeg/jpeg-core.c +2 -0
@@ -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);
Signature · 7 lines
2.29.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
W dniu 13.11.2020 o 17:06, Baskov Evgeiny pisze:
Quoted 26 lines
If an error happens in
jpeg_get_drv_data(), i.e. match fails,jpeg->variantfield is NULL, so we cannot access it.Consider device probe failed if
jpeg->variantis NULL.Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by Baskov Evgeiny <[email protected]>--- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 ++ 1 file changed, 2 insertions(+)drivers/media/platform/s5p-jpeg/jpeg-core.c +2
-0@@ -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);
Hi Evgeiny,
Thank you for the patch.
There is a typo in the subject: s/hangle/handle/
Otherwise:
Quoted 4 lines · Baskov Evgeiny
If an error happens in
jpeg_get_drv_data(), i.e. match fails,jpeg->variantfield is NULL, so we cannot access it.Consider device probe failed if
jpeg->variantis NULL.
Signature · 2 lines
Best regards, Jacek Anaszewski
Quoted 1 line · Jacek Anaszewski
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