Commit d1de9a88 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

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: a977049d ("[PATCH] IB: Add the kernel CM implementation")
Link: https://lore.kernel.org/r/20200310092545.251365-10-leon@kernel.org


Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent c206f8ba
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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)