Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc()
@ 2025-06-26 17:24 Abdun Nihaal
  2025-06-26 17:50 ` Andy Shevchenko
  2025-06-26 18:02 ` Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Abdun Nihaal @ 2025-06-26 17:24 UTC (permalink / raw)
  To: andy
  Cc: Abdun Nihaal, gregkh, lorenzo.stoakes, tzimmermann, riyandhiman14,
	willy, notro, thomas.petazzoni, dri-devel, linux-fbdev,
	linux-staging, linux-kernel

In the error paths after fb_info structure is successfully allocated,
the memory allocated in fb_deferred_io_init() for info->pagerefs is not
freed. Fix that by adding the cleanup function on the error path.

Fixes: c296d5f9957c ("staging: fbtft: core support")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
---
This patch is compile tested only. Not tested on real hardware.
Bug was found using our prototype static analysis tool.

 drivers/staging/fbtft/fbtft-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index da9c64152a60..39bced400065 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -692,6 +692,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 	return info;
 
 release_framebuf:
+	fb_deferred_io_cleanup(info);
 	framebuffer_release(info);
 
 alloc_fail:
-- 
2.43.0


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

end of thread, other threads:[~2025-06-27 16:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-26 17:24 [PATCH] staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc() Abdun Nihaal
2025-06-26 17:50 ` Andy Shevchenko
2025-06-26 20:11   ` Dan Carpenter
2025-06-26 21:59     ` Andy Shevchenko
2025-06-27 11:07       ` Andy Shevchenko
2025-06-27 16:26         ` Abdun Nihaal
2025-06-26 18:02 ` Dan Carpenter

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