[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+T6lIqdyWWhlXU9@hog>
Date: Thu, 9 Feb 2023 14:52:20 +0100
From: Sabrina Dubroca <sd@...asysnail.net>
To: Hyunwoo Kim <v4bel@...ori.io>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
steffen.klassert@...unet.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
imv4bel@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] af_key: Fix heap information leak
2023-02-09, 01:16:48 -0800, Hyunwoo Kim wrote:
> Since x->encap of pfkey_msg2xfrm_state() is not
> initialized to 0, kernel heap data can be leaked.
>
> Fix with kzalloc() to prevent this.
>
> Signed-off-by: Hyunwoo Kim <v4bel@...ori.io>
> Acked-by: Herbert Xu <herbert@...dor.apana.org.au>
Reviewed-by: Sabrina Dubroca <sd@...asysnail.net>
Thanks.
> ---
> net/key/af_key.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/key/af_key.c b/net/key/af_key.c
> index 2bdbcec781cd..a815f5ab4c49 100644
> --- a/net/key/af_key.c
> +++ b/net/key/af_key.c
> @@ -1261,7 +1261,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
> const struct sadb_x_nat_t_type* n_type;
> struct xfrm_encap_tmpl *natt;
>
> - x->encap = kmalloc(sizeof(*x->encap), GFP_KERNEL);
> + x->encap = kzalloc(sizeof(*x->encap), GFP_KERNEL);
> if (!x->encap) {
> err = -ENOMEM;
> goto out;
> --
> 2.25.1
>
--
Sabrina
Powered by blists - more mailing lists