[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjsdDBmaD-sS5FSb3ngn820z3x=1Ny+36agbEXhDuGOsg@mail.gmail.com>
Date: Tue, 29 Mar 2022 15:23:10 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Fedor Pchelkin <aissur0002@...il.com>
Cc: Alexey Khoroshilov <khoroshilov@...ras.ru>,
Eric Biggers <ebiggers@...nel.org>,
Christian Brauner <brauner@...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 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.
Linus
Powered by blists - more mailing lists