Skip to content

Commit 0523c6c

Browse files
maurizio-lombardiChristoph Hellwig
authored andcommitted
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: 675b453 ("nvmet-tcp: enable TLS handshake upcall") Signed-off-by: Maurizio Lombardi <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 7125792 commit 0523c6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/nvme/target/tcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,10 +1928,10 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
19281928
struct sock *sk = queue->sock->sk;
19291929

19301930
/* Restore the default callbacks before starting upcall */
1931-
read_lock_bh(&sk->sk_callback_lock);
1931+
write_lock_bh(&sk->sk_callback_lock);
19321932
sk->sk_user_data = NULL;
19331933
sk->sk_data_ready = port->data_ready;
1934-
read_unlock_bh(&sk->sk_callback_lock);
1934+
write_unlock_bh(&sk->sk_callback_lock);
19351935
if (!nvmet_tcp_try_peek_pdu(queue)) {
19361936
if (!nvmet_tcp_tls_handshake(queue))
19371937
return;

0 commit comments

Comments
 (0)