]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: fib6_rules should return exact return value
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Thu, 1 Aug 2013 06:54:47 +0000 (08:54 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Aug 2013 07:26:22 +0000 (00:26 -0700)
commit9f69f48322191c5feee4c99cc723450743e92928
tree79fe45a2dcc4055edddf87069ce278f3ce78176f
parent83b973126e7eb7d8056b44fdcaa86b8021abbdc1
ipv6: fib6_rules should return exact return value

With the addition of the suppress operation
(89128050fe8c7220241722fc4baa7128b1920f62 ("fib_rules: add .suppress
operation") we rely on accurate error reporting of the fib_rules.actions.

fib6_rule_action always returned -EAGAIN in case we could not find a
matching route and 0 if a rule was matched. This also included a match
for blackhole or prohibited rule actions which could get suppressed by
the new logic.

So adapt fib6_rule_action to always return the correct error code as
its counterpart fib4_rule_action does. This also fixes a possiblity of
nullptr-deref where we don't find a table, thus rt == NULL. Because
the condition rt != ip6_null_entry still holdes it seems we could later
get a nullptr bug on dereference rt->dst.

v2:
a) Fixed a brain fart in the commit msg (the rule => a table, etc). No
   changes to the patch.

Cc: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/fib6_rules.c