summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-20 12:07:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-21 19:50:20 +0300
commit691306ebd18f945e44b4552a4bfcca3475e5d957 (patch)
treef1ac4db5a6bf39ca4aee983887c918154beea143 /net
parent654a509d8e93755c64c28aa4d257a998e897e6b1 (diff)
downloadlinux-691306ebd18f945e44b4552a4bfcca3475e5d957.tar.xz
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>
Diffstat (limited to 'net')
-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 5229d1cf51fd..b08c69730a72 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;