Commit 5fd13189 authored by Jan Kara's avatar Jan Kara Committed by Joel Becker

ocfs2: Don't oops in ocfs2_kill_sb on a failed mount

If we fail to mount the filesystem, we have to be careful not to dereference
uninitialized structures in ocfs2_kill_sb.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent 60e2ec48
...@@ -1218,13 +1218,17 @@ static void ocfs2_kill_sb(struct super_block *sb) ...@@ -1218,13 +1218,17 @@ static void ocfs2_kill_sb(struct super_block *sb)
{ {
struct ocfs2_super *osb = OCFS2_SB(sb); struct ocfs2_super *osb = OCFS2_SB(sb);
/* Failed mount? */
if (!osb || atomic_read(&osb->vol_state) == VOLUME_DISABLED)
goto out;
/* Prevent further queueing of inode drop events */ /* Prevent further queueing of inode drop events */
spin_lock(&dentry_list_lock); spin_lock(&dentry_list_lock);
ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED);
spin_unlock(&dentry_list_lock); spin_unlock(&dentry_list_lock);
/* Wait for work to finish and/or remove it */ /* Wait for work to finish and/or remove it */
cancel_work_sync(&osb->dentry_lock_work); cancel_work_sync(&osb->dentry_lock_work);
out:
kill_block_super(sb); kill_block_super(sb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment