All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: fix reserved group initialization
@ 2026-08-11  2:18 guzebing
  2026-08-11  2:50 ` Ritesh Harjani
  0 siblings, 1 reply; 3+ messages in thread
From: guzebing @ 2026-08-11  2:18 UTC (permalink / raw)
  To: tytso
  Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, yi.zhang,
	linux-ext4, linux-kernel, guzebing

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-11  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11  2:18 [PATCH] ext4: fix reserved group initialization guzebing
2026-08-11  2:50 ` Ritesh Harjani
2026-08-11  8:09   ` guzebing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.