Re: [External] : [PATCH V2] ocfs2: prevent release journal inode after journal shutdown
From: Mark Tinguely
Date: Tue Aug 19 2025 - 10:18:21 EST
On 8/19/25 8:41 AM, Edward Adam Davis wrote:
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.
Reported-by: syzbot+47d8cb2f2cc1517e515a@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=47d8cb2f2cc1517e515a__;!!ACWV5N9M2RV99hQ!IR4Z9VG7eJItxQAEk4-F5EMvtDaSRSvdmdcMeFjajaLLqAc2Vk9HICGKkI-geAk8gYlrJzH-UEfJuaJ2kw$
Tested-by: syzbot+47d8cb2f2cc1517e515a@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Edward Adam Davis <eadavis@xxxxxx>
---
V1 -> V2: Corrected typos and comments.
fs/ocfs2/inode.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 14bf440ea4df..6c4f78f473fb 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1281,6 +1281,9 @@ static void ocfs2_clear_inode(struct inode *inode)
* the journal is flushed before journal shutdown. Thus it is safe to
* have inodes get cleaned up after journal shutdown.
*/
+ if (!osb->journal)
+ return;
+
jbd2_journal_release_jbd_inode(osb->journal->j_journal,
&oi->ip_jinode);
}
fixes commit da5e7c87827e8caa6a1eeec6d95dcf74ab592a01
(v5.15-5-gda5e7c87827). Also for the stable branch?
Reviewed-by: Mark Tinguely <mark.tinguely@xxxxxxxxxx>