From: Greg Kroah-Hartman Date: Mon, 20 May 2019 09:07:29 +0000 (+0200) Subject: fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...") X-Git-Tag: v4.14.121~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=691306ebd18f945e44b4552a4bfcca3475e5d957;p=thirdparty%2Fkernel%2Fstable.git 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 Reported-by: David Ahern Reported-by: Florian Westphal Cc: Hangbin Liu Cc: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 5229d1cf51fd3..b08c69730a72a 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -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;