* [PATCH 00/14] fbdev: fix various memory leaks
@ 2026-05-14 8:24 Abdun Nihaal
2026-05-14 8:24 ` [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe() Abdun Nihaal
` (13 more replies)
0 siblings, 14 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
This patchset fixes some memory leak issues present in fbdev drivers.
Since commit 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
fb_deferred_io_init() allocated memory for pagerefs and returned an
error code, but the existing drivers which call fb_deferred_io_init()
were not updated to do cleanup. The first three commits address this.
- fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
- fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
- fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
Probe functions that call fb_add_videomode() or fb_videomode_to_modelist()
sometimes did not call fb_destry_modelist() to free the allocated
memory. The following patches address this issue.
- fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
- fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
- fbdev: i740fb: fix potential memory leak in i740fb_probe()
- fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
- fbdev: s3fb: fix potential memory leak in s3_pci_probe()
- fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
- fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
- fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
the fb_get_options() function transfers ownership of the memory
allocated for options, and so the caller is expected to free it. The
following two patches address this issue.
- fbdev: efifb: fix memory leak in efifb_probe()
- fbdev: vesafb: fix memory leak in vesafb_probe()
The following commit fixes a simple memory leak.
- fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
All the patches were only compile tested.
The issues were found using static analysis.
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Abdun Nihaal (14):
fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
fbdev: i740fb: fix potential memory leak in i740fb_probe()
fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
fbdev: s3fb: fix potential memory leak in s3_pci_probe()
fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
fbdev: efifb: fix memory leak in efifb_probe()
fbdev: vesafb: fix memory leak in vesafb_probe()
fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
drivers/video/fbdev/aty/radeon_base.c | 1 +
drivers/video/fbdev/broadsheetfb.c | 8 ++++++--
drivers/video/fbdev/carminefb.c | 1 +
drivers/video/fbdev/efifb.c | 1 +
drivers/video/fbdev/hecubafb.c | 6 +++++-
drivers/video/fbdev/i740fb.c | 1 +
drivers/video/fbdev/metronomefb.c | 8 ++++++--
drivers/video/fbdev/nvidia/nvidia.c | 1 +
drivers/video/fbdev/s3fb.c | 1 +
drivers/video/fbdev/sm501fb.c | 3 +++
drivers/video/fbdev/tdfxfb.c | 1 +
drivers/video/fbdev/tridentfb.c | 1 +
drivers/video/fbdev/uvesafb.c | 4 ++--
drivers/video/fbdev/vesafb.c | 1 +
14 files changed, 31 insertions(+), 7 deletions(-)
---
base-commit: ba2e787b4814ebf9ab5f6a84181678b67eb3677b
change-id: 20260513-fbdev-99a53dc0754f
Best regards,
--
Abdun Nihaal <nihaal@cse.iitm.ac.in>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-15 7:57 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe() Abdun Nihaal
` (12 subsequent siblings)
13 siblings, 1 reply; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The memory allocated for pagerefs in fb_deferred_io_init() is not freed
on the error path. Fix it by calling fb_deferred_io_cleanup().
Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/hecubafb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/hecubafb.c b/drivers/video/fbdev/hecubafb.c
index 3547d58a29cf..dd2af980f3d8 100644
--- a/drivers/video/fbdev/hecubafb.c
+++ b/drivers/video/fbdev/hecubafb.c
@@ -192,7 +192,9 @@ static int hecubafb_probe(struct platform_device *dev)
info->flags = FBINFO_VIRTFB;
info->fbdefio = &hecubafb_defio;
- fb_deferred_io_init(info);
+ retval = fb_deferred_io_init(info);
+ if (retval)
+ goto err_fbdefio;
retval = register_framebuffer(info);
if (retval < 0)
@@ -209,6 +211,8 @@ static int hecubafb_probe(struct platform_device *dev)
return 0;
err_fbreg:
+ fb_deferred_io_cleanup(info);
+err_fbdefio:
framebuffer_release(info);
err_fballoc:
vfree(videomemory);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
2026-05-14 8:24 ` [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-15 7:56 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe() Abdun Nihaal
` (11 subsequent siblings)
13 siblings, 1 reply; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The memory allocated for pagerefs in fb_deferred_io_init() is not freed
on the error path. Fix it by calling fb_deferred_io_cleanup().
Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/broadsheetfb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index c8ba098a8c42..582f1ee4c9b6 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -1072,12 +1072,14 @@ static int broadsheetfb_probe(struct platform_device *dev)
info->flags = FBINFO_VIRTFB;
info->fbdefio = &broadsheetfb_defio;
- fb_deferred_io_init(info);
+ retval = fb_deferred_io_init(info);
+ if (retval)
+ goto err_vfree;
retval = fb_alloc_cmap(&info->cmap, 16, 0);
if (retval < 0) {
dev_err(&dev->dev, "Failed to allocate colormap\n");
- goto err_vfree;
+ goto err_fbdefio;
}
/* set cmap */
@@ -1121,6 +1123,8 @@ static int broadsheetfb_probe(struct platform_device *dev)
board->cleanup(par);
err_cmap:
fb_dealloc_cmap(&info->cmap);
+err_fbdefio:
+ fb_deferred_io_cleanup(info);
err_vfree:
vfree(videomemory);
err_fb_rel:
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
2026-05-14 8:24 ` [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-15 7:18 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 04/14] fbdev: radeon: fix potential memory leak in radeonfb_pci_register() Abdun Nihaal
` (10 subsequent siblings)
13 siblings, 1 reply; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The memory allocated for pagerefs in fb_deferred_io_init() is not freed
on the error path. Fix it by calling fb_deferred_io_cleanup().
Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/metronomefb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/metronomefb.c b/drivers/video/fbdev/metronomefb.c
index 6f0942c6e5f1..83c614963a0a 100644
--- a/drivers/video/fbdev/metronomefb.c
+++ b/drivers/video/fbdev/metronomefb.c
@@ -645,12 +645,14 @@ static int metronomefb_probe(struct platform_device *dev)
info->flags = FBINFO_VIRTFB;
info->fbdefio = &metronomefb_defio;
- fb_deferred_io_init(info);
+ retval = fb_deferred_io_init(info);
+ if (retval)
+ goto err_free_irq;
retval = fb_alloc_cmap(&info->cmap, 8, 0);
if (retval < 0) {
dev_err(&dev->dev, "Failed to allocate colormap\n");
- goto err_free_irq;
+ goto err_fbdefio;
}
/* set cmap */
@@ -673,6 +675,8 @@ static int metronomefb_probe(struct platform_device *dev)
err_cmap:
fb_dealloc_cmap(&info->cmap);
+err_fbdefio:
+ fb_deferred_io_cleanup(info);
err_free_irq:
board->cleanup(par);
err_csum_table:
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 04/14] fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (2 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 05/14] fbdev: carminefb: fix potential memory leak in alloc_carmine_fb() Abdun Nihaal
` (9 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The function radeonfb_pci_register() allocates memory for modelist
(by calling radeon_check_modes() which calls fb_add_videomode()).
The memory is appended to info->modelist, but is not freed in subsequent
error paths. Fix this by calling fb_destroy_modelist().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/aty/radeon_base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
index adb03489bedf..b6b058cee751 100644
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -2476,6 +2476,7 @@ static int radeonfb_pci_register(struct pci_dev *pdev,
return 0;
err_unmap_fb:
iounmap(rinfo->fb_base);
+ fb_destroy_modelist(&info->modelist);
err_unmap_rom:
kfree(rinfo->mon1_EDID);
kfree(rinfo->mon2_EDID);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 05/14] fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (3 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 04/14] fbdev: radeon: fix potential memory leak in radeonfb_pci_register() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 06/14] fbdev: i740fb: fix potential memory leak in i740fb_probe() Abdun Nihaal
` (8 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The memory allocated for modelist in fb_videomode_to_modelist() is not
freed in the subsequent error path.
Fix that by calling fb_destroy_modelist()
Fixes: 2ece5f43b041 ("fbdev: add the carmine FB driver")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/carminefb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/carminefb.c b/drivers/video/fbdev/carminefb.c
index 5f13f1cc79d3..fca50b7961eb 100644
--- a/drivers/video/fbdev/carminefb.c
+++ b/drivers/video/fbdev/carminefb.c
@@ -589,6 +589,7 @@ static int alloc_carmine_fb(void __iomem *regs, void __iomem *smem_base,
return 0;
err_dealloc_cmap:
+ fb_destroy_modelist(&info->modelist);
fb_dealloc_cmap(&info->cmap);
err_free_fb:
framebuffer_release(info);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 06/14] fbdev: i740fb: fix potential memory leak in i740fb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (4 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 05/14] fbdev: carminefb: fix potential memory leak in alloc_carmine_fb() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 07/14] fbdev: nvidia: fix potential memory leak in nvidiafb_probe() Abdun Nihaal
` (7 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
In i740fb_probe(), the memory allocated in fb_videomode_to_modelist()
for modelist is not freed in the error paths. Fix that by calling
fb_destroy_modelist().
Fixes: 5350c65f4f15 ("Resurrect Intel740 driver: i740fb")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/i740fb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c
index 9b74dae71472..c14a19382769 100644
--- a/drivers/video/fbdev/i740fb.c
+++ b/drivers/video/fbdev/i740fb.c
@@ -1152,6 +1152,7 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
fb_dealloc_cmap(&info->cmap);
err_alloc_cmap:
err_find_mode:
+ fb_destroy_modelist(&info->modelist);
if (par->ddc_registered)
i2c_del_adapter(&par->ddc_adapter);
pci_iounmap(dev, par->regs);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 07/14] fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (5 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 06/14] fbdev: i740fb: fix potential memory leak in i740fb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 08/14] fbdev: s3fb: fix potential memory leak in s3_pci_probe() Abdun Nihaal
` (6 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
In nvidiafb_probe(), the memory allocated for modelist in
nvidia_set_fbinfo() is not freed in the subsequent error paths.
Fix that by calling fb_destroy_modelist().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/nvidia/nvidia.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c
index da2d486022e8..7d20c4087aeb 100644
--- a/drivers/video/fbdev/nvidia/nvidia.c
+++ b/drivers/video/fbdev/nvidia/nvidia.c
@@ -1424,6 +1424,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
err_out_iounmap_fb:
iounmap(info->screen_base);
+ fb_destroy_modelist(&info->modelist);
err_out_free_base1:
fb_destroy_modedb(info->monspecs.modedb);
nvidia_delete_i2c_busses(par);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 08/14] fbdev: s3fb: fix potential memory leak in s3_pci_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (6 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 07/14] fbdev: nvidia: fix potential memory leak in nvidiafb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 09/14] fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe() Abdun Nihaal
` (5 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
In s3_pci_probe(), the memory allocated for modelist using
fb_videomode_to_modelist() is not freed in subsequent error paths.
Fix that by calling fb_destroy_modelist()
Fixes: 86c0f043a737 ("s3fb: add DDC support")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/s3fb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c
index 831e9e6861b1..dc1f9b627185 100644
--- a/drivers/video/fbdev/s3fb.c
+++ b/drivers/video/fbdev/s3fb.c
@@ -1446,6 +1446,7 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
err_alloc_cmap:
err_find_mode:
#ifdef CONFIG_FB_S3_DDC
+ fb_destroy_modelist(&info->modelist);
if (par->ddc_registered)
i2c_del_adapter(&par->ddc_adapter);
if (par->mmio)
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 09/14] fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (7 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 08/14] fbdev: s3fb: fix potential memory leak in s3_pci_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 10/14] fbdev: tridentfb: fix potential memory leak in trident_pci_probe() Abdun Nihaal
` (4 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
In tdfxfb_probe(), the memory allocated for modelist using
fb_videomode_to_modelist() when CONFIG_FB_3DFX_I2C is defined, is not
freed in the subsequent error paths.
Fix that by calling fb_destroy_modelist().
Fixes: 215059d2421f ("tdfxfb: make use of DDC information about connected monitor")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/tdfxfb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c
index a6b63c09b48f..cc6a074f3165 100644
--- a/drivers/video/fbdev/tdfxfb.c
+++ b/drivers/video/fbdev/tdfxfb.c
@@ -1552,6 +1552,7 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
out_err_iobase:
#ifdef CONFIG_FB_3DFX_I2C
+ fb_destroy_modelist(&info->modelist);
tdfxfb_delete_i2c_busses(default_par);
#endif
arch_phys_wc_del(default_par->wc_cookie);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 10/14] fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (8 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 09/14] fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 11/14] fbdev: uvesafb: fix potential memory leak in uvesafb_probe() Abdun Nihaal
` (3 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
In trident_pci_probe(), the memory allocated for modelist using
fb_videomode_to_modelist() is not freed in subsequent error paths.
Fix that by calling fb_destroy_modelist().
Fixes: 6a5e3bd0c8bc ("tridentfb: Add DDC support")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/tridentfb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index a8fdbae83a80..9f055ba776c8 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -1706,6 +1706,7 @@ static int trident_pci_probe(struct pci_dev *dev,
return 0;
out_unmap2:
+ fb_destroy_modelist(&info->modelist);
if (default_par->ddc_registered)
i2c_del_adapter(&default_par->ddc_adapter);
kfree(info->pixmap.addr);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 11/14] fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (9 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 10/14] fbdev: tridentfb: fix potential memory leak in trident_pci_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-14 8:24 ` [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe() Abdun Nihaal
` (2 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
Due to an incorrect goto label, memory allocated for modedb and modelist
in uvesafb_vbe_init() is not freed in some error paths. Fix this by
updating the goto label.
Fixes: 8bdb3a2d7df4 ("uvesafb: the driver core")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/uvesafb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 88667fccc27b..9d82326c744f 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -1694,14 +1694,14 @@ static int uvesafb_probe(struct platform_device *dev)
i = uvesafb_vbe_init_mode(info);
if (i < 0) {
err = -EINVAL;
- goto out;
+ goto out_mode;
} else {
mode = &par->vbe_modes[i];
}
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
err = -ENXIO;
- goto out;
+ goto out_mode;
}
uvesafb_init_info(info, mode);
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (10 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 11/14] fbdev: uvesafb: fix potential memory leak in uvesafb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-15 7:16 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 14/14] fbdev: sm501fb: fix potential memory leak in sm501fb_probe() Abdun Nihaal
13 siblings, 1 reply; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to
caller; clarify ownership") the string returned from fb_get_options()
is expected to be freed by the caller, but the string is not freed in
efifb_probe(). Fix that by freeing the option string after setup.
Fixes: 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/efifb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 47ebc0107209..ad8dec7807c3 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -377,6 +377,7 @@ static int efifb_probe(struct platform_device *dev)
if (fb_get_options("efifb", &option))
return -ENODEV;
efifb_setup(si, option);
+ kfree(option);
/* We don't get linelength from UGA Draw Protocol, only from
* EFI Graphics Protocol. So if it's not in DMI, and it's not
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (11 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
2026-05-15 7:17 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 14/14] fbdev: sm501fb: fix potential memory leak in sm501fb_probe() Abdun Nihaal
13 siblings, 1 reply; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to
caller; clarify ownership") the string returned from fb_get_options()
is expected to be freed by the caller. But the string is not freed in
vesafb_probe(). Fix that by freeing the option string after setup.
Fixes: 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/vesafb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
index f84f4db244bf..f1902056bd73 100644
--- a/drivers/video/fbdev/vesafb.c
+++ b/drivers/video/fbdev/vesafb.c
@@ -269,6 +269,7 @@ static int vesafb_probe(struct platform_device *dev)
/* ignore error return of fb_get_options */
fb_get_options("vesafb", &option);
vesafb_setup(option);
+ kfree(option);
if (si->orig_video_isVGA != VIDEO_TYPE_VLFB)
return -ENODEV;
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 14/14] fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
` (12 preceding siblings ...)
2026-05-14 8:24 ` [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe() Abdun Nihaal
@ 2026-05-14 8:24 ` Abdun Nihaal
13 siblings, 0 replies; 20+ messages in thread
From: Abdun Nihaal @ 2026-05-14 8:24 UTC (permalink / raw)
To: Helge Deller, Javier Martinez Canillas, Thomas Zimmermann,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable, Abdun Nihaal
The memory allocated for info->edid_data in sm501fb_probe() when
CONFIG_OF is defined is not freed in the subsequent error paths.
Fix that by freeing it in the error path if CONFIG_OF is defined.
Fixes: 4295f9bf74a8 ("video, sm501: add OF binding to support SM501")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/video/fbdev/sm501fb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index fee4b9f84592..1ee7842517b8 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -2048,6 +2048,9 @@ static int sm501fb_probe(struct platform_device *pdev)
framebuffer_release(info->fb[HEAD_CRT]);
err_alloc:
+#if defined(CONFIG_OF)
+ kfree(info->edid_data);
+#endif
kfree(info);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe()
2026-05-14 8:24 ` [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe() Abdun Nihaal
@ 2026-05-15 7:16 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-05-15 7:16 UTC (permalink / raw)
To: Abdun Nihaal, Helge Deller, Javier Martinez Canillas,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable
Hi
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
> Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to
> caller; clarify ownership") the string returned from fb_get_options()
> is expected to be freed by the caller, but the string is not freed in
> efifb_probe(). Fix that by freeing the option string after setup.
>
> Fixes: 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
Right, the commit message even mentions the (pre-existing) leak. There
might be other drivers with a similar issue.
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/efifb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
> index 47ebc0107209..ad8dec7807c3 100644
> --- a/drivers/video/fbdev/efifb.c
> +++ b/drivers/video/fbdev/efifb.c
> @@ -377,6 +377,7 @@ static int efifb_probe(struct platform_device *dev)
> if (fb_get_options("efifb", &option))
> return -ENODEV;
> efifb_setup(si, option);
> + kfree(option);
>
> /* We don't get linelength from UGA Draw Protocol, only from
> * EFI Graphics Protocol. So if it's not in DMI, and it's not
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe()
2026-05-14 8:24 ` [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe() Abdun Nihaal
@ 2026-05-15 7:17 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-05-15 7:17 UTC (permalink / raw)
To: Abdun Nihaal, Helge Deller, Javier Martinez Canillas,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
> Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to
> caller; clarify ownership") the string returned from fb_get_options()
> is expected to be freed by the caller. But the string is not freed in
> vesafb_probe(). Fix that by freeing the option string after setup.
>
> Fixes: 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/vesafb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
> index f84f4db244bf..f1902056bd73 100644
> --- a/drivers/video/fbdev/vesafb.c
> +++ b/drivers/video/fbdev/vesafb.c
> @@ -269,6 +269,7 @@ static int vesafb_probe(struct platform_device *dev)
> /* ignore error return of fb_get_options */
> fb_get_options("vesafb", &option);
> vesafb_setup(option);
> + kfree(option);
>
> if (si->orig_video_isVGA != VIDEO_TYPE_VLFB)
> return -ENODEV;
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
2026-05-14 8:24 ` [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe() Abdun Nihaal
@ 2026-05-15 7:18 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-05-15 7:18 UTC (permalink / raw)
To: Abdun Nihaal, Helge Deller, Javier Martinez Canillas,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
> The memory allocated for pagerefs in fb_deferred_io_init() is not freed
> on the error path. Fix it by calling fb_deferred_io_cleanup().
>
> Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/metronomefb.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/metronomefb.c b/drivers/video/fbdev/metronomefb.c
> index 6f0942c6e5f1..83c614963a0a 100644
> --- a/drivers/video/fbdev/metronomefb.c
> +++ b/drivers/video/fbdev/metronomefb.c
> @@ -645,12 +645,14 @@ static int metronomefb_probe(struct platform_device *dev)
> info->flags = FBINFO_VIRTFB;
>
> info->fbdefio = &metronomefb_defio;
> - fb_deferred_io_init(info);
> + retval = fb_deferred_io_init(info);
> + if (retval)
> + goto err_free_irq;
>
> retval = fb_alloc_cmap(&info->cmap, 8, 0);
> if (retval < 0) {
> dev_err(&dev->dev, "Failed to allocate colormap\n");
> - goto err_free_irq;
> + goto err_fbdefio;
> }
>
> /* set cmap */
> @@ -673,6 +675,8 @@ static int metronomefb_probe(struct platform_device *dev)
>
> err_cmap:
> fb_dealloc_cmap(&info->cmap);
> +err_fbdefio:
> + fb_deferred_io_cleanup(info);
> err_free_irq:
> board->cleanup(par);
> err_csum_table:
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
2026-05-14 8:24 ` [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe() Abdun Nihaal
@ 2026-05-15 7:56 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-05-15 7:56 UTC (permalink / raw)
To: Abdun Nihaal, Helge Deller, Javier Martinez Canillas,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
> The memory allocated for pagerefs in fb_deferred_io_init() is not freed
> on the error path. Fix it by calling fb_deferred_io_cleanup().
>
> Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/broadsheetfb.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
> index c8ba098a8c42..582f1ee4c9b6 100644
> --- a/drivers/video/fbdev/broadsheetfb.c
> +++ b/drivers/video/fbdev/broadsheetfb.c
> @@ -1072,12 +1072,14 @@ static int broadsheetfb_probe(struct platform_device *dev)
> info->flags = FBINFO_VIRTFB;
>
> info->fbdefio = &broadsheetfb_defio;
> - fb_deferred_io_init(info);
> + retval = fb_deferred_io_init(info);
> + if (retval)
> + goto err_vfree;
>
> retval = fb_alloc_cmap(&info->cmap, 16, 0);
> if (retval < 0) {
> dev_err(&dev->dev, "Failed to allocate colormap\n");
> - goto err_vfree;
> + goto err_fbdefio;
> }
>
> /* set cmap */
> @@ -1121,6 +1123,8 @@ static int broadsheetfb_probe(struct platform_device *dev)
> board->cleanup(par);
> err_cmap:
> fb_dealloc_cmap(&info->cmap);
> +err_fbdefio:
> + fb_deferred_io_cleanup(info);
> err_vfree:
> vfree(videomemory);
> err_fb_rel:
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
2026-05-14 8:24 ` [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe() Abdun Nihaal
@ 2026-05-15 7:57 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-05-15 7:57 UTC (permalink / raw)
To: Abdun Nihaal, Helge Deller, Javier Martinez Canillas,
Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
Heiko Schocher, Peter Jones
Cc: linux-fbdev, dri-devel, linux-kernel, stable
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
> The memory allocated for pagerefs in fb_deferred_io_init() is not freed
> on the error path. Fix it by calling fb_deferred_io_cleanup().
>
> Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/hecubafb.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/hecubafb.c b/drivers/video/fbdev/hecubafb.c
> index 3547d58a29cf..dd2af980f3d8 100644
> --- a/drivers/video/fbdev/hecubafb.c
> +++ b/drivers/video/fbdev/hecubafb.c
> @@ -192,7 +192,9 @@ static int hecubafb_probe(struct platform_device *dev)
> info->flags = FBINFO_VIRTFB;
>
> info->fbdefio = &hecubafb_defio;
> - fb_deferred_io_init(info);
> + retval = fb_deferred_io_init(info);
> + if (retval)
> + goto err_fbdefio;
>
> retval = register_framebuffer(info);
> if (retval < 0)
> @@ -209,6 +211,8 @@ static int hecubafb_probe(struct platform_device *dev)
>
> return 0;
> err_fbreg:
> + fb_deferred_io_cleanup(info);
> +err_fbdefio:
> framebuffer_release(info);
> err_fballoc:
> vfree(videomemory);
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-05-15 7:57 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 8:24 [PATCH 00/14] fbdev: fix various memory leaks Abdun Nihaal
2026-05-14 8:24 ` [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe() Abdun Nihaal
2026-05-15 7:57 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe() Abdun Nihaal
2026-05-15 7:56 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe() Abdun Nihaal
2026-05-15 7:18 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 04/14] fbdev: radeon: fix potential memory leak in radeonfb_pci_register() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 05/14] fbdev: carminefb: fix potential memory leak in alloc_carmine_fb() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 06/14] fbdev: i740fb: fix potential memory leak in i740fb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 07/14] fbdev: nvidia: fix potential memory leak in nvidiafb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 08/14] fbdev: s3fb: fix potential memory leak in s3_pci_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 09/14] fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 10/14] fbdev: tridentfb: fix potential memory leak in trident_pci_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 11/14] fbdev: uvesafb: fix potential memory leak in uvesafb_probe() Abdun Nihaal
2026-05-14 8:24 ` [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe() Abdun Nihaal
2026-05-15 7:16 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe() Abdun Nihaal
2026-05-15 7:17 ` Thomas Zimmermann
2026-05-14 8:24 ` [PATCH 14/14] fbdev: sm501fb: fix potential memory leak in sm501fb_probe() Abdun Nihaal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox