From: rafad900 <rafad900@gmail.com>
To: shaggy@kernel.org, jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
syzbot+1d096d31de6a0491b55e@syzkaller.appspotmail.com,
skhan@linuxfoundation.org
Subject: [PATCH] jfs: fix null log dereference from sb during readonly mode
Date: Mon, 30 Mar 2026 19:20:49 -0700 [thread overview]
Message-ID: <acsvgUNIqZiVb1R-@tradnomic.core> (raw)
#syz test
Clearing the inode pointer is necessary to ensure no memory leaks
after txBegin fails to initialize the superblock during read only
mode.
- This error was found by syzkaller
- After ialloc() is called within jfs_create(), the inode pointer
is created but never freed when txBegin() fails.
- The patch addresses the need to stop commiting a file
transaction after txBegin() fails and the clean up of pointers.
- The patch was tested on QEMU with the repro provided by syzbot
Signed-off-by: rafad900 <19312533+rafad900@users.noreply.github.com>
---
fs/jfs/namei.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 60c4a0e0fca5..3a5f45cdeae0 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -97,7 +97,13 @@ 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;
+ }
mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
--
2.43.0
reply other threads:[~2026-03-31 2:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acsvgUNIqZiVb1R-@tradnomic.core \
--to=rafad900@gmail.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+1d096d31de6a0491b55e@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox