mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] staging: sm750fb: fix resource leaks on probe error
@ 2026-10-03 17:50 Tymofiy Zakharchuk
  2026-10-13 13:39 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Tymofiy Zakharchuk @ 2026-10-03 17:50 UTC (permalink / raw)
  To: gregkh
  Cc: linux-staging, linux-kernel, Ahmet Sezgin Duran, Tymofiy Zakharchuk

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@gmail.com>
---
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


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

* Re: [PATCH v2] staging: sm750fb: fix resource leaks on probe error
  2026-10-03 17:50 [PATCH v2] staging: sm750fb: fix resource leaks on probe error Tymofiy Zakharchuk
@ 2026-10-13 13:39 ` Greg KH
  2026-10-19 11:46   ` Timofey Zakharcuk
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-10-13 13:39 UTC (permalink / raw)
  To: Tymofiy Zakharchuk; +Cc: linux-staging, linux-kernel, Ahmet Sezgin Duran

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@gmail.com>
> ---
> 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

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

* Re: [PATCH v2] staging: sm750fb: fix resource leaks on probe error
  2026-10-13 13:39 ` Greg KH
@ 2026-10-19 11:46   ` Timofey Zakharcuk
  2026-10-23 13:34     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Timofey Zakharcuk @ 2026-10-19 11:46 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel, Ahmet Sezgin Duran

hi Greg,
it was found by manual code inspection by noticing the asymmetry
between the resources
allocated pci probe (and freed in pci remove ) versus the cleanup
performed in the release_fb error path:

it was verified with checkpatch.pl
i don't have access to the physical sm750 hardware to test on real silicon.

thanks,
Tymofiy
(resending this because i accidentally sended it with html)

On Tue, Oct 13, 2026 at 4:39 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> 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@gmail.com>
> > ---
> > 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

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

* Re: [PATCH v2] staging: sm750fb: fix resource leaks on probe error
  2026-10-19 11:46   ` Timofey Zakharcuk
@ 2026-10-23 13:34     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-10-23 13:34 UTC (permalink / raw)
  To: Timofey Zakharcuk; +Cc: linux-staging, linux-kernel, Ahmet Sezgin Duran

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Mon, Oct 19, 2026 at 02:46:35PM +0300, Timofey Zakharcuk wrote:
> hi Greg,
> it was found by manual code inspection by noticing the asymmetry
> between the resources
> allocated pci probe (and freed in pci remove ) versus the cleanup
> performed in the release_fb error path:
> 
> it was verified with checkpatch.pl

That verifies style only, not anything else.

> i don't have access to the physical sm750 hardware to test on real silicon.

I will have to drop this until it can be tested on real hardware as
obviously you are changing the existing logic here.

thanks,

greg k-h

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

end of thread, other threads:[~2026-10-23 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-03 17:50 [PATCH v2] staging: sm750fb: fix resource leaks on probe error Tymofiy Zakharchuk
2026-10-13 13:39 ` Greg KH
2026-10-19 11:46   ` Timofey Zakharcuk
2026-10-23 13:34     ` Greg KH

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®