Patch "RDMA/efa: Fix wrong resources deallocation order" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/efa: Fix wrong resources deallocation order

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-efa-fix-wrong-resources-deallocation-order.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 89ba5d2ef718c71f3799291b5f0805b230a8a121
Author: Yonatan Nachum <ynachum@xxxxxxxxxx>
Date:   Tue Aug 22 08:27:25 2023 +0000

    RDMA/efa: Fix wrong resources deallocation order
    
    [ Upstream commit dc202c57e9a1423aed528e4b8dc949509cd32191 ]
    
    When trying to destroy QP or CQ, we first decrease the refcount and
    potentially free memory regions allocated for the object and then
    request the device to destroy the object. If the device fails, the
    object isn't fully destroyed so the user/IB core can try to destroy the
    object again which will lead to underflow when trying to decrease an
    already zeroed refcount.
    
    Deallocate resources in reverse order of allocating them to safely free
    them.
    
    Fixes: ff6629f88c52 ("RDMA/efa: Do not delay freeing of DMA pages")
    Reviewed-by: Michael Margolin <mrgolin@xxxxxxxxxx>
    Reviewed-by: Yossi Leybovich <sleybo@xxxxxxxxxx>
    Signed-off-by: Yonatan Nachum <ynachum@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230822082725.31719-1-ynachum@xxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 2a195c4b0f17d..3538d59521e41 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -449,12 +449,12 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 
 	ibdev_dbg(&dev->ibdev, "Destroy qp[%u]\n", ibqp->qp_num);
 
-	efa_qp_user_mmap_entries_remove(qp);
-
 	err = efa_destroy_qp_handle(dev, qp->qp_handle);
 	if (err)
 		return err;
 
+	efa_qp_user_mmap_entries_remove(qp);
+
 	if (qp->rq_cpu_addr) {
 		ibdev_dbg(&dev->ibdev,
 			  "qp->cpu_addr[0x%p] freed: size[%lu], dma[%pad]\n",
@@ -1013,8 +1013,8 @@ int efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
 		  "Destroy cq[%d] virt[0x%p] freed: size[%lu], dma[%pad]\n",
 		  cq->cq_idx, cq->cpu_addr, cq->size, &cq->dma_addr);
 
-	efa_cq_user_mmap_entries_remove(cq);
 	efa_destroy_cq_idx(dev, cq->cq_idx);
+	efa_cq_user_mmap_entries_remove(cq);
 	if (cq->eq) {
 		xa_erase(&dev->cqs_xa, cq->cq_idx);
 		synchronize_irq(cq->eq->irq.irqn);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux