]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tls: get psock ref after taking rxlock to avoid leak
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 25 Mar 2024 15:56:48 +0000 (16:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:43 +0000 (16:35 +0200)
commitf1b7f14130d782433bc98c1e1e41ce6b4d4c3096
tree7ce9f677f35ec17312df84a59048e09d668cee0b
parentf19e995b4813a81b63df940ff2f8ba00882016c2
tls: get psock ref after taking rxlock to avoid leak

[ Upstream commit 417e91e856099e9b8a42a2520e2255e6afe024be ]

At the start of tls_sw_recvmsg, we take a reference on the psock, and
then call tls_rx_reader_lock. If that fails, we return directly
without releasing the reference.

Instead of adding a new label, just take the reference after locking
has succeeded, since we don't need it before.

Fixes: 4cbc325ed6b4 ("tls: rx: allow only one reader at a time")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/fe2ade22d030051ce4c3638704ed58b67d0df643.1711120964.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tls/tls_sw.c