Commit 4970b42d authored by Hangbin Liu's avatar Hangbin Liu Committed by David S. Miller

Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"

This reverts commit e9919a24.

Nathan reported the new behaviour breaks Android, as Android just add
new rules and delete old ones.

If we return 0 without adding dup rules, Android will remove the new
added rules and causing system to soft-reboot.

Fixes: e9919a24 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")
Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reported-by: default avatarYaro Slav <yaro330@gmail.com>
Reported-by: default avatarMaciej Żenczykowski <zenczykowski@gmail.com>
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 930b9a05
......@@ -757,8 +757,8 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err)
goto errout;
if (rule_exists(ops, frh, tb, rule)) {
if (nlh->nlmsg_flags & NLM_F_EXCL)
if ((nlh->nlmsg_flags & NLM_F_EXCL) &&
rule_exists(ops, frh, tb, rule)) {
err = -EEXIST;
goto errout_free;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment