Message ID | fe2ade22d030051ce4c3638704ed58b67d0df643.1711120964.git.sd@queasysnail.net (mailing list archive) |
---|---|
State | Accepted |
Commit | 417e91e856099e9b8a42a2520e2255e6afe024be |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tls: recvmsg fixes | expand |
On Mon, Mar 25, 2024 at 04:56:48PM +0100, Sabrina Dubroca wrote: > 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>
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 14faf6189eb1..b783231668c6 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -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 */
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> --- net/tls/tls_sw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)