Skip to contentSkip to conversation

IB/cm: Drop lockdep assert and WARN when freeing old msg

PATCH Applied Leon Romanovsky 1 participant 2 messages Apr 28, 2025 – May 5, 2025 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/cm: Drop lockdep assert and WARN when freeing old msg

From: Vlad Dumitrescu <[email protected]>

The send completion handler can run after cm_id has advanced to another message. The cm_id lock is not needed in this case, but a recent change re-used cm_free_priv_msg(), which asserts that the lock is held and WARNs if the cm_id's currently outstanding msg is different than the one being freed.

Fixes 1e5159219076 ("IB/cm: Do not hold reference on cm_id unless needed")
---
 drivers/infiniband/core/cm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/cm.c +2 -1
index effa53dd6800..e64cbd034a2a 100644
@@ -3786,7 +3786,8 @@ static void cm_process_send_error(struct cm_id_private *cm_id_priv,
 	spin_lock_irq(&cm_id_priv->lock);
 	if (msg != cm_id_priv->msg) {
 		spin_unlock_irq(&cm_id_priv->lock);
-		cm_free_priv_msg(msg);
+		cm_free_msg(msg);
+		cm_deref_id(cm_id_priv);
 		return;
 	}
 	cm_free_priv_msg(msg);
Signature · 1 line
2.49.0
author Applied
#1 lore raw
Quoted 8 lines · Leon Romanovsky

The send completion handler can run after cm_id has advanced to another message. The cm_id lock is not needed in this case, but a recent change re-used cm_free_priv_msg(), which asserts that the lock is held and WARNs if the cm_id's currently outstanding msg is different than the one being freed.

[...]

Applied, thanks!

[1/1] IB/cm: Drop lockdep assert and WARN when freeing old msg

      https://git.kernel.org/rdma/rdma/c/7590649ee7af38

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>