Skip to content

Commit d1de9a8

Browse files
committed
RDMA/cm: Add missing locking around id.state in cm_dup_req_handler
All accesses to id.state must be done under the spinlock. Fixes: a977049 ("[PATCH] IB: Add the kernel CM implementation") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent c206f8b commit d1de9a8

File tree

1 file changed

+5
-1
lines changed
  • drivers/infiniband/core

1 file changed

+5
-1
lines changed

drivers/infiniband/core/cm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,8 +1872,12 @@ static void cm_dup_req_handler(struct cm_work *work,
18721872
counter[CM_REQ_COUNTER]);
18731873

18741874
/* Quick state check to discard duplicate REQs. */
1875-
if (cm_id_priv->id.state == IB_CM_REQ_RCVD)
1875+
spin_lock_irq(&cm_id_priv->lock);
1876+
if (cm_id_priv->id.state == IB_CM_REQ_RCVD) {
1877+
spin_unlock_irq(&cm_id_priv->lock);
18761878
return;
1879+
}
1880+
spin_unlock_irq(&cm_id_priv->lock);
18771881

18781882
ret = cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg);
18791883
if (ret)

0 commit comments

Comments
 (0)