diff options
author | David Ahern <dsahern@kernel.org> | 2021-06-12 18:24:59 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-14 12:30:53 -0700 |
commit | b87b04f5019e821c8c6c7761f258402e43500a1f (patch) | |
tree | 2ed3760e3200588d63e10f077eb4ea6db37a4bf5 /kernel/trace/trace_stack.c | |
parent | 58af3d3d54e87bfc1f936e16c04ade3369d34011 (diff) |
ipv4: Fix device used for dst_alloc with local routes
Oliver reported a use case where deleting a VRF device can hang
waiting for the refcnt to drop to 0. The root cause is that the dst
is allocated against the VRF device but cached on the loopback
device.
The use case (added to the selftests) has an implicit VRF crossing
due to the ordering of the FIB rules (lookup local is before the
l3mdev rule, but the problem occurs even if the FIB rules are
re-ordered with local after l3mdev because the VRF table does not
have a default route to terminate the lookup). The end result is
is that the FIB lookup returns the loopback device as the nexthop,
but the ingress device is in a VRF. The mismatch causes the dst
alloc against the VRF device but then cached on the loopback.
The fix is to bring the trick used for IPv6 (see ip6_rt_get_dev_rcu):
pick the dst alloc device based the fib lookup result but with checks
that the result has a nexthop device (e.g., not an unreachable or
prohibit entry).
Fixes: f5a0aab84b74 ("net: ipv4: dst for local input routes should use l3mdev if relevant")
Reported-by: Oliver Herms <oliver.peter.herms@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/trace/trace_stack.c')
0 files changed, 0 insertions, 0 deletions