diff options
author | Abhijith Das <adas@redhat.com> | 2008-09-15 09:54:06 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-09-15 11:08:32 -0400 |
commit | acd2c8aa02f302ed838348052e16ee575c645147 (patch) | |
tree | 2348e1103be0a2ada199b1b8bbac58bb646b5f57 /fs/gfs2 | |
parent | acb57a3652c614efed26080dad5972c0076166b1 (diff) |
GFS2: GFS2 will panic if you misspell any mount options
The gfs2 superblock pointer is NULL after a failed mount. When control
eventually goes to gfs2_kill_sb, we dereference this NULL pointer. This
patch ensures that the gfs2 superblock pointer is not NULL before being
dereferenced in gfs2_kill_sb.
Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/ops_fstype.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index a6225cce2cbc..ae35f097aa6a 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -1237,14 +1237,17 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, | |||
1237 | static void gfs2_kill_sb(struct super_block *sb) | 1237 | static void gfs2_kill_sb(struct super_block *sb) |
1238 | { | 1238 | { |
1239 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1239 | struct gfs2_sbd *sdp = sb->s_fs_info; |
1240 | gfs2_meta_syncfs(sdp); | 1240 | if (sdp) { |
1241 | dput(sdp->sd_root_dir); | 1241 | gfs2_meta_syncfs(sdp); |
1242 | dput(sdp->sd_master_dir); | 1242 | dput(sdp->sd_root_dir); |
1243 | sdp->sd_root_dir = NULL; | 1243 | dput(sdp->sd_master_dir); |
1244 | sdp->sd_master_dir = NULL; | 1244 | sdp->sd_root_dir = NULL; |
1245 | sdp->sd_master_dir = NULL; | ||
1246 | } | ||
1245 | shrink_dcache_sb(sb); | 1247 | shrink_dcache_sb(sb); |
1246 | kill_block_super(sb); | 1248 | kill_block_super(sb); |
1247 | gfs2_delete_debugfs_file(sdp); | 1249 | if (sdp) |
1250 | gfs2_delete_debugfs_file(sdp); | ||
1248 | } | 1251 | } |
1249 | 1252 | ||
1250 | struct file_system_type gfs2_fs_type = { | 1253 | struct file_system_type gfs2_fs_type = { |