linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drm/bochs: fix an issue of ioremap() leak
@ 2020-04-21 16:45 Dejin Zheng
  2020-04-21 17:24 ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2020-04-21 16:45 UTC (permalink / raw)
  To: kraxel, airlied, daniel, virtualization, dri-devel
  Cc: linux-kernel, Dejin Zheng, Andy Shevchenko

It forgot to call bochs_hw_fini() to release related resources when
bochs_pci_probe() fail. eg: io virtual address get by ioremap().

Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.")
CC: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/gpu/drm/bochs/bochs_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index addb0568c1af..210a60135c8a 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
 	return ret;
 
 err_unload:
+	bochs_hw_fini(dev);
 	bochs_unload(dev);
 err_free_dev:
 	drm_dev_put(dev);
-- 
2.25.0


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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-21 16:45 [PATCH v1] drm/bochs: fix an issue of ioremap() leak Dejin Zheng
@ 2020-04-21 17:24 ` Andy Shevchenko
  2020-04-22 13:52   ` Dejin Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2020-04-21 17:24 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: kraxel, David Airlie, Daniel Vetter, virtualization, dri-devel,
	Linux Kernel Mailing List

On Tue, Apr 21, 2020 at 7:45 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
>
> It forgot to call bochs_hw_fini() to release related resources when
> bochs_pci_probe() fail. eg: io virtual address get by ioremap().

Good start, although I think the best is to switch this driver to use
pcim_*() functions and drop tons of legacy code.

> Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.")
> CC: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
>  drivers/gpu/drm/bochs/bochs_drv.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> index addb0568c1af..210a60135c8a 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
>         return ret;
>
>  err_unload:
> +       bochs_hw_fini(dev);
>         bochs_unload(dev);
>  err_free_dev:
>         drm_dev_put(dev);
> --
> 2.25.0
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-21 17:24 ` Andy Shevchenko
@ 2020-04-22 13:52   ` Dejin Zheng
  2020-04-22 14:40     ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2020-04-22 13:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kraxel, David Airlie, Daniel Vetter, virtualization, dri-devel,
	Linux Kernel Mailing List

On Tue, Apr 21, 2020 at 08:24:24PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 21, 2020 at 7:45 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
> >
> > It forgot to call bochs_hw_fini() to release related resources when
> > bochs_pci_probe() fail. eg: io virtual address get by ioremap().
> 
> Good start, although I think the best is to switch this driver to use
> pcim_*() functions and drop tons of legacy code.
>
Andy, thanks for your encouragement, I think we might be able to fix this
issue first, after that, drop tons of legacy code by pcim_*() functions.
Do you think it is ok?

BR,
Dejin

> > Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.")
> > CC: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > ---
> >  drivers/gpu/drm/bochs/bochs_drv.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> > index addb0568c1af..210a60135c8a 100644
> > --- a/drivers/gpu/drm/bochs/bochs_drv.c
> > +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> > @@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
> >         return ret;
> >
> >  err_unload:
> > +       bochs_hw_fini(dev);
> >         bochs_unload(dev);
> >  err_free_dev:
> >         drm_dev_put(dev);
> > --
> > 2.25.0
> >
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko

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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-22 13:52   ` Dejin Zheng
@ 2020-04-22 14:40     ` Andy Shevchenko
  2020-04-22 15:21       ` Dejin Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2020-04-22 14:40 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: kraxel, David Airlie, Daniel Vetter, virtualization, dri-devel,
	Linux Kernel Mailing List

On Wed, Apr 22, 2020 at 4:52 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
>
> On Tue, Apr 21, 2020 at 08:24:24PM +0300, Andy Shevchenko wrote:
> > On Tue, Apr 21, 2020 at 7:45 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
> > >
> > > It forgot to call bochs_hw_fini() to release related resources when
> > > bochs_pci_probe() fail. eg: io virtual address get by ioremap().
> >
> > Good start, although I think the best is to switch this driver to use
> > pcim_*() functions and drop tons of legacy code.
> >
> Andy, thanks for your encouragement, I think we might be able to fix this
> issue first, after that, drop tons of legacy code by pcim_*() functions.
> Do you think it is ok?

It's really up to maintainer. I'm not the one here.

> > > Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.")
> > > CC: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > > ---
> > >  drivers/gpu/drm/bochs/bochs_drv.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> > > index addb0568c1af..210a60135c8a 100644
> > > --- a/drivers/gpu/drm/bochs/bochs_drv.c
> > > +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> > > @@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
> > >         return ret;
> > >
> > >  err_unload:
> > > +       bochs_hw_fini(dev);
> > >         bochs_unload(dev);
> > >  err_free_dev:
> > >         drm_dev_put(dev);
> > > --
> > > 2.25.0
> > >
> >
> >
> > --
> > With Best Regards,
> > Andy Shevchenko



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-22 14:40     ` Andy Shevchenko
@ 2020-04-22 15:21       ` Dejin Zheng
  2020-04-23 10:14         ` Gerd Hoffmann
  0 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2020-04-22 15:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kraxel, David Airlie, Daniel Vetter, virtualization, dri-devel,
	Linux Kernel Mailing List

