summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-02-11 07:45:08 -0700
committerJens Axboe <axboe@kernel.dk>2021-02-11 07:45:08 -0700
commite68a3ff8c342b655f01f74a577c15605eec9aa12 (patch)
treeddea5dc0e285d287c4205d38a5db0c1c8491d006
parent4a245479c2312e6b51862c21af134d4191ab9cf7 (diff)
io_uring: assign file_slot prior to calling io_sqe_file_register()
We use the assigned slot in io_sqe_file_register(), and a previous patch moved the assignment to after we have called it. This isn't super pretty, and will get cleaned up in the future. For now, fix the regression by restoring the previous assignment/clear of the file_slot. Fixes: ea64ec02b31d ("io_uring: deduplicate file table slot calculation") Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f730af32c17a..cd9c4c05f6f5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8112,12 +8112,13 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
err = -EBADF;
break;
}
+ *file_slot = file;
err = io_sqe_file_register(ctx, file, i);
if (err) {
+ *file_slot = NULL;
fput(file);
break;
}
- *file_slot = file;
}
}