[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFUsyfK-Mo76PNBHmvUnavHgemgb92g2muqWJjPKv5T7TE-rhA@mail.gmail.com>
Date: Fri, 29 Apr 2022 10:36:57 -0500
From: Noah Goldstein <goldstein.w.n@...il.com>
To: Jens Axboe <axboe@...nel.dk>
Cc: Pavel Begunkov <asml.silence@...il.com>,
"open list:IO_URING" <io-uring@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] io_uring: Fix memory leak if file setup fails.
On Fri, Apr 29, 2022 at 7:47 AM Jens Axboe <axboe@...nel.dk> wrote:
>
> On 4/28/22 6:42 PM, Noah Goldstein wrote:
> > If `get_unused_fd_flags` files fails (either in setting up `ctx` as
> > `tctx->last` or `get_unused_fd_flags`) `ctx` will never be freed.
>
> There's a comment there telling you why, the fput will end up
> releasing it just like it would when an application closes it.
I see. Thought the 'it' refered to in the comment was the file, not
ctx.
>
> > I very well may be missing something (or there may be a double
> > free if the failure is after `get_unused_fd_flags`) but looks
> > to me to be a memory leak.
>
> Have you tried synthetically reproducing the two failures you're
> thinking of and tracing cleanup?
>
> --
> Jens Axboe
>
Powered by blists - more mailing lists