]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sysfs(2): fs_index() argument is _not_ a pathname
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 14 Dec 2025 08:32:45 +0000 (03:32 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 16 Jan 2026 17:52:04 +0000 (12:52 -0500)
... it's a filesystem type name.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/filesystems.c

index 95e5256821a53494d88f496193305a2e50e04444..0c7d2b7ac26c84385adb2b8dd01272bb308730dc 100644 (file)
@@ -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);
 
        err = -EINVAL;
        read_lock(&file_systems_lock);
        for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
-               if (strcmp(tmp->name, name->name) == 0) {
+               if (strcmp(tmp->name, name) == 0) {
                        err = index;
                        break;
                }
        }
        read_unlock(&file_systems_lock);
-       putname(name);
        return err;
 }