Skip to content

Commit 16796a1

Browse files
committed
Merge: Revert "io_uring/uring_cmd: defer SQE copying until it's needed"
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6589 JIRA: https://issues.redhat.com/browse/RHEL-82695 CVE: CVE-2025-21837 Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Approved-by: Brian Foster <bfoster@redhat.com> Approved-by: Ming Lei <ming.lei@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 2e820f8 + dc850d5 commit 16796a1

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

io_uring/uring_cmd.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,12 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
182182
struct uring_cache *cache;
183183

184184
cache = io_uring_async_get(req);
185-
if (unlikely(!cache))
186-
return -ENOMEM;
187-
188-
if (!(req->flags & REQ_F_FORCE_ASYNC)) {
189-
/* defer memcpy until we need it */
190-
ioucmd->sqe = sqe;
185+
if (cache) {
186+
memcpy(cache->sqes, sqe, uring_sqe_size(req->ctx));
187+
ioucmd->sqe = req->async_data;
191188
return 0;
192189
}
193-
194-
memcpy(req->async_data, sqe, uring_sqe_size(req->ctx));
195-
ioucmd->sqe = req->async_data;
196-
return 0;
190+
return -ENOMEM;
197191
}
198192

199193
int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
@@ -251,15 +245,8 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
251245
}
252246

253247
ret = file->f_op->uring_cmd(ioucmd, issue_flags);
254-
if (ret == -EAGAIN) {
255-
struct uring_cache *cache = req->async_data;
256-
257-
if (ioucmd->sqe != (void *) cache)
258-
memcpy(cache, ioucmd->sqe, uring_sqe_size(req->ctx));
259-
return -EAGAIN;
260-
} else if (ret == -EIOCBQUEUED) {
261-
return -EIOCBQUEUED;
262-
}
248+
if (ret == -EAGAIN || ret == -EIOCBQUEUED)
249+
return ret;
263250

264251
if (ret < 0)
265252
req_set_fail(req);

0 commit comments

Comments
 (0)