public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+5f0d7af0e45fae10edd1@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Re: general protection fault in jfs_error()
Date: Mon, 18 Nov 2024 02:06:22 -0800	[thread overview]
Message-ID: <673b119e.050a0220.87769.0028.GAE@google.com> (raw)
In-Reply-To: <67381991.050a0220.57553.0045.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: general protection fault in jfs_error()
Author: dmantipov@yandex.ru

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git adc218676eef25575469234709c2d87185ca223a

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index d68a4e6ac345..d2eff3375aad 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -96,24 +96,29 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 	}
 
 	tid = txBegin(dip->i_sb, 0);
+	/* Do not go further if jfs_handle_error() marks us read-only. */
+	if (unlikely(dip->i_sb->s_flags & SB_RDONLY)) {
+		rc = -EROFS;
+		goto out3;
+	}
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
 
 	rc = jfs_init_acl(tid, ip, dip);
 	if (rc)
-		goto out3;
+		goto out4;
 
 	rc = jfs_init_security(tid, ip, dip, &dentry->d_name);
 	if (rc) {
 		txAbort(tid, 0);
-		goto out3;
+		goto out4;
 	}
 
 	if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
 		jfs_err("jfs_create: dtSearch returned %d", rc);
 		txAbort(tid, 0);
-		goto out3;
+		goto out4;
 	}
 
 	tblk = tid_to_tblock(tid);
@@ -140,7 +145,7 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 			txAbort(tid, 1);	/* Marks Filesystem dirty */
 		} else
 			txAbort(tid, 0);	/* Filesystem full */
-		goto out3;
+		goto out4;
 	}
 
 	ip->i_op = &jfs_file_inode_operations;
@@ -155,10 +160,12 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 
 	rc = txCommit(tid, 2, &iplist[0], 0);
 
-      out3:
+      out4:
 	txEnd(tid);
 	mutex_unlock(&JFS_IP(ip)->commit_mutex);
 	mutex_unlock(&JFS_IP(dip)->commit_mutex);
+
+      out3:
 	if (rc) {
 		free_ea_wmap(ip);
 		clear_nlink(ip);

  reply	other threads:[~2024-11-18 10:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16  4:03 [syzbot] [jfs?] general protection fault in jfs_error (2) syzbot
2024-11-18 10:06 ` syzbot [this message]
2024-11-19  6:24 ` [syzbot] Re: general protection fault in jfs_error() syzbot

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=673b119e.050a0220.87769.0028.GAE@google.com \
    --to=syzbot+5f0d7af0e45fae10edd1@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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