]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: Do not leak throw route references
authorSerhey Popovych <serhe.popovych@gmail.com>
Tue, 20 Jun 2017 10:29:25 +0000 (13:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jun 2017 19:34:02 +0000 (15:34 -0400)
commit029a3674c8bb5457d5e43b50cd47eadf6f326318
tree9b01c1d01c47a7a48ad18063217bb6ebd3fa68cb
parentb5c3d150c3e8a9f2b11a04e5514417cd5c522636
ipv6: Do not leak throw route references

While commit 45bbc2f8f807 ("ipv6: fix backtracking for throw routes")
does good job on error propagation to the fib_rules_lookup()
in fib rules core framework that also corrects throw routes
handling, it does not solve route reference leakage problem
happened when we return -EAGAIN to the fib_rules_lookup()
and leave routing table entry referenced in arg->result.

If rule with matched throw route isn't last matched in the
list we overwrite arg->result losing reference on throw
route stored previously forever.

We also partially revert commit ae4bd0b538b5 ("ipv6: fix the
incorrect return value of throw route") since we never return
routing table entry with dst.error == -EAGAIN when
CONFIG_IPV6_MULTIPLE_TABLES is on. Also there is no point
to check for RTF_REJECT flag since it is always set throw
route.

Fixes: 45bbc2f8f807 ("ipv6: fix backtracking for throw routes")
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/fib6_rules.c
net/ipv6/ip6_fib.c