Skip to content

Commit 8ecef78

Browse files
mustafakismailrleon
authored andcommitted
RDMA/irdma: Fix a window for use-after-free
During a destroy CQ an interrupt may cause processing of a CQE after CQ resources are freed by irdma_cq_free_rsrc(). Fix this by moving the call to irdma_cq_free_rsrc() after the irdma_sc_cleanup_ceqes(), which is called under the cq_lock. Fixes: b48c24c ("RDMA/irdma: Implement device supported verb APIs") Link: https://lore.kernel.org/r/20220705230815.265-6-shiraz.saleem@intel.com Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent c8c7c07 commit 8ecef78

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,11 +1776,11 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)
17761776
spin_unlock_irqrestore(&iwcq->lock, flags);
17771777

17781778
irdma_cq_wq_destroy(iwdev->rf, cq);
1779-
irdma_cq_free_rsrc(iwdev->rf, iwcq);
17801779

17811780
spin_lock_irqsave(&iwceq->ce_lock, flags);
17821781
irdma_sc_cleanup_ceqes(cq, ceq);
17831782
spin_unlock_irqrestore(&iwceq->ce_lock, flags);
1783+
irdma_cq_free_rsrc(iwdev->rf, iwcq);
17841784

17851785
return 0;
17861786
}

0 commit comments

Comments
 (0)