]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-tcp: can't set sk_user_data without write_lock
authorMaurizio Lombardi <mlombard@redhat.com>
Fri, 2 Jul 2021 08:11:21 +0000 (10:11 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 5 Jul 2021 08:14:44 +0000 (10:14 +0200)
commitb377b212b38e63cf9a83b06ff9bc9960e35ef474
tree4bedd822909aa74d9f533f0dcb59aa428357afce
parent86d51d9ad18246ccacb61dac39bcbe998748e569
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: 092235a329d7 ("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>
drivers/nvme/target/tcp.c