Skip to contentSkip to conversation

netfilter: nf_ct_expect: nf_ct_expect_related_report(): Return zero on success.

PATCH Applied Jarno Rajahalme 2 participants 4 messages Feb 24, 2017 – Feb 25, 2017

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

PATCH 1/2 netfilter: nf_ct_expect: nf_ct_expect_related_report(): Return zero on success.

Commit 4dee62b1b9b4 ("netfilter: nf_ct_expect: nf_ct_expect_insert() returns void") inadvertently changed the successful return value of nf_ct_expect_related_report() from 0 to 1, which caused openvswitch conntrack integration fail in FTP test cases.

Fix this by always returning zero on the success code path.

Fixes 4dee62b1b9b4 ("netfilter: nf_ct_expect: nf_ct_expect_insert() returns void")
---
 net/netfilter/nf_conntrack_expect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_expect.c +1 -1
index e19a697..d6ace69 100644
@@ -467,7 +467,7 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
 
 	spin_unlock_bh(&nf_conntrack_expect_lock);
 	nf_ct_expect_event_report(IPEXP_NEW, expect, portid, report);
-	return ret;
+	return 0;
 out:
 	spin_unlock_bh(&nf_conntrack_expect_lock);
 	return ret;
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value.

Commit 4dee62b1b9b4 ("netfilter: nf_ct_expect: nf_ct_expect_insert() returns void") inadvertently changed the successful return value of nf_ct_expect_related_report() from 0 to 1 due to __nf_ct_expect_check() returning 1 on success. Prevent this regression in the future by changing the return value of __nf_ct_expect_check() to 0 on success.

---
 net/netfilter/nf_conntrack_expect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_expect.c +2 -2
index d6ace69..4b2e1fb 100644
@@ -410,7 +410,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
 	struct net *net = nf_ct_exp_net(expect);
 	struct hlist_node *next;
 	unsigned int h;
-	int ret = 1;
+	int ret = 0;
 
 	if (!master_help) {
 		ret = -ESHUTDOWN;
@@ -460,7 +460,7 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
 
 	spin_lock_bh(&nf_conntrack_expect_lock);
 	ret = __nf_ct_expect_check(expect);
-	if (ret <= 0)
+	if (ret < 0)
 		goto out;
 
 	nf_ct_expect_insert(expect);
Signature · 1 line
2.1.4
maintainer Applied
#2 lore raw

Re: [PATCH nf 2/2] netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value.

Quoted 6 lines · Jarno Rajahalme

Commit 4dee62b1b9b4 ("netfilter: nf_ct_expect: nf_ct_expect_insert() returns void") inadvertently changed the successful return value of nf_ct_expect_related_report() from 0 to 1 due to __nf_ct_expect_check() returning 1 on success. Prevent this regression in the future by changing the return value of __nf_ct_expect_check() to 0 on success.

We used to return 0 via __nf_ct_expect_check() in the past, not anymore for a while. So even if this doesn't fix anything, I'm fine with this change to prevent more sloppy updates on this code.

Applied, thanks.

maintainer Applied
#3 lore raw
In reply to Jarno Rajahalme
Quoted 6 lines · Jarno Rajahalme

Commit 4dee62b1b9b4 ("netfilter: nf_ct_expect: nf_ct_expect_insert() returns void") inadvertently changed the successful return value of nf_ct_expect_related_report() from 0 to 1, which caused openvswitch conntrack integration fail in FTP test cases.

Fix this by always returning zero on the success code path.

Applied, thanks Jarno.