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: ea64ec02b3 ("io_uring: deduplicate file table slot calculation")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2021-02-11 07:45:08 -07:00
parent 4a245479c2
commit e68a3ff8c3
1 changed files with 2 additions and 1 deletions

View File

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