From: guzebing <guzebing1612@gmail.com>
To: tytso@mit.edu
Cc: adilger.kernel@dilger.ca, libaokun@linux.alibaba.com,
jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com,
yi.zhang@huawei.com, linux-ext4@vger.kernel.org,
linux-kernel@vger.kernel.org, guzebing <guzebing1612@gmail.com>
Subject: [PATCH] ext4: fix reserved group initialization
Date: Tue, 11 Aug 2026 10:18:48 +0800 [thread overview]
Message-ID: <20260811021848.1821435-1-guzebing1612@gmail.com> (raw)
ext4 initializes the in-memory reserved uid and gid from the on-disk
default reserved id fields during mount. The s_resgid assignment
accidentally uses ext4_get_resuid(), so the reserved group is initialized
from the reserved uid instead of the reserved gid.
As a result, members of the configured reserved group can be denied access
to reserved blocks, while members of a group whose gid matches the
reserved uid can be incorrectly allowed to use them.
Initialize s_resgid with ext4_get_resgid() instead.
Fixes: 12c84dd4d308 ("ext4: add support for 32-bit default reserved uid and gid values")
Signed-off-by: guzebing <guzebing1612@gmail.com>
---
fs/ext4/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 245f67d10ded3..63de62a75a543 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5369,7 +5369,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
ext4_set_def_opts(sb, es);
sbi->s_resuid = make_kuid(&init_user_ns, ext4_get_resuid(es));
- sbi->s_resgid = make_kgid(&init_user_ns, ext4_get_resuid(es));
+ sbi->s_resgid = make_kgid(&init_user_ns, ext4_get_resgid(es));
sbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;
sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;
sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;
base-commit: 06cf61899d6498b33e4b7c87d99d5bd471ccc375
--
2.20.1
next reply other threads:[~2026-08-11 2:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 2:18 guzebing [this message]
2026-08-11 2:50 ` [PATCH] ext4: fix reserved group initialization Ritesh Harjani
2026-08-11 8:09 ` guzebing
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=20260811021848.1821435-1-guzebing1612@gmail.com \
--to=guzebing1612@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.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