diff mbox series

[1/2] fbdev/imsttfb: fix double free in probe()

Message ID 014c0272-0d53-4625-8517-e8b4aa68f4dd@moroto.mountain
State New
Headers show
Series [1/2] fbdev/imsttfb: fix double free in probe() | expand

Commit Message

Dan Carpenter Oct. 27, 2023, 12:04 p.m. UTC
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>
---
 drivers/video/fbdev/imsttfb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Helge Deller Nov. 5, 2023, 6:22 p.m. UTC | #1
On 10/27/23 14:04, Dan Carpenter wrote:
> 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>

Both patches applied.

Thanks!
Helge
diff mbox series

Patch

diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
index e7e03e920729..acb943f85700 100644
--- a/drivers/video/fbdev/imsttfb.c
+++ b/drivers/video/fbdev/imsttfb.c
@@ -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;
 	}