On Wed, Apr 22, 2020 at 05:40:51PM +0300, Andy Shevchenko wrote:
> On Wed, Apr 22, 2020 at 4:52 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
> >
> > On Tue, Apr 21, 2020 at 08:24:24PM +0300, Andy Shevchenko wrote:
> > > On Tue, Apr 21, 2020 at 7:45 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
> > > >
> > > > It forgot to call bochs_hw_fini() to release related resources when
> > > > bochs_pci_probe() fail. eg: io virtual address get by ioremap().
> > >
> > > Good start, although I think the best is to switch this driver to use
> > > pcim_*() functions and drop tons of legacy code.
> > >
> > Andy, thanks for your encouragement, I think we might be able to fix this
> > issue first, after that, drop tons of legacy code by pcim_*() functions.
> > Do you think it is ok?
> 
> It's really up to maintainer. I'm not the one here.
>
Thanks Andy.

Hi Gerd:

I am a newbie, andy gave me some directions to submit the patch, eg: check
ioremap leak. At this time, I found that the bochs driver may have similar
problems, so I submitted this patch, then, Andy said the best is to switch
this driver to use pcim _ * () functions and drop tons of legacy code.
I think we might be able to fix this issue first, after that, drop tons
of legacy code by pcim_*() functions. Can you give me some suggestions?
thank you very much!

BR,
Dejin

> > > > Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.")
> > > > CC: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > > > ---
> > > >  drivers/gpu/drm/bochs/bochs_drv.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> > > > index addb0568c1af..210a60135c8a 100644
> > > > --- a/drivers/gpu/drm/bochs/bochs_drv.c
> > > > +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> > > > @@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
> > > >         return ret;
> > > >
> > > >  err_unload:
> > > > +       bochs_hw_fini(dev);
> > > >         bochs_unload(dev);
> > > >  err_free_dev:
> > > >         drm_dev_put(dev);
> > > > --
> > > > 2.25.0
> > > >
> > >
> > >
> > > --
> > > With Best Regards,
> > > Andy Shevchenko
> 
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko

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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-22 15:21       ` Dejin Zheng
@ 2020-04-23 10:14         ` Gerd Hoffmann
  2020-04-23 14:14           ` Dejin Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2020-04-23 10:14 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: Andy Shevchenko, David Airlie, Daniel Vetter, virtualization,
	dri-devel, Linux Kernel Mailing List

  Hi,

> I am a newbie, andy gave me some directions to submit the patch, eg: check
> ioremap leak. At this time, I found that the bochs driver may have similar
> problems, so I submitted this patch, then, Andy said the best is to switch
> this driver to use pcim _ * () functions and drop tons of legacy code.
> I think we might be able to fix this issue first, after that, drop tons
> of legacy code by pcim_*() functions. Can you give me some suggestions?
> thank you very much!

drm has drmm_* functions for that.  Daniel Vetter <daniel@ffwll.ch> has
a patch series pending switching lots of drivers over and IIRC it fixes
this bug too.

cheers,
  Gerd


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

* Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak
  2020-04-23 10:14         ` Gerd Hoffmann
@ 2020-04-23 14:14           ` Dejin Zheng
  0 siblings, 0 replies; 7+ messages in thread
From: Dejin Zheng @ 2020-04-23 14:14 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Andy Shevchenko, David Airlie, Daniel Vetter, virtualization,
	dri-devel, Linux Kernel Mailing List

On Thu, Apr 23, 2020 at 12:14:20PM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > I am a newbie, andy gave me some directions to submit the patch, eg: check
> > ioremap leak. At this time, I found that the bochs driver may have similar
> > problems, so I submitted this patch, then, Andy said the best is to switch
> > this driver to use pcim _ * () functions and drop tons of legacy code.
> > I think we might be able to fix this issue first, after that, drop tons
> > of legacy code by pcim_*() functions. Can you give me some suggestions?
> > thank you very much!
> 
> drm has drmm_* functions for that.  Daniel Vetter <daniel@ffwll.ch> has
> a patch series pending switching lots of drivers over and IIRC it fixes
> this bug too.
>
Gerd, Thanks for your info and abandon this commit. 

BR,
Dejin

> cheers,
>   Gerd
> 

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

end of thread, other threads:[~2020-04-23 14:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 16:45 [PATCH v1] drm/bochs: fix an issue of ioremap() leak Dejin Zheng
2020-04-21 17:24 ` Andy Shevchenko
2020-04-22 13:52   ` Dejin Zheng
2020-04-22 14:40     ` Andy Shevchenko
2020-04-22 15:21       ` Dejin Zheng
2020-04-23 10:14         ` Gerd Hoffmann
2020-04-23 14:14           ` Dejin Zheng

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).