io_uring: fix removing the wrong file in __io_sqe_files_update()
authorJiufei Xue <jiufei.xue@linux.alibaba.com>
Tue, 1 Sep 2020 05:35:02 +0000 (13:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:29 +0000 (19:14 +0200)
commite37bc36aaff38fdf8fafc52bc88ad98ed1ff7a88
treee75b529ce74a1bcdcb874ad71e897ebea74e91a1
parent329c9ffc81cfb985c6d131e94e6d220d7c1b19ca
io_uring: fix removing the wrong file in __io_sqe_files_update()

commit 98dfd5024a2e9e170b85c07078e2d89f20a5dfbd upstream.

Index here is already the position of the file in fixed_file_table, we
should not use io_file_from_index() again to get it. Otherwise, the
wrong file which still in use may be released unexpectedly.

Cc: stable@vger.kernel.org # v5.6
Fixes: 05f3fb3c5397 ("io_uring: avoid ring quiesce for fixed file set unregister and update")
Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c