summaryrefslogtreecommitdiff
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-20 09:07:29 (GMT)
committer Greg Kroah-Hartman <gregkh@google.com>2019-05-20 09:17:36 (GMT)
commitb2fc35160871b97f132c8bd00b65558c93529be8 (patch)
tree0ab0c0b4ee308c6401840a41accf8a07e5db3dd7
parent9e74c1b9e8418aa0209b15db24f0b3d4876f52aa (diff)
downloadcommon-b2fc35160871b97f132c8bd00b65558c93529be8.zip
common-b2fc35160871b97f132c8bd00b65558c93529be8.tar.gz
common-b2fc35160871b97f132c8bd00b65558c93529be8.tar.bz2
UPSTREAM: fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")
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> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat
-rw-r--r--net/core/fib_rules.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 25c25e8..268e320 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -487,6 +487,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;