Commit e9188f66 authored by Edward Adam Davis's avatar Edward Adam Davis Committed by Greg Kroah-Hartman
Browse files

ocfs2: prevent release journal inode after journal shutdown

commit f46e8ef8 upstream.

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/tencent_357489BEAEE4AED74CBD67D246DBD2C4C606@qq.com


Fixes: da5e7c87 ("ocfs2: cleanup journal init and shutdown")
Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
Reported-by: default avatar <syzbot+47d8cb2f2cc1517e515a@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=47d8cb2f2cc1517e515a


Tested-by: default avatar <syzbot+47d8cb2f2cc1517e515a@syzkaller.appspotmail.com>
Reviewed-by: default avatarMark Tinguely <mark.tinguely@oracle.com>
Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f9b8d4db
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment