Patch "nvme-tcp: can't set sk_user_data without write_lock" has been added to the 5.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvme-tcp: can't set sk_user_data without write_lock

to the 5.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvme-tcp-can-t-set-sk_user_data-without-write_lock.patch
and it can be found in the queue-5.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 13c4ec40c8cf5c88b10b4d22954d3cc0ac147442
Author: Maurizio Lombardi <mlombard@xxxxxxxxxx>
Date:   Fri Jul 2 10:11:21 2021 +0200

    nvme-tcp: can't set sk_user_data without write_lock
    
    [ Upstream commit 0755d3be2d9bb6ea38598ccd30d6bbaa1a5c3a50 ]
    
    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 <mlombard@xxxxxxxxxx>
    Reviewed-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index d8aceef83284..07ee347ea3f3 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -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:



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux