[PATCH] jfs: prevent null log deference from superblock during read only mode Clearing the inode pointer is necessary to ensure no memory leaks after txBegin fails to initialize the superblock during read only mode.
From: rafad900
Date: Mon Mar 30 2026 - 16:33:13 EST
Signed-off-by: rafad900 <19312533+rafad900@xxxxxxxxxxxxxxxxxxxxxxxx>
---
fs/jfs/namei.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 25b303276b82..6d5a1f8f72ab 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -99,6 +99,9 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
tid = txBegin(dip->i_sb, 0);
if (tid == 0) {
jfs_err("jfs_create: unable to create tblk due to read only filesystem");
+ free_ea_wmap(ip);
+ clear_nlink(ip);
+ discard_new_inode(ip);
return -EROFS;
}
--
2.43.0
--ZchI6auHD07NQ05j--