linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
@ 2019-04-19 15:37 Greg Kurz
  2019-04-26  7:50 ` Alexey Kardashevskiy
  2019-05-06 21:58 ` Alex Williamson
  0 siblings, 2 replies; 6+ messages in thread
From: Greg Kurz @ 2019-04-19 15:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: linuxppc-dev, Michael Ellerman, Alexey Kardashevskiy, Alex Williamson

If vfio_pci_register_dev_region() fails then we should rollback
previous changes, ie. unmap the ATSD registers.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
index 32f695ffe128..50fe3c4f7feb 100644
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
 	return 0;
 
 free_exit:
+	if (data->base)
+		memunmap(data->base);
 	kfree(data);
 
 	return ret;


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

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
  2019-04-19 15:37 [PATCH] vfio-pci/nvlink2: Fix potential VMA leak Greg Kurz
@ 2019-04-26  7:50 ` Alexey Kardashevskiy
  2019-05-06 21:58 ` Alex Williamson
  1 sibling, 0 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2019-04-26  7:50 UTC (permalink / raw)
  To: Greg Kurz, linux-kernel; +Cc: linuxppc-dev, Michael Ellerman, Alex Williamson



On 20/04/2019 01:37, Greg Kurz wrote:
> If vfio_pci_register_dev_region() fails then we should rollback
> previous changes, ie. unmap the ATSD registers.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> index 32f695ffe128..50fe3c4f7feb 100644
> --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> @@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
>  	return 0;
>  
>  free_exit:
> +	if (data->base)
> +		memunmap(data->base);
>  	kfree(data);
>  
>  	return ret;
> 

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>


-- 
Alexey

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

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
  2019-04-19 15:37 [PATCH] vfio-pci/nvlink2: Fix potential VMA leak Greg Kurz
  2019-04-26  7:50 ` Alexey Kardashevskiy
@ 2019-05-06 21:58 ` Alex Williamson
  2019-05-07  1:52   ` Sam Bobroff
  1 sibling, 1 reply; 6+ messages in thread
From: Alex Williamson @ 2019-05-06 21:58 UTC (permalink / raw)
  To: Greg Kurz
  Cc: linux-kernel, linuxppc-dev, Michael Ellerman, Alexey Kardashevskiy

On Fri, 19 Apr 2019 17:37:17 +0200
Greg Kurz <groug@kaod.org> wrote:

> If vfio_pci_register_dev_region() fails then we should rollback
> previous changes, ie. unmap the ATSD registers.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---

Applied to vfio next branch for v5.2 with Alexey's R-b.  Thanks!

Alex

>  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> index 32f695ffe128..50fe3c4f7feb 100644
> --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> @@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
>  	return 0;
>  
>  free_exit:
> +	if (data->base)
> +		memunmap(data->base);
>  	kfree(data);
>  
>  	return ret;
> 


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

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
  2019-05-06 21:58 ` Alex Williamson
@ 2019-05-07  1:52   ` Sam Bobroff
  2019-05-07  7:01     ` Greg Kurz
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Bobroff @ 2019-05-07  1:52 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Greg Kurz, Alexey Kardashevskiy, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

On Mon, May 06, 2019 at 03:58:45PM -0600, Alex Williamson wrote:
> On Fri, 19 Apr 2019 17:37:17 +0200
> Greg Kurz <groug@kaod.org> wrote:
> 
> > If vfio_pci_register_dev_region() fails then we should rollback
> > previous changes, ie. unmap the ATSD registers.
> > 
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> 
> Applied to vfio next branch for v5.2 with Alexey's R-b.  Thanks!
> 
> Alex

Should this have a fixes tag? e.g.:
Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")

> >  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > index 32f695ffe128..50fe3c4f7feb 100644
> > --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> > +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > @@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
> >  	return 0;
> >  
> >  free_exit:
> > +	if (data->base)
> > +		memunmap(data->base);
> >  	kfree(data);
> >  
> >  	return ret;
> > 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
  2019-05-07  1:52   ` Sam Bobroff
@ 2019-05-07  7:01     ` Greg Kurz
  2019-05-07 17:25       ` Alex Williamson
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kurz @ 2019-05-07  7:01 UTC (permalink / raw)
  To: Sam Bobroff
  Cc: Alex Williamson, Alexey Kardashevskiy, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

On Tue, 7 May 2019 11:52:44 +1000
Sam Bobroff <sbobroff@linux.ibm.com> wrote:

> On Mon, May 06, 2019 at 03:58:45PM -0600, Alex Williamson wrote:
> > On Fri, 19 Apr 2019 17:37:17 +0200
> > Greg Kurz <groug@kaod.org> wrote:
> >   
> > > If vfio_pci_register_dev_region() fails then we should rollback
> > > previous changes, ie. unmap the ATSD registers.
> > > 
> > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > ---  
> > 
> > Applied to vfio next branch for v5.2 with Alexey's R-b.  Thanks!
> > 
> > Alex  
> 
> Should this have a fixes tag? e.g.:
> Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")
> 

Oops... you're right.

Alex, can you add the above tag ?

> > >  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > index 32f695ffe128..50fe3c4f7feb 100644
> > > --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > > @@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
> > >  	return 0;
> > >  
> > >  free_exit:
> > > +	if (data->base)
> > > +		memunmap(data->base);
> > >  	kfree(data);
> > >  
> > >  	return ret;
> > >   
> >   


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
  2019-05-07  7:01     ` Greg Kurz
@ 2019-05-07 17:25       ` Alex Williamson
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2019-05-07 17:25 UTC (permalink / raw)
  To: Greg Kurz; +Cc: Sam Bobroff, Alexey Kardashevskiy, linuxppc-dev, linux-kernel

On Tue, 7 May 2019 09:01:45 +0200
Greg Kurz <groug@kaod.org> wrote:

> On Tue, 7 May 2019 11:52:44 +1000
> Sam Bobroff <sbobroff@linux.ibm.com> wrote:
> 
> > On Mon, May 06, 2019 at 03:58:45PM -0600, Alex Williamson wrote:  
> > > On Fri, 19 Apr 2019 17:37:17 +0200
> > > Greg Kurz <groug@kaod.org> wrote:
> > >     
> > > > If vfio_pci_register_dev_region() fails then we should rollback
> > > > previous changes, ie. unmap the ATSD registers.
> > > > 
> > > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > > ---    
> > > 
> > > Applied to vfio next branch for v5.2 with Alexey's R-b.  Thanks!
> > > 
> > > Alex    
> > 
> > Should this have a fixes tag? e.g.:
> > Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")
> >   
> 
> Oops... you're right.
> 
> Alex, can you add the above tag ?

Added.  Thanks,

Alex

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

end of thread, other threads:[~2019-05-07 17:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 15:37 [PATCH] vfio-pci/nvlink2: Fix potential VMA leak Greg Kurz
2019-04-26  7:50 ` Alexey Kardashevskiy
2019-05-06 21:58 ` Alex Williamson
2019-05-07  1:52   ` Sam Bobroff
2019-05-07  7:01     ` Greg Kurz
2019-05-07 17:25       ` Alex Williamson

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