From: Jens Axboe Date: Thu, 11 Feb 2021 14:45:08 +0000 (-0700) Subject: io_uring: assign file_slot prior to calling io_sqe_file_register() X-Git-Tag: accepted/tizen/unified/20230118.172025~7716^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e68a3ff8c342b655f01f74a577c15605eec9aa12;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/fs/io_uring.c b/fs/io_uring.c index f730af3..cd9c4c0 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; } }