mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Kyle Zeng <kylebot@openai.com>
Cc: netdev@vger.kernel.org, Simon Horman <horms@verge.net.au>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org, lvs-devel@vger.kernel.org,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] ipvs: reject invalid states in connection template sync records
Date: Tue, 11 Aug 2026 20:10:08 +0300 (EEST)	[thread overview]
Message-ID: <475e1a29-960d-2a50-7dfd-52d89c535ad7@ssi.bg> (raw)
In-Reply-To: <20260810221034.33751-1-kylebot@openai.com>


	Hello,

On Mon, 10 Aug 2026, Kyle Zeng wrote:

> IPVS sync receivers validate protocol states before creating or updating a
> connection. For connection templates, however, they only log states outside
> the template state range and still store the value in the connection.
> 
> A template can be returned by ordinary connection lookup. TCP and SCTP then
> use the invalid state as an index into their transition tables.

	I guess, this is possible again due to sync. I'll
provide fix for this problem.

> 
> Reject invalid template states in both sync protocol versions before
> looking up or modifying a connection. The version 1 path handles both
> IPv4 and IPv6 records.
> 
> Fixes: 275411430f89 ("ipvs: add assured state for conn templates")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Kyle Zeng <kylebot@openai.com>

	Looks good to me for the nf tree, thanks! Next time use
"nf" or "nf-next" tags for IPVS patches.

Acked-by: Julian Anastasov <ja@ssi.bg>

> 
> diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
> index 93038ab..6f0c2a4 100644
> --- a/net/netfilter/ipvs/ip_vs_sync.c
> +++ b/net/netfilter/ipvs/ip_vs_sync.c
> @@ -1002,10 +1002,10 @@ static void ip_vs_process_message_v0(struct netns_ipvs *ipvs, const char *buffer
>  					pp->name, state);
>  				continue;
>  			}
> -		} else {
> -			if (state >= IP_VS_CTPL_S_LAST)
> -				IP_VS_DBG(7, "BACKUP v0, Invalid tpl state %u\n",
> -					  state);
> +		} else if (state >= IP_VS_CTPL_S_LAST) {
> +			IP_VS_DBG(7, "BACKUP v0, Invalid tpl state %u\n",
> +				  state);
> +			continue;
>  		}
>  
>  		ip_vs_conn_fill_param(ipvs, AF_INET, s->protocol,
> @@ -1162,10 +1162,10 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  			retc = 40;
>  			goto out;
>  		}
> -	} else {
> -		if (state >= IP_VS_CTPL_S_LAST)
> -			IP_VS_DBG(7, "BACKUP, Invalid tpl state %u\n",
> -				  state);
> +	} else if (state >= IP_VS_CTPL_S_LAST) {
> +		IP_VS_DBG(7, "BACKUP, Invalid tpl state %u\n", state);
> +		retc = 40;
> +		goto out;
>  	}
>  	if (ip_vs_conn_fill_param_sync(ipvs, af, s, &param, pe_data,
>  				       pe_data_len, pe_name, pe_name_len)) {
> -- 
> 2.53.0

Regards

--
Julian Anastasov <ja@ssi.bg>


      reply	other threads:[~2026-08-11 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 22:10 Kyle Zeng
2026-08-11 17:10 ` Julian Anastasov [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=475e1a29-960d-2a50-7dfd-52d89c535ad7@ssi.bg \
    --to=ja@ssi.bg \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=horms@verge.net.au \
    --cc=kylebot@openai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=stable@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

all inboxes | Powered by JetHome®