mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: free cmap on framebuffer release
@ 2026-09-22  3:53 Lucas Costa
  2026-09-22  5:41 ` Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lucas Costa @ 2026-09-22  3:53 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Lucas Costa

The driver never calls fb_dealloc_cmap() after it has been allocated,
so when the buffer is torn down we leak.

This happens on every unbind, and when an error is detected in
sm750fb_framebuffer_alloc().

fb_dealloc_cmap() gets called before framebuffer_release() in both places.

Fixes: 81dee67e215b ("staging: sm750fb: add sm750 to staging")

Signed-off-by: Lucas Costa <2000.costalucas@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8b93bfeb217b..92412534239c 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -910,6 +910,7 @@ static void sm750fb_framebuffer_release(struct sm750_dev *sm750_dev)
 	while (sm750_dev->fb_count) {
 		fb_info = sm750_dev->fbinfo[sm750_dev->fb_count - 1];
 		unregister_framebuffer(fb_info);
+		fb_dealloc_cmap(&fb_info->cmap);
 		framebuffer_release(fb_info);
 		sm750_dev->fb_count--;
 	}
@@ -943,6 +944,7 @@ static int sm750fb_framebuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
 	return 0;
 
 release_fb:
+	fb_dealloc_cmap(&fb_info->cmap);
 	framebuffer_release(fb_info);
 	return err;
 }
-- 
2.43.0


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

end of thread, other threads:[~2026-09-22 16:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22  3:53 [PATCH] staging: sm750fb: free cmap on framebuffer release Lucas Costa
2026-09-22  5:41 ` Greg Kroah-Hartman
2026-09-22 14:25   ` Lucas Costa
2026-09-22  7:22 ` Dan Carpenter
2026-09-22 14:28 ` [PATCH v2] " Lucas Costa
2026-09-22 16:06   ` Dan Carpenter

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

all inboxes | Powered by JetHome®