From: Darrick J. Wong Date: Fri, 5 Sep 2025 21:17:14 +0000 (-0700) Subject: fuse2fs: fix in_file_group missing the primary process gid X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09fd20c8c658590286dba28f0a9754c227a2186f;p=thirdparty%2Fe2fsprogs.git fuse2fs: fix in_file_group missing the primary process gid I forgot that Unix processes have both a primary group id and a list of supplementary group ids. The primary is provided by the fuse client; the supplemental groups are noted by the Groups: field of /proc/self/status. If a process does not have /any/ supplemental group ids, then in_file_group returns the wrong answer if the inode gid matches the group id provided by the fuse client because it doesn't check that anymore. Make it so the primary group id check always happens. Found by generic/375. Cc: # v1.47.3 Fixes: 3469e6ff606af8 ("fuse2fs: fix group membership checking in op_chmod") Signed-off-by: "Darrick J. Wong" --- diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 0ecdd4f9..b8db298c 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -2303,10 +2303,14 @@ static int in_file_group(struct fuse_context *ctxt, gid_t gid = inode_gid(*inode); int ret; + /* If the inode gid matches the process' primary group, we're done. */ + if (ctxt->gid == gid) + return 1; + ret = get_req_groups(ff, &gids, &nr_gids); if (ret == -ENOENT) { /* magic return code for "could not get caller group info" */ - return ctxt->gid == inode_gid(*inode); + return 0; } if (ret < 0) return ret;