diff options
author | Eric Dumazet <edumazet@google.com> | 2020-07-01 11:43:04 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-01 17:29:45 -0700 |
commit | e6ced831ef11a2a06e8d00aad9d4fc05b610bf38 (patch) | |
tree | a73f06375f6b3d2bbeaf910884d197ed8a9cbd75 /net/ipv6/icmp.c | |
parent | 1e82a62fec613844da9e558f3493540a5b7a7b67 (diff) | |
download | linux-e6ced831ef11a2a06e8d00aad9d4fc05b610bf38.tar.gz linux-e6ced831ef11a2a06e8d00aad9d4fc05b610bf38.tar.bz2 linux-e6ced831ef11a2a06e8d00aad9d4fc05b610bf38.zip |
tcp: md5: refine tcp_md5_do_add()/tcp_md5_hash_key() barriers
My prior fix went a bit too far, according to Herbert and Mathieu.
Since we accept that concurrent TCP MD5 lookups might see inconsistent
keys, we can use READ_ONCE()/WRITE_ONCE() instead of smp_rmb()/smp_wmb()
Clearing all key->key[] is needed to avoid possible KMSAN reports,
if key->keylen is increased. Since tcp_md5_do_add() is not fast path,
using __GFP_ZERO to clear all struct tcp_md5sig_key is simpler.
data_race() was added in linux-5.8 and will prevent KCSAN reports,
this can safely be removed in stable backports, if data_race() is
not yet backported.
v2: use data_race() both in tcp_md5_hash_key() and tcp_md5_do_add()
Fixes: 6a2febec338d ("tcp: md5: add missing memory barriers in tcp_md5_do_add()/tcp_md5_hash_key()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Marco Elver <elver@google.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
0 files changed, 0 insertions, 0 deletions