diff --git a/fs/io_uring.c b/fs/io_uring.c index 0f4a9c45061d92af0e77cb2928b053f5dd3ba5e5..e9e8006fdf2e4fd1c4a331b9a2cb5d34d1e6ad39 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6191,7 +6191,8 @@ static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs) again: linked_timeout = io_prep_linked_timeout(req); - if ((req->flags & REQ_F_WORK_INITIALIZED) && req->work.identity->creds && + if ((req->flags & REQ_F_WORK_INITIALIZED) && + (req->work.flags & IO_WQ_WORK_CREDS) && req->work.identity->creds != current_cred()) { if (old_creds) revert_creds(old_creds); @@ -6199,7 +6200,6 @@ static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs) old_creds = NULL; /* restored original creds */ else old_creds = override_creds(req->work.identity->creds); - req->work.flags |= IO_WQ_WORK_CREDS; } ret = io_issue_sqe(req, true, cs);