diff options
| author | Maurizio Lombardi <mlombard@redhat.com> | 2025-07-04 16:44:54 +0200 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2025-07-15 09:49:13 +0200 |
| commit | 0523c6cc87e558c50ff4489c87c54c55068b1169 (patch) | |
| tree | 9f0f24498a5c72802e76e592029237d0a84d2350 | |
| parent | 71257925e83eae1cb6913d65ca71927d2220e6d1 (diff) | |
nvmet-tcp: fix callback lock for TLS handshake
When restoring the default socket callbacks during a TLS handshake, we
need to acquire a write lock on sk_callback_lock. Previously, a read
lock was used, which is insufficient for modifying sk_user_data and
sk_data_ready.
Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
| -rw-r--r-- | drivers/nvme/target/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index c6603bd9c95e..c58d2caef70a 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1928,10 +1928,10 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, struct sock *sk = queue->sock->sk; /* Restore the default callbacks before starting upcall */ - read_lock_bh(&sk->sk_callback_lock); + write_lock_bh(&sk->sk_callback_lock); sk->sk_user_data = NULL; sk->sk_data_ready = port->data_ready; - read_unlock_bh(&sk->sk_callback_lock); + write_unlock_bh(&sk->sk_callback_lock); if (!nvmet_tcp_try_peek_pdu(queue)) { if (!nvmet_tcp_tls_handshake(queue)) return; |
