diff options
Diffstat (limited to 'fs/filesystems.c')
-rw-r--r-- | fs/filesystems.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/filesystems.c b/fs/filesystems.c index 7a4f61aa05f8..f37f87262837 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -41,11 +41,12 @@ void put_filesystem(struct file_system_type *fs) | |||
41 | module_put(fs->owner); | 41 | module_put(fs->owner); |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct file_system_type **find_filesystem(const char *name) | 44 | static struct file_system_type **find_filesystem(const char *name, unsigned len) |
45 | { | 45 | { |
46 | struct file_system_type **p; | 46 | struct file_system_type **p; |
47 | for (p=&file_systems; *p; p=&(*p)->next) | 47 | for (p=&file_systems; *p; p=&(*p)->next) |
48 | if (strcmp((*p)->name,name) == 0) | 48 | if (strlen((*p)->name) == len && |
49 | strncmp((*p)->name, name, len) == 0) | ||
49 | break; | 50 | break; |
50 | return p; | 51 | return p; |
51 | } | 52 | } |
@@ -68,11 +69,12 @@ int register_filesystem(struct file_system_type * fs) | |||
68 | int res = 0; | 69 | int res = 0; |
69 | struct file_system_type ** p; | 70 | struct file_system_type ** p; |
70 | 71 | ||
72 | BUG_ON(strchr(fs->name, '.')); | ||
71 | if (fs->next) | 73 | if (fs->next) |
72 | return -EBUSY; | 74 | return -EBUSY; |
73 | INIT_LIST_HEAD(&fs->fs_supers); | 75 | INIT_LIST_HEAD(&fs->fs_supers); |
74 | write_lock(&file_systems_lock); | 76 | write_lock(&file_systems_lock); |
75 | p = find_filesystem(fs->name); | 77 | p = find_filesystem(fs->name, strlen(fs->name)); |
76 | if (*p) | 78 | if (*p) |
77 | res = -EBUSY; | 79 | res = -EBUSY; |
78 | else | 80 | else |
@@ -215,19 +217,26 @@ int get_filesystem_list(char * buf) | |||
215 | struct file_system_type *get_fs_type(const char *name) | 217 | struct file_system_type *get_fs_type(const char *name) |
216 | { | 218 | { |
217 | struct file_system_type *fs; | 219 | struct file_system_type *fs; |
220 | const char *dot = strchr(name, '.'); | ||
221 | unsigned len = dot ? dot - name : strlen(name); | ||
218 | 222 | ||
219 | read_lock(&file_systems_lock); | 223 | read_lock(&file_systems_lock); |
220 | fs = *(find_filesystem(name)); | 224 | fs = *(find_filesystem(name, len)); |
221 | if (fs && !try_module_get(fs->owner)) | 225 | if (fs && !try_module_get(fs->owner)) |
222 | fs = NULL; | 226 | fs = NULL; |
223 | read_unlock(&file_systems_lock); | 227 | read_unlock(&file_systems_lock); |
224 | if (!fs && (request_module("%s", name) == 0)) { | 228 | if (!fs && (request_module("%.*s", len, name) == 0)) { |
225 | read_lock(&file_systems_lock); | 229 | read_lock(&file_systems_lock); |
226 | fs = *(find_filesystem(name)); | 230 | fs = *(find_filesystem(name, len)); |
227 | if (fs && !try_module_get(fs->owner)) | 231 | if (fs && !try_module_get(fs->owner)) |
228 | fs = NULL; | 232 | fs = NULL; |
229 | read_unlock(&file_systems_lock); | 233 | read_unlock(&file_systems_lock); |
230 | } | 234 | } |
235 | |||
236 | if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { | ||
237 | put_filesystem(fs); | ||
238 | fs = NULL; | ||
239 | } | ||
231 | return fs; | 240 | return fs; |
232 | } | 241 | } |
233 | 242 | ||