[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aGdw5abpBVdUIVt4@gauss3.secunet.de>
Date: Fri, 4 Jul 2025 08:12:53 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Haoxiang Li <haoxiang_li2024@....com>
CC: <herbert@...dor.apana.org.au>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<horms@...nel.org>, <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] af_key: Add check for the return value of
pfkey_sadb2xfrm_user_sec_ctx()
On Thu, Jul 03, 2025 at 05:16:46PM +0800, Haoxiang Li wrote:
> Add check for the return value of pfkey_sadb2xfrm_user_sec_ctx()
> to prevent potential errors.
>
> Signed-off-by: Haoxiang Li <haoxiang_li2024@....com>
> ---
> net/key/af_key.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/key/af_key.c b/net/key/af_key.c
> index efc2a91f4c48..e7318cea1f3a 100644
> --- a/net/key/af_key.c
> +++ b/net/key/af_key.c
> @@ -3335,6 +3335,9 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
> if ((*dir = verify_sec_ctx_len(p)))
> goto out;
> uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_ATOMIC);
> + if (!uctx)
> + goto out;
pfkey_sadb2xfrm_user_sec_ctx() does this check already.
Powered by blists - more mailing lists