diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-09-24 16:01:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-05 13:13:14 +0200 |
commit | d37c966752043733eb847dd897d6e3405084c559 (patch) | |
tree | 59cc8b392de6c5a901f2d7b3f2540b87ec0f0943 /net | |
parent | 98f1a3a21500ad4fd8e9a24e0c7d8cfaf4ae56f2 (diff) | |
download | linux-stable-d37c966752043733eb847dd897d6e3405084c559.tar.gz linux-stable-d37c966752043733eb847dd897d6e3405084c559.tar.bz2 linux-stable-d37c966752043733eb847dd897d6e3405084c559.zip |
ipv6: do not free rt if FIB_LOOKUP_NOREF is set on suppress rule
[ Upstream commit ca7a03c4175366a92cee0ccc4fec0038c3266e26 ]
Commit 7d9e5f422150 removed references from certain dsts, but accounting
for this never translated down into the fib6 suppression code. This bug
was triggered by WireGuard users who use wg-quick(8), which uses the
"suppress-prefix" directive to ip-rule(8) for routing all of their
internet traffic without routing loops. The test case added here
causes the reference underflow by causing packets to evaluate a suppress
rule.
Fixes: 7d9e5f422150 ("ipv6: convert major tx path to use RT6_LOOKUP_F_DST_NOREF")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/fib6_rules.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index bcfae13409b5..67b60b1da922 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -285,7 +285,8 @@ static bool fib6_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg return false; suppress_route: - ip6_rt_put(rt); + if (!(arg->flags & FIB_LOOKUP_NOREF)) + ip6_rt_put(rt); return true; } |