mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+4c9d23743a2409b80293@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] Subject: [PATCH] ext4: skip inode expansion on readonly filesystems
Date: Mon, 22 Sep 2025 23:11:46 -0700	[thread overview]
Message-ID: <68d23a22.a70a0220.1b52b.0051.GAE@google.com> (raw)
In-Reply-To: <68c9c3fc.050a0220.3c6139.0e66.GAE@google.com>

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

***

Subject: [PATCH] Subject: [PATCH] ext4: skip inode expansion on readonly filesystems
Author: kartikey406@gmail.com

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


Fix WARNING in ext4_xattr_block_set() during orphan cleanup on readonly
filesystems when debug_want_extra_isize mount option is used.
The issue occurs when ext4_try_to_expand_extra_isize() attempts to modify
inodes on readonly filesystems during orphan cleanup, leading to warnings
when encountering invalid xattr entries. Add a readonly check to skip
expansion in this case.

Reported-by: syzbot+4c9d23743a2409b80293@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=4c9d23743a2409b80293
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 fs/ext4/inode.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5b7a15db4953..67300baa8e4e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -6345,6 +6345,15 @@ static int __ext4_expand_extra_isize(struct inode *inode,
 	unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb);
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	int error;
+	if (sb_rdonly(inode->i_sb)) {
+	    printk(KERN_ERR "ext4: READONLY CHECK TRIGGERED - skipping expansion\n");
+	return 0;
+	}
+
+	if (IS_RDONLY(inode)) {
+	     printk(KERN_ERR "ext4: READONLY CHECK TRIGGERED IS_RDONLY - skipping expansion\n");
+	return 0;
+	}
 
 	/* this was checked at iget time, but double check for good measure */
 	if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
-- 
2.43.0


  parent reply	other threads:[~2025-09-23  6:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 20:09 [syzbot] [ext4?] WARNING in ext4_xattr_block_set (3) syzbot
2025-09-23  5:02 ` Forwarded: [PATCH] ext4: skip inode expansion on readonly filesystems syzbot
2025-09-23  6:11 ` syzbot [this message]
2025-09-23  8:35 ` Forwarded: [PATCH] ext4: handle corrupted xattr entries in ext4_xattr_move_to_block 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=68d23a22.a70a0220.1b52b.0051.GAE@google.com \
    --to=syzbot+4c9d23743a2409b80293@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

all inboxes | Powered by JetHome®