]> git.itanic.dy.fi Git - linux-stable/commitdiff
fbdev: imsttfb: fix double free in probe()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 27 Oct 2023 12:04:56 +0000 (15:04 +0300)
committerHelge Deller <deller@gmx.de>
Tue, 7 Nov 2023 13:42:34 +0000 (14:42 +0100)
The init_imstt() function calls framebuffer_release() on error and then
the probe() function calls it again.  It should only be done in probe.

Fixes: 518ecb6a209f ("fbdev: imsttfb: Fix error path of imsttfb_probe()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/imsttfb.c

index e7e03e920729dce8c8878de75b1d3743c606085e..acb943f857000e3305812b1e9935bee039eed945 100644 (file)
@@ -1421,7 +1421,6 @@ static int init_imstt(struct fb_info *info)
        if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len
            || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) {
                printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel);
-               framebuffer_release(info);
                return -ENODEV;
        }
 
@@ -1453,14 +1452,11 @@ static int init_imstt(struct fb_info *info)
                      FBINFO_HWACCEL_FILLRECT |
                      FBINFO_HWACCEL_YPAN;
 
-       if (fb_alloc_cmap(&info->cmap, 0, 0)) {
-               framebuffer_release(info);
+       if (fb_alloc_cmap(&info->cmap, 0, 0))
                return -ENODEV;
-       }
 
        if (register_framebuffer(info) < 0) {
                fb_dealloc_cmap(&info->cmap);
-               framebuffer_release(info);
                return -ENODEV;
        }