[PATCH 4.8 125/138] video: fbdev: pxafb: potential NULL dereference on error

From: Greg Kroah-Hartman
Date: Wed Nov 09 2016 - 06:17:21 EST


4.8-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

commit e0299908d606a99e7ffb467bc3c11dfe54133af3 upstream.

If we "goto out;" then it calls display_timings_release(timings);
Since "timings" is NULL, that's going to oops. Just return directly.

Fixes: 420a488278e8 ('video: fbdev: pxafb: initial devicetree conversion')
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Acked-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/video/fbdev/pxafb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2125,7 +2125,7 @@ static int of_get_pxafb_display(struct d

timings = of_get_display_timings(disp);
if (!timings)
- goto out;
+ return -EINVAL;

ret = -ENOMEM;
info->modes = kmalloc_array(timings->num_timings,