io_uring/rsrc: use get/put_user() for integer copy

It's just getting an integer from userspace, installing a file, then
copying the output direct descriptor back. No need to use the full
copy_to/from_user() for that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
pull/1354/merge
Jens Axboe 2025-11-03 11:02:54 -07:00
parent adb395c457
commit 3615e3f794
1 changed files with 2 additions and 2 deletions

View File

@ -454,7 +454,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
return -ENXIO; return -ENXIO;
for (done = 0; done < up->nr_args; done++) { for (done = 0; done < up->nr_args; done++) {
if (copy_from_user(&fd, &fds[done], sizeof(fd))) { if (get_user(fd, &fds[done])) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
@ -468,7 +468,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
IORING_FILE_INDEX_ALLOC); IORING_FILE_INDEX_ALLOC);
if (ret < 0) if (ret < 0)
break; break;
if (copy_to_user(&fds[done], &ret, sizeof(ret))) { if (put_user(ret, &fds[done])) {
__io_close_fixed(req->ctx, issue_flags, ret); __io_close_fixed(req->ctx, issue_flags, ret);
ret = -EFAULT; ret = -EFAULT;
break; break;