[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260114143555.GV3634291@ZenIV>
Date: Wed, 14 Jan 2026 14:35:55 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: David Laight <david.laight.linux@...il.com>
Cc: linux-fsdevel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Mateusz Guzik <mjguzik@...il.com>, Paul Moore <paul@...l-moore.com>,
Jens Axboe <axboe@...nel.dk>, audit@...r.kernel.org,
io-uring@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 68/68] sysfs(2): fs_index() argument is _not_ a
pathname
On Wed, Jan 14, 2026 at 10:41:55AM +0000, David Laight wrote:
> On Wed, 14 Jan 2026 04:33:10 +0000
> Al Viro <viro@...iv.linux.org.uk> wrote:
>
> > ... it's a filesystem type name.
> >
> > Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> > ---
> > fs/filesystems.c | 9 +++------
> > 1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/filesystems.c b/fs/filesystems.c
> > index 95e5256821a5..0c7d2b7ac26c 100644
> > --- a/fs/filesystems.c
> > +++ b/fs/filesystems.c
> > @@ -132,24 +132,21 @@ EXPORT_SYMBOL(unregister_filesystem);
> > static int fs_index(const char __user * __name)
> > {
> > struct file_system_type * tmp;
> > - struct filename *name;
> > + char *name __free(kfree) = strndup_user(__name, PATH_MAX);
> > int err, index;
> >
> > - name = getname(__name);
> > - err = PTR_ERR(name);
> > if (IS_ERR(name))
> > - return err;
> > + return PTR_ERR(name);
>
> Doesn't that end up calling kfree(name) and the check in kfree() doesn't
> seem to exclude error values.
include/linux/slab.h:523:DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T))
kfree() the function won't be even called in that case...
Powered by blists - more mailing lists