aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2006-11-14 05:03:29 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-14 12:09:27 -0500
commitba8df43c0ee93ec05fc526278a80aaf4cb5ab1fa (patch)
tree510db3f9141e0bf091eccaf7ef7a0db3c81338bb /fs/autofs4
parent6a34b57bec41c95f1e38f700cd9b81324baaffc7 (diff)
[PATCH] autofs4: panic after mount fail
Resolve the panic on failed mount of an autofs filesystem originally reported by Mao Bibo. It addresses two issues that happen after the mount fail. The first a NULL pointer reference to a field (pipe) in the autofs superblock info structure and second the lack of super block cleanup by the autofs and autofs4 modules. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/inode.c17
-rw-r--r--fs/autofs4/waitq.c6
2 files changed, 18 insertions, 5 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 51fd8595bf85..ce7c0f1dd529 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -99,6 +99,9 @@ static void autofs4_force_release(struct autofs_sb_info *sbi)
99 struct dentry *this_parent = sbi->sb->s_root; 99 struct dentry *this_parent = sbi->sb->s_root;
100 struct list_head *next; 100 struct list_head *next;
101 101
102 if (!sbi->sb->s_root)
103 return;
104
102 spin_lock(&dcache_lock); 105 spin_lock(&dcache_lock);
103repeat: 106repeat:
104 next = this_parent->d_subdirs.next; 107 next = this_parent->d_subdirs.next;
@@ -146,6 +149,14 @@ void autofs4_kill_sb(struct super_block *sb)
146{ 149{
147 struct autofs_sb_info *sbi = autofs4_sbi(sb); 150 struct autofs_sb_info *sbi = autofs4_sbi(sb);
148 151
152 /*
153 * In the event of a failure in get_sb_nodev the superblock
154 * info is not present so nothing else has been setup, so
155 * just exit when we are called from deactivate_super.
156 */
157 if (!sbi)
158 return;
159
149 sb->s_fs_info = NULL; 160 sb->s_fs_info = NULL;
150 161
151 if ( !sbi->catatonic ) 162 if ( !sbi->catatonic )
@@ -310,7 +321,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
310 s->s_fs_info = sbi; 321 s->s_fs_info = sbi;
311 sbi->magic = AUTOFS_SBI_MAGIC; 322 sbi->magic = AUTOFS_SBI_MAGIC;
312 sbi->pipefd = -1; 323 sbi->pipefd = -1;
313 sbi->catatonic = 0; 324 sbi->pipe = NULL;
325 sbi->catatonic = 1;
314 sbi->exp_timeout = 0; 326 sbi->exp_timeout = 0;
315 sbi->oz_pgrp = process_group(current); 327 sbi->oz_pgrp = process_group(current);
316 sbi->sb = s; 328 sbi->sb = s;
@@ -388,6 +400,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
388 goto fail_fput; 400 goto fail_fput;
389 sbi->pipe = pipe; 401 sbi->pipe = pipe;
390 sbi->pipefd = pipefd; 402 sbi->pipefd = pipefd;
403 sbi->catatonic = 0;
391 404
392 /* 405 /*
393 * Success! Install the root dentry now to indicate completion. 406 * Success! Install the root dentry now to indicate completion.
@@ -412,6 +425,8 @@ fail_ino:
412 kfree(ino); 425 kfree(ino);
413fail_free: 426fail_free:
414 kfree(sbi); 427 kfree(sbi);
428 s->s_fs_info = NULL;
429 kill_anon_super(s);
415fail_unlock: 430fail_unlock:
416 return -EINVAL; 431 return -EINVAL;
417} 432}
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index c0a6c8d445c7..1e4a539f4417 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -41,10 +41,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
41 wake_up_interruptible(&wq->queue); 41 wake_up_interruptible(&wq->queue);
42 wq = nwq; 42 wq = nwq;
43 } 43 }
44 if (sbi->pipe) { 44 fput(sbi->pipe); /* Close the pipe */
45 fput(sbi->pipe); /* Close the pipe */ 45 sbi->pipe = NULL;
46 sbi->pipe = NULL;
47 }
48} 46}
49 47
50static int autofs4_write(struct file *file, const void *addr, int bytes) 48static int autofs4_write(struct file *file, const void *addr, int bytes)