* [PATCH] fbdev: clps711x-fb: unregister fb when clps711x_fb_probe register failed
@ 2024-10-03 16:12 clingfei
2024-10-03 16:18 ` Russell King (Oracle)
0 siblings, 1 reply; 2+ messages in thread
From: clingfei @ 2024-10-03 16:12 UTC (permalink / raw)
To: deller
Cc: shc_work, linux-fbdev, dri-devel, linux-arm-kernel, linux-kernel,
clf700383
When register_framebuffer failed, it jumps out_fb_dealloc_cmap without
calling unregister_framebuffer, which may cause potential memory leak.
Signed-off-by: clingfei <clf700383@gmail.com>
---
drivers/video/fbdev/clps711x-fb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
index 9e3df1df5ac4..69db40a7a361 100644
--- a/drivers/video/fbdev/clps711x-fb.c
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -328,10 +328,11 @@ static int clps711x_fb_probe(struct platform_device *pdev)
ret = register_framebuffer(info);
if (ret)
- goto out_fb_dealloc_cmap;
+ goto out_fb_unregister;
return 0;
+out_fb_unregister:
unregister_framebuffer(info);
out_fb_dealloc_cmap:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fbdev: clps711x-fb: unregister fb when clps711x_fb_probe register failed
2024-10-03 16:12 [PATCH] fbdev: clps711x-fb: unregister fb when clps711x_fb_probe register failed clingfei
@ 2024-10-03 16:18 ` Russell King (Oracle)
0 siblings, 0 replies; 2+ messages in thread
From: Russell King (Oracle) @ 2024-10-03 16:18 UTC (permalink / raw)
To: clingfei
Cc: deller, shc_work, linux-fbdev, dri-devel, linux-arm-kernel,
linux-kernel
On Fri, Oct 04, 2024 at 12:12:36AM +0800, clingfei wrote:
> When register_framebuffer failed, it jumps out_fb_dealloc_cmap without
> calling unregister_framebuffer, which may cause potential memory leak.
This looks completely wrong. If register_framebuffer() fails, then the
work that register_framebuffer() does internally should be cleaned up
and unregister_framebuffer() should not be necessary.
The code looks correct as-is to me, so there's no need to patch it.
If there is a memory leak, that'll be in register_framebuffer() itself.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-03 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 16:12 [PATCH] fbdev: clps711x-fb: unregister fb when clps711x_fb_probe register failed clingfei
2024-10-03 16:18 ` Russell King (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).