[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220330074709.oyeehornuictzumk@wittgenstein>
Date: Wed, 30 Mar 2022 09:47:09 +0200
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Fedor Pchelkin <aissur0002@...il.com>,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
Eric Biggers <ebiggers@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] file: Fix file descriptor leak in copy_fd_bitmaps()
On Tue, Mar 29, 2022 at 03:23:10PM -0700, Linus Torvalds wrote:
> On Tue, Mar 29, 2022 at 3:18 PM Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > Ok, applied as commit 1c24a186398f ("fs: fd tables have to be
> > multiples of BITS_PER_LONG").
>
> Oh, forgot to mention...
>
> Christian - it strikes me that the whole "min(count, max_fds)" in
> sane_fdtable_size() is a bit stupid.
>
> A _smarter_ approach might be to pass in 'max_fds' to
> count_open_files(), and simply not count past that value.
>
> I didn't do that, because I wanted to keep the patch obvious. And it
> probably doesn't matter, but it's kind of silly to possibly count a
> lot of open files that we want to close anyway, when we already know
> the place we should stop counting.
>
> Whatever. I just wanted to mention it in case you decide you want to
> clean that part up. This is mostly your code anyway.
I put it on my TODO and will look at this soon!
Thank you!
Christian
Powered by blists - more mailing lists