Skip to content

Commit

Permalink
RDMA/cm: Add missing locking around id.state in cm_dup_req_handler
Browse files Browse the repository at this point in the history
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/20200310092545.251365-10-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Jason Gunthorpe committed Mar 17, 2020
1 parent c206f8b commit d1de9a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1872,8 +1872,12 @@ static void cm_dup_req_handler(struct cm_work *work,
counter[CM_REQ_COUNTER]);

/* Quick state check to discard duplicate REQs. */
if (cm_id_priv->id.state == IB_CM_REQ_RCVD)
spin_lock_irq(&cm_id_priv->lock);
if (cm_id_priv->id.state == IB_CM_REQ_RCVD) {
spin_unlock_irq(&cm_id_priv->lock);
return;
}
spin_unlock_irq(&cm_id_priv->lock);

ret = cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg);
if (ret)
Expand Down

0 comments on commit d1de9a8

Please sign in to comment.