Patch "io_uring: abort file assignment prior to assigning creds" has been added to the 5.17-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: abort file assignment prior to assigning creds

to the 5.17-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-abort-file-assignment-prior-to-assigning-cr.patch
and it can be found in the queue-5.17 subdirectory.

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



commit 6274b18ce0394907a940bed653b04ab3d04605b8
Author: Jens Axboe <axboe@xxxxxxxxx>
Date:   Thu Apr 14 20:23:40 2022 -0600

    io_uring: abort file assignment prior to assigning creds
    
    [ Upstream commit 701521403cfb228536b3947035c8a6eca40d8e58 ]
    
    We need to either restore creds properly if we fail on the file
    assignment, or just do the file assignment first instead. Let's do
    the latter as it's simpler, should make no difference here for
    file assignment.
    
    Link: https://lore.kernel.org/lkml/000000000000a7edb305dca75a50@xxxxxxxxxx/
    Reported-by: syzbot+60c52ca98513a8760a91@xxxxxxxxxxxxxxxxxxxxxxxxx
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    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 7a652c8eeed2..6f93bff7633c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6729,13 +6729,14 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
 	const struct cred *creds = NULL;
 	int ret;
 
+	if (unlikely(!io_assign_file(req, issue_flags)))
+		return -EBADF;
+
 	if (unlikely((req->flags & REQ_F_CREDS) && req->creds != current_cred()))
 		creds = override_creds(req->creds);
 
 	if (!io_op_defs[req->opcode].audit_skip)
 		audit_uring_entry(req->opcode);
-	if (unlikely(!io_assign_file(req, issue_flags)))
-		return -EBADF;
 
 	switch (req->opcode) {
 	case IORING_OP_NOP:



[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