diff mbox series

[for-rc] RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove

Message ID 20190403135254.31391-1-kamalheib1@gmail.com (mailing list archive)
State Mainlined
Commit ea7a5c706fa49273cf6d1d9def053ecb50db2076
Delegated to: Jason Gunthorpe
Headers show
Series [for-rc] RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove | expand

Commit Message

Kamal Heib April 3, 2019, 1:52 p.m. UTC
Make sure to free the DSR on pvrdma_pci_remove() to avoid the memory leak.

Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Adit Ranadive April 3, 2019, 5:31 p.m. UTC | #1
On 4/3/19 6:52 AM, Kamal Heib wrote:
> Make sure to free the DSR on pvrdma_pci_remove() to avoid the memory leak.
> 
> Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>

Oops! Thanks for the fix. Shouldn't this go to stable as well?

Acked-by: Adit Ranadive <aditr@vmware.com>

> ---
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
> index 6d8b3e0de57a..ec41400fec0c 100644
> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
> @@ -1131,6 +1131,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev)
>  	pvrdma_page_dir_cleanup(dev, &dev->cq_pdir);
>  	pvrdma_page_dir_cleanup(dev, &dev->async_pdir);
>  	pvrdma_free_slots(dev);
> +	dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr,
> +			  dev->dsrbase);
>  
>  	iounmap(dev->regs);
>  	kfree(dev->sgid_tbl);
>
Jason Gunthorpe April 3, 2019, 6:50 p.m. UTC | #2
On Wed, Apr 03, 2019 at 04:52:54PM +0300, Kamal Heib wrote:
> Make sure to free the DSR on pvrdma_pci_remove() to avoid the memory leak.
> 
> Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> Acked-by: Adit Ranadive <aditr@vmware.com>
> ---
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied to for-next, thanks

Jason
Kamal Heib April 7, 2019, 7:45 a.m. UTC | #3
On 4/3/19 9:50 PM, Jason Gunthorpe wrote:
> On Wed, Apr 03, 2019 at 04:52:54PM +0300, Kamal Heib wrote:
>> Make sure to free the DSR on pvrdma_pci_remove() to avoid the memory leak.
>>
>> Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
>> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>> Acked-by: Adit Ranadive <aditr@vmware.com>
>> ---
>>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 ++
>>  1 file changed, 2 insertions(+)
> 
> Applied to for-next, thanks
> 

Hi Jason,

for-rc?

Thanks,
Kamal

> Jason
>
Jason Gunthorpe April 8, 2019, 4:06 p.m. UTC | #4
On Sun, Apr 07, 2019 at 10:45:09AM +0300, Kamal Heib wrote:
> 
> 
> On 4/3/19 9:50 PM, Jason Gunthorpe wrote:
> > On Wed, Apr 03, 2019 at 04:52:54PM +0300, Kamal Heib wrote:
> >> Make sure to free the DSR on pvrdma_pci_remove() to avoid the memory leak.
> >>
> >> Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
> >> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> >> Acked-by: Adit Ranadive <aditr@vmware.com>
> >>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> > 
> > Applied to for-next, thanks
> > 
> 
> Hi Jason,
> 
> for-rc?

Hrm. Ok. 

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 6d8b3e0de57a..ec41400fec0c 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -1131,6 +1131,8 @@  static void pvrdma_pci_remove(struct pci_dev *pdev)
 	pvrdma_page_dir_cleanup(dev, &dev->cq_pdir);
 	pvrdma_page_dir_cleanup(dev, &dev->async_pdir);
 	pvrdma_free_slots(dev);
+	dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr,
+			  dev->dsrbase);
 
 	iounmap(dev->regs);
 	kfree(dev->sgid_tbl);