]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: fix default acls propagating to non-dir children
authorDarrick J. Wong <djwong@kernel.org>
Fri, 5 Sep 2025 20:29:44 +0000 (13:29 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 17 Oct 2025 23:34:22 +0000 (16:34 -0700)
New non-directory children should not be copying the default ACLs of the
parents.  Caught by generic/099 in fuseblk/iomap mode.

Cc: <linux-ext4@vger.kernel.org> # v1.47.3
Fixes: 2c7900387620a6 ("fuse2fs: propagate default ACLs to new children")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c

index 5e610be2760a5a84ac53134011c40d5dc69861a2..0f655c41372cc753ece1ae88772005512ed15a07 100644 (file)
@@ -1167,13 +1167,13 @@ out_close:
 }
 
 static int propagate_default_acls(struct fuse2fs *ff, ext2_ino_t parent,
-                                 ext2_ino_t child)
+                                 ext2_ino_t child, mode_t mode)
 {
        void *def;
        size_t deflen;
        int ret;
 
-       if (!ff->acl)
+       if (!ff->acl || S_ISDIR(mode))
                return 0;
 
        ret = __getxattr(ff, parent, XATTR_NAME_POSIX_ACL_DEFAULT, &def,
@@ -1346,7 +1346,7 @@ static int op_mknod(const char *path, mode_t mode, dev_t dev)
 
        ext2fs_inode_alloc_stats2(fs, child, 1, 0);
 
-       ret = propagate_default_acls(ff, parent, child);
+       ret = propagate_default_acls(ff, parent, child, inode.i_mode);
        if (ret)
                goto out2;
 out2:
@@ -1474,7 +1474,7 @@ static int op_mkdir(const char *path, mode_t mode)
                goto out3;
        }
 
-       ret = propagate_default_acls(ff, parent, child);
+       ret = propagate_default_acls(ff, parent, child, inode.i_mode);
        if (ret)
                goto out3;
 
@@ -3543,7 +3543,7 @@ static int op_create(const char *path, mode_t mode, struct fuse_file_info *fp)
 
        ext2fs_inode_alloc_stats2(fs, child, 1, 0);
 
-       ret = propagate_default_acls(ff, parent, child);
+       ret = propagate_default_acls(ff, parent, child, inode.i_mode);
        if (ret)
                goto out2;