Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH 1/2] fbdev/imsttfb: fix double free in probe()
@ 2023-10-27 12:04 Dan Carpenter
  2023-10-27 12:05 ` [PATCH 2/2] fbdev/imsttfb: fix a resource leak in probe Dan Carpenter
  2023-11-05 18:22 ` [PATCH 1/2] fbdev/imsttfb: fix double free in probe() Helge Deller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-10-27 12:04 UTC (permalink / raw)
  To: Helge Deller
  Cc: Thomas Zimmermann, Javier Martinez Canillas, Sam Ravnborg,
	Zheng Wang, linux-fbdev, dri-devel, kernel-janitors

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(-)

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;
 	}
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-05 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27 12:04 [PATCH 1/2] fbdev/imsttfb: fix double free in probe() Dan Carpenter
2023-10-27 12:05 ` [PATCH 2/2] fbdev/imsttfb: fix a resource leak in probe Dan Carpenter
2023-11-05 18:22 ` [PATCH 1/2] fbdev/imsttfb: fix double free in probe() Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox