netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree
@ 2023-07-17  9:59 Wang Ming
  2023-07-17 18:29 ` Tariq Toukan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wang Ming @ 2023-07-17  9:59 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S. Miller, David Ahern,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: opensource.kernel, Wang Ming

key might contain private part of the key, so better use
kfree_sensitive to free it.

Fixes: 38320c70d282 ("[IPSEC]: Use crypto_aead and authenc in ESP")
Signed-off-by: Wang Ming <machel@vivo.com>
---
 net/ipv4/esp4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index ba06ed42e428..2be2d4922557 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -1132,7 +1132,7 @@ static int esp_init_authenc(struct xfrm_state *x,
 	err = crypto_aead_setkey(aead, key, keylen);
 
 free_key:
-	kfree(key);
+	kfree_sensitive(key);
 
 error:
 	return err;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree
  2023-07-17  9:59 [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree Wang Ming
@ 2023-07-17 18:29 ` Tariq Toukan
  2023-07-17 18:48 ` Kuniyuki Iwashima
  2023-07-19 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tariq Toukan @ 2023-07-17 18:29 UTC (permalink / raw)
  To: Wang Ming, Steffen Klassert, Herbert Xu, David S. Miller,
	David Ahern, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev,
	linux-kernel, Tariq Toukan
  Cc: opensource.kernel



On 17/07/2023 12:59, Wang Ming wrote:
> key might contain private part of the key, so better use
> kfree_sensitive to free it.
> 
> Fixes: 38320c70d282 ("[IPSEC]: Use crypto_aead and authenc in ESP")
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>   net/ipv4/esp4.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
> index ba06ed42e428..2be2d4922557 100644
> --- a/net/ipv4/esp4.c
> +++ b/net/ipv4/esp4.c
> @@ -1132,7 +1132,7 @@ static int esp_init_authenc(struct xfrm_state *x,
>   	err = crypto_aead_setkey(aead, key, keylen);
>   
>   free_key:
> -	kfree(key);
> +	kfree_sensitive(key);
>   
>   error:
>   	return err;

LGTM.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree
  2023-07-17  9:59 [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree Wang Ming
  2023-07-17 18:29 ` Tariq Toukan
@ 2023-07-17 18:48 ` Kuniyuki Iwashima
  2023-07-19 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2023-07-17 18:48 UTC (permalink / raw)
  To: machel
  Cc: davem, dsahern, edumazet, herbert, kuba, linux-kernel, netdev,
	opensource.kernel, pabeni, steffen.klassert, kuniyu

From: Wang Ming <machel@vivo.com>
Date: Mon, 17 Jul 2023 17:59:19 +0800
> key might contain private part of the key, so better use
> kfree_sensitive to free it.
> 
> Fixes: 38320c70d282 ("[IPSEC]: Use crypto_aead and authenc in ESP")
> Signed-off-by: Wang Ming <machel@vivo.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>


> ---
>  net/ipv4/esp4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
> index ba06ed42e428..2be2d4922557 100644
> --- a/net/ipv4/esp4.c
> +++ b/net/ipv4/esp4.c
> @@ -1132,7 +1132,7 @@ static int esp_init_authenc(struct xfrm_state *x,
>  	err = crypto_aead_setkey(aead, key, keylen);
>  
>  free_key:
> -	kfree(key);
> +	kfree_sensitive(key);
>  
>  error:
>  	return err;
> -- 
> 2.25.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree
  2023-07-17  9:59 [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree Wang Ming
  2023-07-17 18:29 ` Tariq Toukan
  2023-07-17 18:48 ` Kuniyuki Iwashima
@ 2023-07-19 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-19 10:10 UTC (permalink / raw)
  To: =?utf-8?b?546L5piOLei9r+S7tuW6leWxguaKgOacr+mDqCA8bWFjaGVsQHZpdm8uY29tPg==?=
  Cc: steffen.klassert, herbert, davem, dsahern, edumazet, kuba, pabeni,
	netdev, linux-kernel, opensource.kernel

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 17 Jul 2023 17:59:19 +0800 you wrote:
> key might contain private part of the key, so better use
> kfree_sensitive to free it.
> 
> Fixes: 38320c70d282 ("[IPSEC]: Use crypto_aead and authenc in ESP")
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>  net/ipv4/esp4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [net,v1] net: ipv4: Use kfree_sensitive instead of kfree
    https://git.kernel.org/netdev/net/c/daa751444fd9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-19 10:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17  9:59 [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree Wang Ming
2023-07-17 18:29 ` Tariq Toukan
2023-07-17 18:48 ` Kuniyuki Iwashima
2023-07-19 10:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).