Skip to content

Commit 308aa2b

Browse files
Steve Wisejgunthorpe
authored andcommitted
iw_cxgb4: only allow 1 flush on user qps
Once the qp has been flushed, it cannot be flushed again. The user qp flush logic wasn't enforcing it however. The bug can cause touch-after-free crashes like: Unable to handle kernel paging request for data at address 0x000001ec Faulting instruction address: 0xc008000016069100 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [c008000016069100] flush_qp+0x80/0x480 [iw_cxgb4] LR [c00800001606cd6c] c4iw_modify_qp+0x71c/0x11d0 [iw_cxgb4] Call Trace: [c00800001606cd6c] c4iw_modify_qp+0x71c/0x11d0 [iw_cxgb4] [c00800001606e868] c4iw_ib_modify_qp+0x118/0x200 [iw_cxgb4] [c0080000119eae80] ib_security_modify_qp+0xd0/0x3d0 [ib_core] [c0080000119c4e24] ib_modify_qp+0xc4/0x2c0 [ib_core] [c008000011df0284] iwcm_modify_qp_err+0x44/0x70 [iw_cm] [c008000011df0fec] destroy_cm_id+0xcc/0x370 [iw_cm] [c008000011ed4358] rdma_destroy_id+0x3c8/0x520 [rdma_cm] [c0080000134b0540] ucma_close+0x90/0x1b0 [rdma_ucm] [c000000000444da4] __fput+0xe4/0x2f0 So fix flush_qp() to only flush the wq once. Cc: [email protected] Signed-off-by: Steve Wise <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent e4ff3d2 commit 308aa2b

File tree

1 file changed

+6
-0
lines changed
  • drivers/infiniband/hw/cxgb4

1 file changed

+6
-0
lines changed

drivers/infiniband/hw/cxgb4/qp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,12 @@ static void flush_qp(struct c4iw_qp *qhp)
16851685
schp = to_c4iw_cq(qhp->ibqp.send_cq);
16861686

16871687
if (qhp->ibqp.uobject) {
1688+
1689+
/* for user qps, qhp->wq.flushed is protected by qhp->mutex */
1690+
if (qhp->wq.flushed)
1691+
return;
1692+
1693+
qhp->wq.flushed = 1;
16881694
t4_set_wq_in_error(&qhp->wq, 0);
16891695
t4_set_cq_in_error(&rchp->cq);
16901696
spin_lock_irqsave(&rchp->comp_handler_lock, flag);

0 commit comments

Comments
 (0)