public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mvsas: always iounmap resources
@ 2015-05-22  9:15 Johannes Thumshirn
  2015-06-12  6:31 ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2015-05-22  9:15 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: Christoph Hellwig, Hannes Reinecke, Mike Christie,
	Martin K. Petersen, Bart Van Assche, Ben Hutchings,
	Johannes Thumshirn, linux-scsi, linux-kernel

In case pci_resource_start() or pci_resource_len() reutrn 0, mvsas_ioremap
returns without doing an iounmap() of mvi->regs_ex.

Found by the cocinelle tool.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/scsi/mvsas/mv_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 53030b0..04a3205 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -339,8 +339,11 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex)
 
 	res_start = pci_resource_start(pdev, bar);
 	res_len = pci_resource_len(pdev, bar);
-	if (!res_start || !res_len)
+	if (!res_start || !res_len) {
+		iounmap(mvi->regs_ex);
+		mvi->regs_ex = NULL;
 		goto err_out;
+	}
 
 	res_flag = pci_resource_flags(pdev, bar);
 	if (res_flag & IORESOURCE_CACHEABLE)
-- 
2.4.1


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

* Re: [PATCH] mvsas: always iounmap resources
  2015-05-22  9:15 [PATCH] mvsas: always iounmap resources Johannes Thumshirn
@ 2015-06-12  6:31 ` Hannes Reinecke
  2015-06-22  7:43   ` Johannes Thumshirn
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2015-06-12  6:31 UTC (permalink / raw)
  To: Johannes Thumshirn, James E.J. Bottomley
  Cc: Christoph Hellwig, Mike Christie, Martin K. Petersen,
	Bart Van Assche, Ben Hutchings, linux-scsi, linux-kernel

On 05/22/2015 11:15 AM, Johannes Thumshirn wrote:
> In case pci_resource_start() or pci_resource_len() reutrn 0, mvsas_ioremap
> returns without doing an iounmap() of mvi->regs_ex.
> 
> Found by the cocinelle tool.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  drivers/scsi/mvsas/mv_init.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> index 53030b0..04a3205 100644
> --- a/drivers/scsi/mvsas/mv_init.c
> +++ b/drivers/scsi/mvsas/mv_init.c
> @@ -339,8 +339,11 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex)
>  
>  	res_start = pci_resource_start(pdev, bar);
>  	res_len = pci_resource_len(pdev, bar);
> -	if (!res_start || !res_len)
> +	if (!res_start || !res_len) {
> +		iounmap(mvi->regs_ex);
> +		mvi->regs_ex = NULL;
>  		goto err_out;
> +	}
>  
>  	res_flag = pci_resource_flags(pdev, bar);
>  	if (res_flag & IORESOURCE_CACHEABLE)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH] mvsas: always iounmap resources
  2015-06-12  6:31 ` Hannes Reinecke
@ 2015-06-22  7:43   ` Johannes Thumshirn
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2015-06-22  7:43 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: Christoph Hellwig, Mike Christie, Martin K. Petersen,
	Bart Van Assche, Ben Hutchings, linux-scsi, linux-kernel,
	Hannes Reinecke

On Fri, Jun 12, 2015 at 08:31:38AM +0200, Hannes Reinecke wrote:
> On 05/22/2015 11:15 AM, Johannes Thumshirn wrote:
> > In case pci_resource_start() or pci_resource_len() reutrn 0, mvsas_ioremap
> > returns without doing an iounmap() of mvi->regs_ex.
> > 
> > Found by the cocinelle tool.
> > 
> > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> > ---
> >  drivers/scsi/mvsas/mv_init.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> > index 53030b0..04a3205 100644
> > --- a/drivers/scsi/mvsas/mv_init.c
> > +++ b/drivers/scsi/mvsas/mv_init.c
> > @@ -339,8 +339,11 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex)
> >  
> >  	res_start = pci_resource_start(pdev, bar);
> >  	res_len = pci_resource_len(pdev, bar);
> > -	if (!res_start || !res_len)
> > +	if (!res_start || !res_len) {
> > +		iounmap(mvi->regs_ex);
> > +		mvi->regs_ex = NULL;
> >  		goto err_out;
> > +	}
> >  
> >  	res_flag = pci_resource_flags(pdev, bar);
> >  	if (res_flag & IORESOURCE_CACHEABLE)
> > 
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> 

James, any update on this?
Do you intent to take it for 4.2?

Thank,
	Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2015-06-22  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22  9:15 [PATCH] mvsas: always iounmap resources Johannes Thumshirn
2015-06-12  6:31 ` Hannes Reinecke
2015-06-22  7:43   ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox