Patch "io_uring: fix no lock protection for ctx->cq_extra" has been added to the 5.15-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

    io_uring: fix no lock protection for ctx->cq_extra

to the 5.15-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:
     io_uring-fix-no-lock-protection-for-ctx-cq_extra.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 9280fd6ba6fe7f3a1248d91847fe6180fc420b95
Author: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx>
Date:   Thu Nov 25 17:21:02 2021 +0800

    io_uring: fix no lock protection for ctx->cq_extra
    
    [ Upstream commit e302f1046f4c209291b07ff7bc4d15ca26891f16 ]
    
    ctx->cq_extra should be protected by completion lock so that the
    req_need_defer() does the right check.
    
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211125092103.224502-2-haoxu@xxxxxxxxxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/io_uring.c b/fs/io_uring.c
index d7e49e87b49b9..156c54ebb62b7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6573,11 +6573,14 @@ static bool io_drain_req(struct io_kiocb *req)
 	}
 
 	/* Still need defer if there is pending req in defer list. */
+	spin_lock(&ctx->completion_lock);
 	if (likely(list_empty_careful(&ctx->defer_list) &&
 		!(req->flags & REQ_F_IO_DRAIN))) {
+		spin_unlock(&ctx->completion_lock);
 		ctx->drain_active = false;
 		return false;
 	}
+	spin_unlock(&ctx->completion_lock);
 
 	seq = io_get_sequence(req);
 	/* Still a chance to pass the sequence check */



[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