sm501fb: don't return zero on failure path in sm501fb_start()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Tue, 2 May 2017 11:47:53 +0000 (13:47 +0200)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Tue, 2 May 2017 11:47:53 +0000 (13:47 +0200)
If fbmem iomemory mapping failed, sm501fb_start() breaks off
initialization, deallocates resources, but returns zero.
As a result, double deallocation can happen in sm501fb_stop().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/sm501fb.c

index d80bc8a3200fa9c8435bc0b606a4bae0f02728f1..67e314fdd9471513b911d07d33c0ff3c13e25a05 100644 (file)
@@ -1600,6 +1600,7 @@ static int sm501fb_start(struct sm501fb_info *info,
        info->fbmem = ioremap(res->start, resource_size(res));
        if (info->fbmem == NULL) {
                dev_err(dev, "cannot remap framebuffer\n");
+               ret = -ENXIO;
                goto err_mem_res;
        }