Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 4d33ab0

Browse files
lxinPaolo Abeni
authored and
Paolo Abeni
committed
xfrm: set dst dev to blackhole_netdev instead of loopback_dev in ifdown
The global blackhole_netdev has replaced pernet loopback_dev to become the one given to the object that holds an netdev when ifdown in many places of ipv4 and ipv6 since commit 8d7017f ("blackhole_netdev: use blackhole_netdev to invalidate dst entries"). Especially after commit faab39f ("net: allow out-of-order netdev unregistration"), it's no longer safe to use loopback_dev that may be freed before other netdev. This patch is to set dst dev to blackhole_netdev instead of loopback_dev in ifdown. v1->v2: - add Fixes tag as Eric suggested. Fixes: faab39f ("net: allow out-of-order netdev unregistration") Signed-off-by: Xin Long <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/e8c87482998ca6fcdab214f5a9d582899ec0c648.1652665047.git.lucien.xin@gmail.com Signed-off-by: Paolo Abeni <[email protected]>
1 parent ef6b1cd commit 4d33ab0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/xfrm/xfrm_policy.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3744,7 +3744,7 @@ static int stale_bundle(struct dst_entry *dst)
37443744
void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
37453745
{
37463746
while ((dst = xfrm_dst_child(dst)) && dst->xfrm && dst->dev == dev) {
3747-
dst->dev = dev_net(dev)->loopback_dev;
3747+
dst->dev = blackhole_netdev;
37483748
dev_hold(dst->dev);
37493749
dev_put(dev);
37503750
}

0 commit comments

Comments
 (0)