Skip to content

Commit 39150d7

Browse files
nvmet-tcp: fix callback lock for TLS handshake
JIRA: https://issues.redhat.com/browse/RHEL-114502 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 <mlombard@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> (cherry picked from commit 0523c6c) Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
1 parent 4ef1fbc commit 39150d7

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
@@ -1916,10 +1916,10 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
19161916
struct sock *sk = queue->sock->sk;
19171917

19181918
/* Restore the default callbacks before starting upcall */
1919-
read_lock_bh(&sk->sk_callback_lock);
1919+
write_lock_bh(&sk->sk_callback_lock);
19201920
sk->sk_user_data = NULL;
19211921
sk->sk_data_ready = port->data_ready;
1922-
read_unlock_bh(&sk->sk_callback_lock);
1922+
write_unlock_bh(&sk->sk_callback_lock);
19231923
if (!nvmet_tcp_try_peek_pdu(queue)) {
19241924
if (!nvmet_tcp_tls_handshake(queue))
19251925
return;

0 commit comments

Comments
 (0)