Skip to content

Commit acd2c8a

Browse files
Abhijith Dasswhiteho
authored andcommitted
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 <[email protected]> Signed-off-by: Steven Whitehouse <[email protected]>
1 parent acb57a3 commit acd2c8a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fs/gfs2/ops_fstype.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,14 +1237,17 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
12371237
static void gfs2_kill_sb(struct super_block *sb)
12381238
{
12391239
struct gfs2_sbd *sdp = sb->s_fs_info;
1240-
gfs2_meta_syncfs(sdp);
1241-
dput(sdp->sd_root_dir);
1242-
dput(sdp->sd_master_dir);
1243-
sdp->sd_root_dir = NULL;
1244-
sdp->sd_master_dir = NULL;
1240+
if (sdp) {
1241+
gfs2_meta_syncfs(sdp);
1242+
dput(sdp->sd_root_dir);
1243+
dput(sdp->sd_master_dir);
1244+
sdp->sd_root_dir = NULL;
1245+
sdp->sd_master_dir = NULL;
1246+
}
12451247
shrink_dcache_sb(sb);
12461248
kill_block_super(sb);
1247-
gfs2_delete_debugfs_file(sdp);
1249+
if (sdp)
1250+
gfs2_delete_debugfs_file(sdp);
12481251
}
12491252

12501253
struct file_system_type gfs2_fs_type = {

0 commit comments

Comments
 (0)