summaryrefslogtreecommitdiff
path: root/net/tls/tls.h
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2024-04-24 13:25:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-02 17:35:22 +0300
commit22a746f0f7d170570f5c343f794f66ce86ebeed8 (patch)
tree5a9b19a5672cf752d6c90c27ceff2bbeac313aa5 /net/tls/tls.h
parentf3e1cf62d18220a3aa97e084e7a3552debece9fc (diff)
downloadlinux-22a746f0f7d170570f5c343f794f66ce86ebeed8.tar.xz
tls: fix lockless read of strp->msg_ready in ->poll
[ Upstream commit 0844370f8945086eb9335739d10205dcea8d707b ] tls_sk_poll is called without locking the socket, and needs to read strp->msg_ready (via tls_strp_msg_ready). Convert msg_ready to a bool and use READ_ONCE/WRITE_ONCE where needed. The remaining reads are only performed when the socket is locked. Fixes: 121dca784fc0 ("tls: suppress wakeups unless we have a full record") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Link: https://lore.kernel.org/r/0b7ee062319037cf86af6b317b3d72f7bfcd2e97.1713797701.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/tls/tls.h')
-rw-r--r--net/tls/tls.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tls/tls.h b/net/tls/tls.h
index 762f424ff2d5..e5e47452308a 100644
--- a/net/tls/tls.h
+++ b/net/tls/tls.h
@@ -215,7 +215,7 @@ static inline struct sk_buff *tls_strp_msg(struct tls_sw_context_rx *ctx)
static inline bool tls_strp_msg_ready(struct tls_sw_context_rx *ctx)
{
- return ctx->strp.msg_ready;
+ return READ_ONCE(ctx->strp.msg_ready);
}
static inline bool tls_strp_msg_mixed_decrypted(struct tls_sw_context_rx *ctx)