mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
tls: get psock ref after taking rxlock to avoid leak
[ Upstream commit417e91e856
] 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:4cbc325ed6
("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>
This commit is contained in:
parent
d67b53934c
commit
b565d294e3
1 changed files with 1 additions and 1 deletions
|
@ -1976,10 +1976,10 @@ int tls_sw_recvmsg(struct sock *sk,
|
|||
if (unlikely(flags & MSG_ERRQUEUE))
|
||||
return sock_recv_errqueue(sk, msg, len, SOL_IP, IP_RECVERR);
|
||||
|
||||
psock = sk_psock_get(sk);
|
||||
err = tls_rx_reader_lock(sk, ctx, flags & MSG_DONTWAIT);
|
||||
if (err < 0)
|
||||
return err;
|
||||
psock = sk_psock_get(sk);
|
||||
bpf_strp_enabled = sk_psock_strp_enabled(psock);
|
||||
|
||||
/* If crypto failed the connection is broken */
|
||||
|
|
Loading…
Reference in a new issue