From: Phil Sutter <phil@nwl.cc>
To: Qi Tang <tpluszz77@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_conntrack_helper: pass helper to expect cleanup
Date: Tue, 31 Mar 2026 15:40:13 +0200 [thread overview]
Message-ID: <acvOvaiEBVA9kbvw@orbyte.nwl.cc> (raw)
In-Reply-To: <20260329165036.240932-1-tpluszz77@gmail.com>
On Mon, Mar 30, 2026 at 12:50:36AM +0800, Qi Tang wrote:
> nf_conntrack_helper_unregister() calls nf_ct_expect_iterate_destroy()
> to remove expectations belonging to the helper being unregistered.
> However, it passes NULL instead of the helper pointer as the data
> argument, so expect_iter_me() never matches any expectation and all
> of them survive the cleanup.
>
> After unregister returns, nfnl_cthelper_del() frees the helper
> object immediately. Subsequent expectation dumps or packet-driven
> init_conntrack() calls then dereference the freed exp->helper,
> causing a use-after-free.
>
> Pass the actual helper pointer so expectations referencing it are
> properly destroyed before the helper object is freed.
>
> BUG: KASAN: slab-use-after-free in string+0x38f/0x430
> Read of size 1 at addr ffff888003b14d20 by task poc/103
> Call Trace:
> string+0x38f/0x430
> vsnprintf+0x3cc/0x1170
> seq_printf+0x17a/0x240
> exp_seq_show+0x2e5/0x560
> seq_read_iter+0x419/0x1280
> proc_reg_read+0x1ac/0x270
> vfs_read+0x179/0x930
> ksys_read+0xef/0x1c0
> Freed by task 103:
> The buggy address is located 32 bytes inside of
> freed 192-byte region [ffff888003b14d00, ffff888003b14dc0)
>
> Fixes: ac7b84839003 ("netfilter: expect: add and use nf_ct_expect_iterate helpers")
> Signed-off-by: Qi Tang <tpluszz77@gmail.com>
Reviewed-by: Phil Sutter <phil@nwl.cc>
Thanks, Phil
prev parent reply other threads:[~2026-03-31 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 16:50 [PATCH] netfilter: nf_conntrack_helper: pass helper to expect cleanup Qi Tang
2026-03-31 13:40 ` Phil Sutter [this message]
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=acvOvaiEBVA9kbvw@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=coreteam@netfilter.org \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=tpluszz77@gmail.com \
/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