Netdev List
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
Cc: Julian Anastasov <ja@ssi.bg>, Simon Horman <horms@verge.net.au>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	netdev@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH nf v3] ipvs: ftp: do not link expectations to unconfirmed conntracks
Date: Mon, 16 Nov 2026 11:51:21 +0100	[thread overview]
Message-ID: <avrgKSO8nfTnv4iL@chamomile> (raw)
In-Reply-To: <20261116101506.98853-1-theodorlarionov@gmail.com>

On Mon, Nov 16, 2026 at 01:15:06PM +0300, Theodor Arsenij Larionov Trichkine wrote:
> ip_vs_ftp_out() can link an expectation to an unconfirmed conntrack. A
> later extension add on the same packet, such as seqadj in
> ip_vs_update_conntrack() or NAT, then reallocates ct->ext and leaves the
> expectation pointing into the freed area:
> 
>   BUG: KASAN: slab-use-after-free in nf_ct_unlink_expect_report+0x490/0x4c0
>   Write of size 8 at addr ffff888004dd4e48 by task syz.2.17/649
> 
> Link the expectation only to a confirmed conntrack.
> 
> Fixes: b25adce16064 ("ipvs: correct usage/allocation of seqadj ext in ipvs")
> Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Cc: stable@vger.kernel.org
> Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
> ---
> v3: skip unconfirmed conntracks, as suggested by Pablo; v2 did not
> cover NAT.
> v2: https://lore.kernel.org/netdev/20261113011447.2357709-8-pablo@netfilter.org/
> 
>  net/netfilter/ipvs/ip_vs_ftp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
> index 44de99f4d187..cb0cdc35a7c1 100644
> --- a/net/netfilter/ipvs/ip_vs_ftp.c
> +++ b/net/netfilter/ipvs/ip_vs_ftp.c
> @@ -398,8 +398,10 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
>  						   end - start,
>  						   buf, buf_len);
>  		if (mangled) {
> -			ip_vs_nfct_expect_related(skb, ct, n_cp,
> -						  ipvsh->protocol, 0, 0);
> +			if (nf_ct_is_confirmed(ct))

I think this is coming a bit late?

Maybe it is possible to check this earlier in this path?

> +				ip_vs_nfct_expect_related(skb, ct, n_cp,
> +							  ipvsh->protocol,
> +							  0, 0);
>  			if (skb->ip_summed == CHECKSUM_COMPLETE)
>  				skb->ip_summed = CHECKSUM_UNNECESSARY;
>  			/* csum is updated */
> -- 
> 2.34.1
> 

  reply	other threads:[~2026-11-16 10:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 10:15 [PATCH nf v3] ipvs: ftp: do not link expectations to unconfirmed conntracks Theodor Arsenij Larionov Trichkine
2026-11-16 10:51 ` Pablo Neira Ayuso [this message]
2026-11-16 11:05   ` Theodor Arsenij Larionov-Trichkine

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=avrgKSO8nfTnv4iL@chamomile \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    --cc=theodorlarionov@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