Skip to content

Commit 0787a93

Browse files
author
Al Viro
committed
sysfs(2): fs_index() argument is _not_ a pathname
... it's a filesystem type name. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 9b323d2 commit 0787a93

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

fs/filesystems.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,21 @@ EXPORT_SYMBOL(unregister_filesystem);
132132
static int fs_index(const char __user * __name)
133133
{
134134
struct file_system_type * tmp;
135-
struct filename *name;
135+
char *name __free(kfree) = strndup_user(__name, PATH_MAX);
136136
int err, index;
137137

138-
name = getname(__name);
139-
err = PTR_ERR(name);
140138
if (IS_ERR(name))
141-
return err;
139+
return PTR_ERR(name);
142140

143141
err = -EINVAL;
144142
read_lock(&file_systems_lock);
145143
for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
146-
if (strcmp(tmp->name, name->name) == 0) {
144+
if (strcmp(tmp->name, name) == 0) {
147145
err = index;
148146
break;
149147
}
150148
}
151149
read_unlock(&file_systems_lock);
152-
putname(name);
153150
return err;
154151
}
155152

0 commit comments

Comments
 (0)