RDMA/vmw_pvrdma: Call ib_umem_release on destroy QP path
authorBryan Tan <bryantan@vmware.com>
Wed, 20 Dec 2017 17:49:03 +0000 (09:49 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:29 +0000 (10:24 +0100)
[ Upstream commit 17748056ce123ee37fb7382bc698fc721e3c4a09 ]

The QP cleanup did not previously call ib_umem_release,
resulting in a user-triggerable kernel resource leak.

Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Reviewed-by: Adit Ranadive <aditr@vmware.com>
Reviewed-by: Aditya Sarwade <asarwade@vmware.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Bryan Tan <bryantan@vmware.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c

index ed34d5a581fa4cd9199664ff8f5610c6966982f6..d7162f2b7979ab5d912526d45003c8bcad40496d 100644 (file)
@@ -406,6 +406,13 @@ static void pvrdma_free_qp(struct pvrdma_qp *qp)
        atomic_dec(&qp->refcnt);
        wait_event(qp->wait, !atomic_read(&qp->refcnt));
 
+       if (!qp->is_kernel) {
+               if (qp->rumem)
+                       ib_umem_release(qp->rumem);
+               if (qp->sumem)
+                       ib_umem_release(qp->sumem);
+       }
+
        pvrdma_page_dir_cleanup(dev, &qp->pdir);
 
        kfree(qp);