IB/ipoib: Prevent hung task or softlockup processing multicast response

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Obtained from:	Linux commit 3874397c0bdec3c21ce071711cd105165179b8eb
Sponsored by:	Chelsio Communications
This commit is contained in:
John Baldwin committed 2026-06-22 14:36:53 -04:00
1 parent fbe76ea44c
commit 49ee94b291
3 files changed
+14 -8

No files matched your search

@@ -59,21 +59,24 @@ struct ipoib_ah *ipoib_create_ah(struct ipoib_dev_priv *priv,
struct ib_pd *pd, struct ib_ah_attr *attr)
{
struct ipoib_ah *ah;
struct ib_ah *vah;
ah = kmalloc(sizeof *ah, GFP_KERNEL);
if (!ah)
return NULL;
return ERR_PTR(-ENOMEM);
ah->priv = priv;
ah->last_send = 0;
kref_init(&ah->ref);
ah->ah = ib_create_ah(pd, attr, RDMA_CREATE_AH_SLEEPABLE);
if (IS_ERR(ah->ah)) {
vah = ib_create_ah(pd, attr, RDMA_CREATE_AH_SLEEPABLE);
if (IS_ERR(vah)) {
kfree(ah);
ah = NULL;
} else
ah = (struct ipoib_ah *)vah;
} else {
ah->ah = vah;
ipoib_dbg(priv, "Created ah %p\n", ah->ah);
}
return ah;
}
@@ -535,7 +535,7 @@ path_rec_completion(int status, struct ib_sa_path_rec *pathrec, void *path_ptr)
spin_lock_irqsave(&priv->lock, flags);
if (ah) {
if (!IS_ERR_OR_NULL(ah)) {
path->pathrec = *pathrec;
old_ah = path->ah;
@@ -211,8 +211,11 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
av.grh.dgid = mcast->mcmember.mgid;
ah = ipoib_create_ah(priv, priv->pd, &av);
if (!ah) {
ipoib_warn(priv, "ib_address_create failed\n");
if (IS_ERR(ah)) {
ipoib_warn(priv, "ib_address_create failed %ld\n",
-PTR_ERR(ah));
/* use original error */
return PTR_ERR(ah);
} else {
spin_lock_irq(&priv->lock);
mcast->ah = ah;