[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3466437a-0325-1cb8-6aa9-594527382390@kernel.dk>
Date: Mon, 7 Dec 2020 09:42:21 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Hillf Danton <hdanton@...a.com>,
LKML <linux-kernel@...r.kernel.org>
Cc: io-uring@...r.kernel.org, syzkaller-bugs@...glegroups.com,
syzbot+71c4697e27c99fddcf17@...kaller.appspotmail.com,
Pavel Begunkov <asml.silence@...il.com>
Subject: Re: [PATCH] io_uring: fix file leak on creating io ctx
On 12/7/20 1:15 AM, Hillf Danton wrote:
> @@ -9207,12 +9208,14 @@ err_fd:
> #if defined(CONFIG_UNIX)
> ctx->ring_sock->file = file;
> #endif
> - if (unlikely(io_uring_add_task_file(ctx, file))) {
> - file = ERR_PTR(-ENOMEM);
> - goto err_fd;
> + ret = io_uring_add_task_file(ctx, file);
> + if (ret) {
> + fput(file);
> + put_unused_fd(fd);
> + goto err;
> }
> fd_install(ret, file);
> - return ret;
> + return 0;
You're installing the return value from io_uring_add_task_file() in the
fd table, and then returning '0' for the fd...
--
Jens Axboe
Powered by blists - more mailing lists