tls: improve lockless access safety of tls_err_abort()
authorJakub Kicinski <kuba@kernel.org>
Thu, 25 May 2023 05:17:41 +0000 (22:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:34:01 +0000 (10:34 +0200)
commitd615070b0eb8cd84f416a066c4f2157ee7632864
tree10c5be5c3811a11c54a5c5660f33a9b7de3dace2
parent0b64a2bf169965da0273ef29919b2a6b76a9c68b
tls: improve lockless access safety of tls_err_abort()

[ Upstream commit 8a0d57df8938e9fd2e99d47a85b7f37d86f91097 ]

Most protos' poll() methods insert a memory barrier between
writes to sk_err and sk_error_report(). This dates back to
commit a4d258036ed9 ("tcp: Fix race in tcp_poll").

I guess we should do the same thing in TLS, tcp_poll() does
not hold the socket lock.

Fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tls/tls_strp.c
net/tls/tls_sw.c