nvme-tcp: can't set sk_user_data without write_lock
Subsystems (2)
PATCH 1/1 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 b5332a9f3f3d ("nvmet-tcp: fix incorrect locking in state_change sk callback")
Signed-off-by Maurizio Lombardi <[email protected]>
Reviewed-by Sagi Grimberg <[email protected]>
--- drivers/nvme/target/tcp.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/target/tcp.c +0 -1
@@ -1497,7 +1497,6 @@ static void nvmet_tcp_state_change(struct sock *sk)case TCP_CLOSE_WAIT :case TCP_CLOSE :/* FALLTHRU */ - sk->sk_user_data =NULL ;nvmet_tcp_schedule_release_queue (queue);break ;default :
Signature · 7 lines
2.27.0 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks,
applied to nvme-5.14.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme