]> git.itanic.dy.fi Git - linux-stable/commitdiff
fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 May 2019 09:07:29 +0000 (11:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 16:50:20 +0000 (18:50 +0200)
When commit e9919a24d302 ("fib_rules: return 0 directly if an exactly
same rule exists when NLM_F_EXCL not supplied") was backported to 4.9.y,
it changed the logic a bit as err should have been reset before exiting
the test, like it happens in the original logic.

If this is not set, errors happen :(

Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: David Ahern <dsahern@gmail.com>
Reported-by: Florian Westphal <fw@strlen.de>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/fib_rules.c

index 5229d1cf51fd3a1948e5d9bc8b7ba83b6778283e..b08c69730a72a7892c556aa53663a033bc5a402e 100644 (file)
@@ -564,6 +564,7 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
        }
 
        if (rule_exists(ops, frh, tb, rule)) {
+               err = 0;
                if (nlh->nlmsg_flags & NLM_F_EXCL)
                        err = -EEXIST;
                goto errout_free;