lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 2 Dec 2022 16:05:19 +0000
From:   Dmitry Safonov <dima@...sta.com>
To:     Eric Dumazet <edumazet@...gle.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     netdev@...r.kernel.org, eric.dumazet@...il.com,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH net-next] tcp: use 2-arg optimal variant of kfree_rcu()

On 12/2/22 05:28, Eric Dumazet wrote:
> kfree_rcu(1-arg) should be avoided as much as possible,
> since this is only possible from sleepable contexts,
> and incurr extra rcu barriers.
> 
> I wish the 1-arg variant of kfree_rcu() would
> get a distinct name, like kfree_rcu_slow()
> to avoid it being abused.

Thanks again!

> Fixes: 459837b522f7 ("net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Dmitry Safonov <dima@...sta.com>
> Cc: Paul E. McKenney <paulmck@...nel.org>

Reviewed-by: Dmitry Safonov <dima@...sta.com>

> ---
>  net/ipv4/tcp_ipv4.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 7fae586405cfb10011a0674289280bf400dfa8d8..8320d0ecb13ae1e3e259f3c13a4c2797fbd984a5 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -1245,7 +1245,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
>  
>  			md5sig = rcu_dereference_protected(tp->md5sig_info, lockdep_sock_is_held(sk));
>  			rcu_assign_pointer(tp->md5sig_info, NULL);
> -			kfree_rcu(md5sig);
> +			kfree_rcu(md5sig, rcu);
>  			return -EUSERS;
>  		}
>  	}
> @@ -1271,7 +1271,7 @@ int tcp_md5_key_copy(struct sock *sk, const union tcp_md5_addr *addr,
>  			md5sig = rcu_dereference_protected(tp->md5sig_info, lockdep_sock_is_held(sk));
>  			net_warn_ratelimited("Too many TCP-MD5 keys in the system\n");
>  			rcu_assign_pointer(tp->md5sig_info, NULL);
> -			kfree_rcu(md5sig);
> +			kfree_rcu(md5sig, rcu);
>  			return -EUSERS;
>  		}
>  	}

-- 
          Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