public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+8aa6090cbe3c97dc9565@syzkaller.appspotmail.com
Cc: adilger.kernel@dilger.ca, jack@suse.cz, libaokun1@huawei.com,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	ritesh.list@gmail.com, syzkaller-bugs@googlegroups.com,
	tytso@mit.edu
Subject: Re: [syzbot] [ext4?] kernel BUG in ext4_inline_data_truncate
Date: Sun,  1 Sep 2024 19:52:27 +0800	[thread overview]
Message-ID: <tencent_27C9A8AECAEEFD8C8FA7E286C892D0865106@qq.com> (raw)
In-Reply-To: <000000000000a0ed7b062109d3da@google.com>

Use EXT4_INODE_HAS_XATTR_SPACE to check the existence of xattr space,
before clear the content in the xattr space

#syz test

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index e7a09a99837b..b568232ab871 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1946,7 +1946,8 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
 			ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
 
 		/* Clear the content in the xattr space. */
-		if (inline_size > EXT4_MIN_INLINE_DATA_SIZE) {
+		if (inline_size > EXT4_MIN_INLINE_DATA_SIZE &&
+		    EXT4_INODE_HAS_XATTR_SPACE(inode)) {
 			if ((err = ext4_xattr_ibody_find(inode, &i, &is)) != 0)
 				goto out_error;
 


  reply	other threads:[~2024-09-01 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01  7:32 [syzbot] [ext4?] kernel BUG in ext4_inline_data_truncate syzbot
2024-09-01 11:52 ` Edward Adam Davis [this message]
2024-09-01 12:34   ` 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=tencent_27C9A8AECAEEFD8C8FA7E286C892D0865106@qq.com \
    --to=eadavis@qq.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=syzbot+8aa6090cbe3c97dc9565@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tytso@mit.edu \
    /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