Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e413a823 authored by Steve Wise's avatar Steve Wise Committed by Roland Dreier
Browse files

RDMA/iwcm: Don't touch cmid after dropping reference



The function cm_work_handler() cannot touch the cm_id after it derefs
it, because it might be freed on another concurrent thread.  If there
are more work items queued for this cm_id, then we know there must be
more references because they are added when the work items are queued.
So in the while loop inside cm_work_handler(), after derefing, if the
queue is empty, then exit the function.  Otherwise we know it's safe
to re-acquire the lock.

Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent cc529c0d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -878,6 +878,8 @@ static void cm_work_handler(struct work_struct *_work)
			}
			return;
		}
		if (empty)
			return;
		spin_lock_irqsave(&cm_id_priv->lock, flags);
	}
	spin_unlock_irqrestore(&cm_id_priv->lock, flags);