io_uring: fix leaking reg files on exit
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 13 Apr 2021 01:58:38 +0000 (02:58 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 Apr 2021 15:37:54 +0000 (09:37 -0600)
commit084804002e512427bfe52b448cb7cac0d4209b64
tree7b60c51c386a1d7a96f1ab693f615fa982a0d8c5
parentf70865db5ff35f5ed0c7e9ef63e7cca3d4947f04
io_uring: fix leaking reg files on exit

If io_sqe_files_unregister() faults on io_rsrc_ref_quiesce(), it will
fail to do unregister leaving files referenced. And that may well happen
because of a strayed signal or just because it does allocations inside.

In io_ring_ctx_free() do an unsafe version of unregister, as it's
guaranteed to not have requests by that point and so quiesce is useless.

Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/e696e9eade571b51997d0dc1d01f144c6d685c05.1618278933.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c