linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] netfilter: nf_ct_expect: fix expect removal
@ 2017-07-17 15:06 Jiri Slaby
  2017-07-17 15:17 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2017-07-17 15:06 UTC (permalink / raw)
  To: pablo
  Cc: linux-kernel, Jiri Slaby, Gao Feng, Jozsef Kadlecsik,
	Florian Westphal, netfilter-devel, coreteam

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
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Gao Feng <fgao@ikuai8.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Florian Westphal <fw@strlen.de>
Cc: <netfilter-devel@vger.kernel.org>
Cc: <coreteam@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.13.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] netfilter: nf_ct_expect: fix expect removal
  2017-07-17 15:06 [PATCH 1/1] netfilter: nf_ct_expect: fix expect removal Jiri Slaby
@ 2017-07-17 15:17 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-07-17 15:17 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Gao Feng, Jozsef Kadlecsik, Florian Westphal,
	netfilter-devel, coreteam

Hi Jiri,

On Mon, Jul 17, 2017 at 05:06:48PM +0200, Jiri Slaby wrote:
> 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
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-17 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 15:06 [PATCH 1/1] netfilter: nf_ct_expect: fix expect removal Jiri Slaby
2017-07-17 15:17 ` Pablo Neira Ayuso

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).