Skip to content

Commit 8f6ee74

Browse files
author
Miklos Szeredi
committed
ovl: rearrange ovl_can_list()
ovl_can_list() should return false for overlay private xattrs. Since currently these use the "trusted.overlay." prefix, they will always match the "trusted." prefix as well, hence the test for being non-trusted will not trigger. Prepare for using the "user.overlay." namespace by moving the test for private xattr before the test for non-trusted. This patch doesn't change behavior. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 43d193f commit 8f6ee74

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

fs/overlayfs/inode.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,16 @@ int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
393393

394394
static bool ovl_can_list(struct super_block *sb, const char *s)
395395
{
396+
/* Never list private (.overlay) */
397+
if (ovl_is_private_xattr(sb, s))
398+
return false;
399+
396400
/* List all non-trusted xatts */
397401
if (strncmp(s, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) != 0)
398402
return true;
399403

400-
/* Never list trusted.overlay, list other trusted for superuser only */
401-
return !ovl_is_private_xattr(sb, s) &&
402-
ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
404+
/* list other trusted for superuser only */
405+
return ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
403406
}
404407

405408
ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)

0 commit comments

Comments
 (0)