Skip to contentSkip to conversation

netfilter: nf_ct_expect: fix expect removal

PATCH In review Jiri Slaby 2 participants 2 messages Jul 17, 2017

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 netfilter: nf_ct_expect: fix expect removal

Commit ec0e3f01114a ("netfilter: nf_ct_expect: Add nf_ct_remove_expect()") introduced a helper nf_ct_remove_expect. It was used over the code, but one location used a wrong variable and it resulted in a crash in this call stack:
-> nf_ct_expect_related_report
-> nf_ct_remove_expect
-> del_timer
-> detach_if_pending

Switch to the proper variable.

Fixes ec0e3f01114a
Cc Gao Feng <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Cc Jozsef Kadlecsik <[email protected]>
Cc Florian Westphal <[email protected]>
---
 net/netfilter/nf_conntrack_expect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_expect.c +1 -1
index e03d16ed550d..899c2c36da13 100644
@@ -422,7 +422,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
 	h = nf_ct_expect_dst_hash(net, &expect->tuple);
 	hlist_for_each_entry_safe(i, next, &nf_ct_expect_hash[h], hnode) {
 		if (expect_matches(i, expect)) {
-			if (nf_ct_remove_expect(expect))
+			if (nf_ct_remove_expect(i))
 				break;
 		} else if (expect_clash(i, expect)) {
 			ret = -EBUSY;
Signature · 1 line
2.13.3
#1 lore raw

Hi Jiri,

Quoted 9 lines · Jiri Slaby

Commit ec0e3f01114a ("netfilter: nf_ct_expect: Add nf_ct_remove_expect()") introduced a helper nf_ct_remove_expect. It was used over the code, but one location used a wrong variable and it resulted in a crash in this call stack:
-> nf_ct_expect_related_report
-> nf_ct_remove_expect
-> del_timer
-> detach_if_pending

Quoted 4 lines

Switch to the proper variable.

Fixes ec0e3f01114a

I have pushed out a similar fix from Florian:

https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git/commit/?id=36ac344e16e04e3e55e8fed7446095a6458c64e6

Thanks for the fix anyway.