Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Abhijith Das and committed by
Steven Whitehouse
acd2c8aa acb57a36

+9 -6
+9 -6
fs/gfs2/ops_fstype.c
··· 1237 1237 static void gfs2_kill_sb(struct super_block *sb) 1238 1238 { 1239 1239 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 + } 1245 1247 shrink_dcache_sb(sb); 1246 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 1253 struct file_system_type gfs2_fs_type = {