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: a7c41b4687 ("io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots")
Signed-off-by: Hao Xu <howeyxu@tencent.com>
[pavel: 5.19 rebase]
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
This commit is contained in:
Hao Xu 2022-06-11 20:22:20 +08:00 committed by Pavel Begunkov
parent 05b538c176
commit e71d7c56dd
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}
}