From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 5/5] netfilter: expect: fix crash when putting uninited expectation
Date: Tue, 18 Jul 2017 12:13:59 +0200 [thread overview]
Message-ID: <1500372839-6735-6-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1500372839-6735-1-git-send-email-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
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: ec0e3f01114ad32711243 ("netfilter: nf_ct_expect: Add nf_ct_remove_expect()")
Reported-by: Sergey Kvachonok <ravenexp@gmail.com>
Tested-by: Sergey Kvachonok <ravenexp@gmail.com>
Cc: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_conntrack_expect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index e03d16ed550d..899c2c36da13 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -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;
--
2.1.4
next prev parent reply other threads:[~2017-07-18 10:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 10:13 [PATCH 0/5] Netfilter fixes for net Pablo Neira Ayuso
2017-07-18 10:13 ` [PATCH 1/5] netfilter: nfnetlink: Improve input length sanitization in nfnetlink_rcv Pablo Neira Ayuso
2017-07-18 10:13 ` [PATCH 2/5] netfilter: remove old pre-netns era hook api Pablo Neira Ayuso
2017-07-18 10:13 ` [PATCH 3/5] netfilter: nat: fix src map lookup Pablo Neira Ayuso
2017-07-18 10:13 ` [PATCH 4/5] netfilter: nf_tables: only allow in/output for arp packets Pablo Neira Ayuso
2017-07-18 10:13 ` Pablo Neira Ayuso [this message]
2017-07-18 19:03 ` [PATCH 0/5] Netfilter fixes for net David Miller
2017-07-18 21:11 ` Florian Westphal
2017-07-18 21:54 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500372839-6735-6-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).