io_uring: fix memory leak of uid in files registration

commit c86d18f4aa upstream.

When there are no files for __io_sqe_files_scm() to process in the
range, it'll free everything and return. However, it forgets to put uid.

Fixes: 08a451739a ("io_uring: allow sparse fixed file sets")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/accee442376f33ce8aaebb099d04967533efde92.1648226048.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Pavel Begunkov 2022-03-25 16:36:31 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель 5b9ac3727e
Коммит 0853bd6885
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -8130,6 +8130,7 @@ static int __io_sqe_files_scm(struct io_ring_ctx *ctx, int nr, int offset)
fput(fpl->fp[i]);
} else {
kfree_skb(skb);
free_uid(fpl->user);
kfree(fpl);
}