All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Hui Peng <benquike@gmail.com>
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfrm: validate protocol for XFRM_MODE_ROUTEOPTIMIZATION in verify_newsa_info()
Date: Mon, 21 Sep 2026 17:24:54 +0200	[thread overview]
Message-ID: <arFMRlQvfjkzHU64@krikkit> (raw)
In-Reply-To: <20260919215239.3471352-1-benquike@gmail.com>

2026-09-19, 21:52:39 +0000, Hui Peng wrote:
> In verify_newsa_info(), XFRM_MODE_ROUTEOPTIMIZATION skips the protocol
> switch validation, allowing IPPROTO_ESP, IPPROTO_AH, or IPPROTO_COMP states
> to be created with XFRM_MODE_ROUTEOPTIMIZATION even though only
> IPPROTO_DSTOPTS and IPPROTO_ROUTING are valid IPv6 route optimization
> protocols. Enforce that XFRM_MODE_ROUTEOPTIMIZATION is only used with
> AF_INET6 and IPPROTO_DSTOPTS or IPPROTO_ROUTING.

That's really not what this patch does...

> Fixes: 060f02a3bdd4 ("[XFRM] STATE: Introduce care-of address.")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
> diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> index a2587c7e796b..2be800232847 100644
> --- a/net/xfrm/xfrm_user.c
> +++ b/net/xfrm/xfrm_user.c
> @@ -698,7 +705,9 @@ static int attach_auth_trunc(struct xfrm_algo_auth **algpp, u8 *props,
>  		NL_SET_ERR_MSG(extack, "Requested AUTH_TRUNC algorithm not found");
>  		return -ENOSYS;
>  	}
> -	if (ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits) {
> +	if (ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits ||
> +	    (ualg->alg_trunc_len & 7) ||
> +	    (ualg->alg_trunc_len > 0 && ualg->alg_trunc_len < 32)) {
>  		NL_SET_ERR_MSG(extack, "Invalid length requested for truncated ICV");
>  		return -EINVAL;
>  	}
> 

-- 
Sabrina

      reply	other threads:[~2026-09-21 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 21:52 [PATCH] xfrm: validate protocol for XFRM_MODE_ROUTEOPTIMIZATION in verify_newsa_info() Hui Peng
2026-09-21 15:24 ` Sabrina Dubroca [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=arFMRlQvfjkzHU64@krikkit \
    --to=sd@queasysnail.net \
    --cc=benquike@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.