Skip to contentSkip to conversation

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

PATCH Applied Hangbin Liu 3 participants 5 messages Jun 5, 2019 – Jun 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849.

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 e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")
---
 net/core/fib_rules.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/fib_rules.c +3 -3
index 43f0115cce9c..18f8dd8329ed 100644
@@ -757,9 +757,9 @@ 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)
-			err = -EEXIST;
+	if ((nlh->nlmsg_flags & NLM_F_EXCL) &&
+	    rule_exists(ops, frh, tb, rule)) {
+		err = -EEXIST;
 		goto errout_free;
 	}
 
Signature · 1 line
2.19.2
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hangbin Liu

This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849.

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 e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")

I verified a revert on my OP6 when I initially ran into this issue.

Thanks for this. I would recommend that Yaro and Maciej also be given reported by credit as I am not the only one to bring this up :)

Cheers,
Nathan

maintainer Applied
#2 lore raw
In reply to Hangbin Liu

From: Hangbin Liu <[email protected]>
Date: Wed, 5 Jun 2019 12:27:14 +0800

Quoted 11 lines

This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849.

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 e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")

Applied.

#3 lore raw
Quoted 8 lines · David Miller

From: Hangbin Liu <[email protected]>
Date: Wed, 5 Jun 2019 12:27:14 +0800

Quoted 5 lines

This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849.

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

Quoted 8 lines
Quoted 6 lines

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

Fixes e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")

Applied.

Please ensure this gets queued up for stable, as that is where I noticed the issue.

Thank you for applying it,
Nathan

maintainer
#4 lore raw

From: Nathan Chancellor <[email protected]>
Date: Wed, 5 Jun 2019 18:23:51 -0700

Quoted 12 lines · David Miller
Quoted 11 lines

From: Hangbin Liu <[email protected]>
Date: Wed, 5 Jun 2019 12:27:14 +0800

Quoted 8 lines

This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849.

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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Fixes e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied")

Applied.

Please ensure this gets queued up for stable, as that is where I noticed the issue.

It is queued up, thanks for asking.

I'll try to get this propagated as soon as possible.

Thanks again.