Re: [PATCH v2] staging: sm750fb: fix resource leaks on probe error

From: Greg KH

Date: Tue Oct 13 2026 - 11:01:39 EST


On Sat, Oct 03, 2026 at 08:50:55PM +0300, Tymofiy Zakharchuk wrote:
> If sm750fb_framebuffer_alloc() fails during lynxfb_pci_probe(), only
> the framebuffer structures are released. The write-combining MTRR,
> the MMIO and VRAM mappings, and PCI region 1 remain allocated.
>
> Call arch_phys_wc_del(), iounmap(), and pci_release_region() on the
> release_fb error exit path to prevent leaking resources.
>
> Signed-off-by: Tymofiy Zakharchuk <timofey.zakharchuk.research@xxxxxxxxx>
> ---
> v2:
> - Fix From and Signed-off-by email mismatch.
>
> drivers/staging/sm750fb/sm750.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 8b93bfeb2..456b3da86 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -1023,6 +1023,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
>
> release_fb:
> sm750fb_framebuffer_release(sm750_dev);
> + arch_phys_wc_del(sm750_dev->mtrr.vram);
> + iounmap(sm750_dev->vmem);
> + iounmap(sm750_dev->mmio);
> + pci_release_region(pdev, 1);
> return err;
> }
>
> --
> 2.53.0.windows.1
>
>

How was this found and tested?

thanks,

greg k-h