Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36ac344e authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso
Browse files

netfilter: expect: fix crash when putting uninited expectation



We crash in __nf_ct_expect_check, it calls nf_ct_remove_expect on the
uninitialised expectation instead of existing one, so del_timer chokes
on random memory address.

Fixes: ec0e3f01 ("netfilter: nf_ct_expect: Add nf_ct_remove_expect()")
Reported-by: default avatarSergey Kvachonok <ravenexp@gmail.com>
Tested-by: default avatarSergey Kvachonok <ravenexp@gmail.com>
Cc: Gao Feng <fgao@ikuai8.com>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 974292de
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;