Commit e71d7c56 authored by Hao Xu's avatar Hao Xu Committed by Pavel Begunkov

io_uring: openclose: fix bug of closing wrong fixed file

Don't update ret until fixed file is closed, otherwise the file slot
becomes the error code.

Fixes: a7c41b46 ("io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots")
Signed-off-by: default avatarHao Xu <howeyxu@tencent.com>
[pavel: 5.19 rebase]
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
parent 05b538c1
......@@ -8035,8 +8035,8 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
if (ret < 0)
break;
if (copy_to_user(&fds[done], &ret, sizeof(ret))) {
ret = -EFAULT;
__io_close_fixed(req, issue_flags, ret);
ret = -EFAULT;
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment