Re: [PATCH RT v4.19] tcp: md5: Add a serialization in tcp MD5 hash functions.

From: Sebastian Andrzej Siewior
Date: Thu Jun 27 2024 - 02:53:24 EST


On 2024-06-21 12:49:32 [+0200], Sam Kappen wrote:

> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -93,6 +93,7 @@ static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
> __be32 daddr, __be32 saddr, const struct tcphdr *th);
> #endif
>
> +static DEFINE_LOCAL_IRQ_LOCK(tcp_md5_lock);
> struct inet_hashinfo tcp_hashinfo;
> EXPORT_SYMBOL(tcp_hashinfo);
>
> @@ -1224,6 +1225,7 @@ static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
> struct tcp_md5sig_pool *hp;
> struct ahash_request *req;
>
> + local_lock(tcp_md5_lock);
> hp = tcp_get_md5sig_pool();

Instead of this, could you please move the lock to within
tcp_get_md5sig_pool()/ tcp_put_md5sig_pool()? That way it will also fix
ipv6 in the same way.

Sebastian