Skip to content

Commit bf184dd

Browse files
ferasdgregkh
authored andcommitted
IB/ipoib: Replace list_del of the neigh->list with list_del_init
[ Upstream commit c586071d1dc8227a7182179b8e50ee92cc43f6d2 ] In order to resolve a situation where a few process delete the same list element in sequence and cause panic, list_del is replaced with list_del_init. In this case if the first process that calls list_del releases the lock before acquiring it again, other processes who can acquire the lock will call list_del_init. Fixes: b63b70d ("IPoIB: Use a private hash table for path lookup") Signed-off-by: Feras Daoud <ferasda@mellanox.com> Signed-off-by: Erez Shitrit <erezsh@mellanox.com> Reviewed-by: Alex Vesker <valex@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f1d53c6 commit bf184dd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/infiniband/ulp/ipoib/ipoib_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
12391239
rcu_dereference_protected(neigh->hnext,
12401240
lockdep_is_held(&priv->lock)));
12411241
/* remove from path/mc list */
1242-
list_del(&neigh->list);
1242+
list_del_init(&neigh->list);
12431243
call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
12441244
} else {
12451245
np = &neigh->hnext;
@@ -1406,7 +1406,7 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh)
14061406
rcu_dereference_protected(neigh->hnext,
14071407
lockdep_is_held(&priv->lock)));
14081408
/* remove from parent list */
1409-
list_del(&neigh->list);
1409+
list_del_init(&neigh->list);
14101410
call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
14111411
return;
14121412
} else {
@@ -1491,7 +1491,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
14911491
rcu_dereference_protected(neigh->hnext,
14921492
lockdep_is_held(&priv->lock)));
14931493
/* remove from parent list */
1494-
list_del(&neigh->list);
1494+
list_del_init(&neigh->list);
14951495
call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
14961496
} else {
14971497
np = &neigh->hnext;
@@ -1533,7 +1533,7 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv)
15331533
rcu_dereference_protected(neigh->hnext,
15341534
lockdep_is_held(&priv->lock)));
15351535
/* remove from path/mc list */
1536-
list_del(&neigh->list);
1536+
list_del_init(&neigh->list);
15371537
call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
15381538
}
15391539
}

0 commit comments

Comments
 (0)