fbdev: fix various memory leaks
Subsystems (6)
cover fbdev: fix various memory leaks
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.
---
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,
Signature · 1 line
Abdun Nihaal <[email protected]>
PATCH 1/14 fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
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().
--- drivers/video/fbdev/hecubafb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/fbdev/hecubafb.c +5 -1
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 01/14] fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
Quoted 6 lines
The memory allocated for pagerefs in
fb_deferred_io_init()is not freed on the error path. Fix it by callingfb_deferred_io_cleanup().Fixes 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")Signed-off-by Abdun Nihaal <[email protected]>
Quoted 29 lines
--- drivers/video/fbdev/hecubafb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/video/fbdev/hecubafb.c +5
-1@@ -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);
Signature · 6 lines
-- 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)
PATCH 2/14 fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
In reply to Abdun NihaalThe memory allocated for pagerefs in fb_deferred_io_init() is not freed on the error path. Fix it by calling fb_deferred_io_cleanup().
--- drivers/video/fbdev/broadsheetfb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/video/fbdev/broadsheetfb.c +6 -2
@@ -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:
Signature · 1 line
2.43.0
Re: [PATCH 02/14] fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
Quoted 6 lines
The memory allocated for pagerefs in
fb_deferred_io_init()is not freed on the error path. Fix it by callingfb_deferred_io_cleanup().Fixes 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")Signed-off-by Abdun Nihaal <[email protected]>
Quoted 35 lines
--- drivers/video/fbdev/broadsheetfb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/video/fbdev/broadsheetfb.c +6
-2@@ -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:
Signature · 6 lines
-- 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)
PATCH 3/14 fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
In reply to Abdun NihaalThe memory allocated for pagerefs in fb_deferred_io_init() is not freed on the error path. Fix it by calling fb_deferred_io_cleanup().
--- drivers/video/fbdev/metronomefb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/video/fbdev/metronomefb.c +6 -2
@@ -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:
Signature · 1 line
2.43.0
Re: [PATCH 03/14] fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
Quoted 6 lines
The memory allocated for pagerefs in
fb_deferred_io_init()is not freed on the error path. Fix it by callingfb_deferred_io_cleanup().Fixes 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")Signed-off-by Abdun Nihaal <[email protected]>
Quoted 35 lines
--- drivers/video/fbdev/metronomefb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/video/fbdev/metronomefb.c +6
-2@@ -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:
Signature · 6 lines
-- 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)
PATCH 4/14 fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
In reply to Abdun NihaalThe 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().
--- drivers/video/fbdev/aty/radeon_base.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/aty/radeon_base.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 5/14 fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
In reply to Abdun NihaalThe memory allocated for modelist in fb_videomode_to_modelist() is not freed in the subsequent error path.
Fix that by calling fb_destroy_modelist()
--- drivers/video/fbdev/carminefb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/carminefb.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 6/14 fbdev: i740fb: fix potential memory leak in i740fb_probe()
In reply to Abdun NihaalIn 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().
--- drivers/video/fbdev/i740fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/i740fb.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 7/14 fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
In reply to Abdun NihaalIn 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().
--- drivers/video/fbdev/nvidia/nvidia.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/nvidia/nvidia.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 8/14 fbdev: s3fb: fix potential memory leak in s3_pci_probe()
In reply to Abdun NihaalIn 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()
--- drivers/video/fbdev/s3fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/s3fb.c +1 -0
@@ -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)
Signature · 1 line
2.43.0
PATCH 9/14 fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
In reply to Abdun NihaalIn 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().
--- drivers/video/fbdev/tdfxfb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/tdfxfb.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 10/14 fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
In reply to Abdun NihaalIn 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().
--- drivers/video/fbdev/tridentfb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/tridentfb.c +1 -0
@@ -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);
Signature · 1 line
2.43.0
PATCH 11/14 fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
In reply to Abdun NihaalDue 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.
--- drivers/video/fbdev/uvesafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/uvesafb.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 12/14 fbdev: efifb: fix memory leak in efifb_probe()
In reply to Abdun NihaalSince 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.
--- drivers/video/fbdev/efifb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/efifb.c +1 -0
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH 12/14] fbdev: efifb: fix memory leak in efifb_probe()
Hi
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
Quoted 6 lines
Since commit
73ce73c30ba9("fbdev: Transfer video= option strings to caller; clarify ownership") the string returned fromfb_get_options()is expected to be freed by the caller, but the string is not freed inefifb_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.
Quoted 2 lines
Signed-off-by Abdun Nihaal <[email protected]>
Quoted 17 lines
--- drivers/video/fbdev/efifb.c | 1 + 1 file changed, 1 insertion(+)drivers/video/fbdev/efifb.c +1
-0@@ -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
Signature · 6 lines
-- 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)
PATCH 13/14 fbdev: vesafb: fix memory leak in vesafb_probe()
In reply to Abdun NihaalSince 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.
--- drivers/video/fbdev/vesafb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/vesafb.c +1 -0
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 13/14] fbdev: vesafb: fix memory leak in vesafb_probe()
Am 14.05.26 um 10:24 schrieb Abdun Nihaal:
Quoted 8 lines
Since commit
73ce73c30ba9("fbdev: Transfer video= option strings to caller; clarify ownership") the string returned fromfb_get_options()is expected to be freed by the caller. But the string is not freed invesafb_probe(). Fix that by freeing the option string after setup.Fixes 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")Signed-off-by Abdun Nihaal <[email protected]>
Quoted 17 lines
--- drivers/video/fbdev/vesafb.c | 1 + 1 file changed, 1 insertion(+)drivers/video/fbdev/vesafb.c +1
-0@@ -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 ;
Signature · 6 lines
-- 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)
PATCH 14/14 fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
In reply to Abdun NihaalThe 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.
--- drivers/video/fbdev/sm501fb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/sm501fb.c +3 -0
@@ -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;
Signature · 1 line
2.43.0
Quoted 53 lines · 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 callfb_deferred_io_init()were not updated to do cleanup. The first three commits address this.
- fbdev: hecubafb: fix potential memory leak inhecubafb_probe()
- fbdev: broadsheetfb: fix potential memory leak inbroadsheetfb_probe()
- fbdev: metronomefb: fix potential memory leak inmetronomefb_probe()Probe functions that call
fb_add_videomode()orfb_videomode_to_modelist()sometimes did not callfb_destry_modelist()to free the allocated memory. The following patches address this issue.
- fbdev: radeon: fix potential memory leak inradeonfb_pci_register()
- fbdev: carminefb: fix potential memory leak inalloc_carmine_fb()
- fbdev: i740fb: fix potential memory leak ini740fb_probe()
- fbdev: nvidia: fix potential memory leak innvidiafb_probe()
- fbdev: s3fb: fix potential memory leak ins3_pci_probe()
- fbdev: tdfxfb: fix potential memory leak intdfxfb_probe()
- fbdev: tridentfb: fix potential memory leak intrident_pci_probe()
- fbdev: uvesafb: fix potential memory leak inuvesafb_probe()Since commit
73ce73c30ba9("fbdev: Transfer video= option strings to caller; clarify ownership") thefb_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 inefifb_probe()
- fbdev: vesafb: fix memory leak invesafb_probe()The following commit fixes a simple memory leak.
- fbdev: sm501fb: fix potential memory leak insm501fb_probe()All the patches were only compile tested.
The issues were found using static analysis.Signed-off-by Abdun Nihaal <[email protected]>---
Abdun Nihaal (14):
fbdev: hecubafb: fix potential memory leak inhecubafb_probe()
fbdev: broadsheetfb: fix potential memory leak inbroadsheetfb_probe()
fbdev: metronomefb: fix potential memory leak inmetronomefb_probe()
fbdev: radeon: fix potential memory leak inradeonfb_pci_register()
fbdev: carminefb: fix potential memory leak inalloc_carmine_fb()
fbdev: i740fb: fix potential memory leak ini740fb_probe()
fbdev: nvidia: fix potential memory leak innvidiafb_probe()
fbdev: s3fb: fix potential memory leak ins3_pci_probe()
fbdev: tdfxfb: fix potential memory leak intdfxfb_probe()
fbdev: tridentfb: fix potential memory leak intrident_pci_probe()
fbdev: uvesafb: fix potential memory leak inuvesafb_probe()
fbdev: efifb: fix memory leak inefifb_probe()
fbdev: vesafb: fix memory leak invesafb_probe()
fbdev: sm501fb: fix potential memory leak insm501fb_probe()
Quoted 15 lines
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(-)
I applied the whole series to the fbdev git tree.
Thanks a lot !
Helge