io_uring: Fix return value from alloc_fixed_file_ref_node
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 6 Jan 2021 16:09:26 +0000 (16:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 13:16:53 +0000 (14:16 +0100)
commit458b40598dc0ccbbb1d3522f56a287ea0a127165
tree90a60eb65df8efcb9f61f6b990457774e3ceafbf
parent51495b719515ddae417e4bafc7e100c34833af4b
io_uring: Fix return value from alloc_fixed_file_ref_node

[ Upstream commit 3e2224c5867fead6c0b94b84727cc676ac6353a3 ]

alloc_fixed_file_ref_node() currently returns an ERR_PTR on failure.
io_sqe_files_unregister() expects it to return NULL and since it can only
return -ENOMEM, it makes more sense to change alloc_fixed_file_ref_node()
to behave that way.

Fixes: 1ffc54220c44 ("io_uring: fix io_sqe_files_unregister() hangs")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c