Skip to content

Commit 0755d3b

Browse files
maurizio-lombardiChristoph Hellwig
authored andcommitted
nvme-tcp: can't set sk_user_data without write_lock
The sk_user_data pointer is supposed to be modified only while holding the write_lock "sk_callback_lock", otherwise we could race with other threads and crash the kernel. we can't take the write_lock in nvmet_tcp_state_change() because it would cause a deadlock, but the release_work queue will set the pointer to NULL later so we can simply remove the assignment. Fixes: b5332a9 ("nvmet-tcp: fix incorrect locking in state_change sk callback") Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 585af8e commit 0755d3b

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

drivers/nvme/target/tcp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,6 @@ static void nvmet_tcp_state_change(struct sock *sk)
14971497
case TCP_CLOSE_WAIT:
14981498
case TCP_CLOSE:
14991499
/* FALLTHRU */
1500-
sk->sk_user_data = NULL;
15011500
nvmet_tcp_schedule_release_queue(queue);
15021501
break;
15031502
default:

0 commit comments

Comments
 (0)