Skip to content

Commit 62fab6e

Browse files
q2venkuba-moo
authored andcommitted
geneve: Suppress list corruption splat in geneve_destroy_tunnels().
As explained in the previous patch, iterating for_each_netdev() and gn->geneve_list during ->exit_batch_rtnl() could trigger ->dellink() twice for the same device. If CONFIG_DEBUG_LIST is enabled, we will see a list_del() corruption splat in the 2nd call of geneve_dellink(). Let's remove for_each_netdev() in geneve_destroy_tunnels() and delegate that part to default_device_exit_batch(). Fixes: 9593172 ("geneve: Fix use-after-free in geneve_find_dev().") Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4ccacf8 commit 62fab6e

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

drivers/net/geneve.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,14 +1902,7 @@ static void geneve_destroy_tunnels(struct net *net, struct list_head *head)
19021902
{
19031903
struct geneve_net *gn = net_generic(net, geneve_net_id);
19041904
struct geneve_dev *geneve, *next;
1905-
struct net_device *dev, *aux;
19061905

1907-
/* gather any geneve devices that were moved into this ns */
1908-
for_each_netdev_safe(net, dev, aux)
1909-
if (dev->rtnl_link_ops == &geneve_link_ops)
1910-
geneve_dellink(dev, head);
1911-
1912-
/* now gather any other geneve devices that were created in this ns */
19131906
list_for_each_entry_safe(geneve, next, &gn->geneve_list, next)
19141907
geneve_dellink(geneve->dev, head);
19151908
}

0 commit comments

Comments
 (0)