Skip to content

Commit f46e8ef

Browse files
ea1davisakpm00
authored andcommitted
ocfs2: prevent release journal inode after journal shutdown
Before calling ocfs2_delete_osb(), ocfs2_journal_shutdown() has already been executed in ocfs2_dismount_volume(), so osb->journal must be NULL. Therefore, the following calltrace will inevitably fail when it reaches jbd2_journal_release_jbd_inode(). ocfs2_dismount_volume()-> ocfs2_delete_osb()-> ocfs2_free_slot_info()-> __ocfs2_free_slot_info()-> evict()-> ocfs2_evict_inode()-> ocfs2_clear_inode()-> jbd2_journal_release_jbd_inode(osb->journal->j_journal, Adding osb->journal checks will prevent null-ptr-deref during the above execution path. Link: https://lkml.kernel.org/r/[email protected] Fixes: da5e7c8 ("ocfs2: cleanup journal init and shutdown") Signed-off-by: Edward Adam Davis <[email protected]> Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=47d8cb2f2cc1517e515a Tested-by: [email protected] Reviewed-by: Mark Tinguely <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Jun Piao <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5cc5e03 commit f46e8ef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ocfs2/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,9 @@ static void ocfs2_clear_inode(struct inode *inode)
12811281
* the journal is flushed before journal shutdown. Thus it is safe to
12821282
* have inodes get cleaned up after journal shutdown.
12831283
*/
1284+
if (!osb->journal)
1285+
return;
1286+
12841287
jbd2_journal_release_jbd_inode(osb->journal->j_journal,
12851288
&oi->ip_jinode);
12861289
}

0 commit comments

Comments
 (0)