Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: arzuagapozosergio@gmail.com
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH v7] ext4: bound xattr journal credits to transaction limit
Date: Wed, 25 Nov 2026 06:47:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-232734@kernel.org> (raw)
In-Reply-To: <20261125063023.18022-1-arzuagapozosergio@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ext4: unbounded xattr journal credits in __ext4_new_inode()
--

commit 7d32898686e8e393a0ba63d6580e4c83b8362716
Author: Ryuji Hiroshi <arzuagapozosergio@gmail.com>

ext4: bound xattr journal credits to transaction limit

This commit removes the old-ea_inode dereference credits from
__ext4_xattr_set_credits(), bounds ext4_xattr_set_credits() against the
maximum JBD2 transaction buffers, drops provisional ea_inode references
when reusing cached xattr blocks, and adds an ext4 kselftest.

Link: https://syzbot.org/bug?extid=25d45c0bd716f2b794a7

> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 527f1f703c3e0..82623f5635c4c 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -888,8 +888,7 @@ static int ext4_xattr_credits_for_new_inode(struct inode *dir, mode_t mode,
>  
>  		nblocks += (S_ISDIR(mode) ? 2 : 1) *
>  			__ext4_xattr_set_credits(sb, NULL /* inode */,
> -						 NULL /* block_bh */, acl_size,
> -						 true /* is_create */);
> +						 NULL /* block_bh */, acl_size);
>  		posix_acl_release(p);
>  	}
>  #endif

[Severity: High]
Can nblocks in __ext4_new_inode() still exceed the journal transaction
limit when creating an inode in a directory with a large default ACL?

Dropping the old-ea_inode dereference credits allows ext4_set_acl() to set
a default POSIX ACL up to ~64 KiB on a 1 KiB-block ea_inode filesystem
with a 1 MiB journal.  When a subdirectory is later created in that
directory, ext4_xattr_credits_for_new_inode() charges 2 *
__ext4_xattr_set_credits() for the inherited default and access ACLs plus
security and fscrypt xattr credits, without checking the total against
jbd2_journal_get_max_transaction_buffers():

fs/ext4/ialloc.c:__ext4_new_inode() {
	...
	if (!handle && sbi->s_journal && !(i_flags & EXT4_EA_INODE_FL)) {
		ret2 = ext4_xattr_credits_for_new_inode(dir, mode, encrypt);
		if (ret2 < 0) {
			err = ret2;
			goto out;
		}
		nblocks += ret2;
	}
	...
			handle = __ext4_journal_start_sb(NULL, dir->i_sb,
				 line_no, handle_type, nblocks, 0,
				 ext4_trans_default_revoke_credits(sb));
			if (IS_ERR(handle)) {
				err = PTR_ERR(handle);
				ext4_std_error(sb, err);
				goto out;
			}
}

For a default ACL of 20 KiB or larger, nblocks exceeds the 248-buffer
limit, triggering WARN_ON(1) in start_this_handle() and passing -ENOSPC to
ext4_std_error(), which aborts the filesystem.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125063023.18022-1-arzuagapozosergio@gmail.com?part=1

  reply	other threads:[~2026-11-25  6:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  7:53 [PATCH] ext4: bound xattr journal credits to transaction limit arzuagapozosergio
2026-11-22  8:09 ` sashiko-bot
2026-11-22  8:49 ` [PATCH v2] " arzuagapozosergio
2026-11-22  9:09   ` sashiko-bot
2026-11-22  9:37   ` [PATCH v3] " arzuagapozosergio
2026-11-22  9:53     ` sashiko-bot
2026-11-24 12:38     ` Jan Kara
2026-11-25  4:51     ` [PATCH v4] " arzuagapozosergio
2026-11-25  5:09       ` sashiko-bot
2026-11-25  5:19       ` [PATCH v5] " arzuagapozosergio
2026-11-25  5:39         ` sashiko-bot
2026-11-25  6:01         ` [PATCH v6] " arzuagapozosergio
2026-11-25  6:23           ` sashiko-bot
2026-11-25  6:30           ` [PATCH v7] " arzuagapozosergio
2026-11-25  6:47             ` sashiko-bot [this message]
2026-11-25  7:00             ` [PATCH v8] " arzuagapozosergio

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=sashiko-outbox-232734@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arzuagapozosergio@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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