summaryrefslogtreecommitdiff
path: root/fs/autofs
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2006-11-14 13:03:29 +0300
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-14 20:09:27 +0300
commitba8df43c0ee93ec05fc526278a80aaf4cb5ab1fa (patch)
tree510db3f9141e0bf091eccaf7ef7a0db3c81338bb /fs/autofs
parent6a34b57bec41c95f1e38f700cd9b81324baaffc7 (diff)
downloadlinux-ba8df43c0ee93ec05fc526278a80aaf4cb5ab1fa.tar.xz
[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/autofs')
-rw-r--r--fs/autofs/inode.c14
-rw-r--r--fs/autofs/waitq.c1
2 files changed, 14 insertions, 1 deletions
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 54c518c89e4c..38ede5c9d6fd 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -25,6 +25,14 @@ void autofs_kill_sb(struct super_block *sb)
struct autofs_sb_info *sbi = autofs_sbi(sb);
unsigned int n;
+ /*
+ * In the event of a failure in get_sb_nodev the superblock
+ * info is not present so nothing else has been setup, so
+ * just exit when we are called from deactivate_super.
+ */
+ if (!sbi)
+ return;
+
if ( !sbi->catatonic )
autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */
@@ -136,7 +144,8 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
s->s_fs_info = sbi;
sbi->magic = AUTOFS_SBI_MAGIC;
- sbi->catatonic = 0;
+ sbi->pipe = NULL;
+ sbi->catatonic = 1;
sbi->exp_timeout = 0;
sbi->oz_pgrp = process_group(current);
autofs_initialize_hash(&sbi->dirhash);
@@ -180,6 +189,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
if ( !pipe->f_op || !pipe->f_op->write )
goto fail_fput;
sbi->pipe = pipe;
+ sbi->catatonic = 0;
/*
* Success! Install the root dentry now to indicate completion.
@@ -198,6 +208,8 @@ fail_iput:
iput(root_inode);
fail_free:
kfree(sbi);
+ s->s_fs_info = NULL;
+ kill_anon_super(s);
fail_unlock:
return -EINVAL;
}
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
index 633f628005b4..19a9cafb5ddf 100644
--- a/fs/autofs/waitq.c
+++ b/fs/autofs/waitq.c
@@ -41,6 +41,7 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi)
wq = nwq;
}
fput(sbi->pipe); /* Close the pipe */
+ sbi->pipe = NULL;
autofs_hash_dputall(&sbi->dirhash); /* Remove all dentry pointers */
}