xfs
[Top] [All Lists]

[PATCH 1/2] xfs: Fixes to "invalidate cached acl if set directly via xat

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: [PATCH 1/2] xfs: Fixes to "invalidate cached acl if set directly via xattr"
From: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Date: Mon, 2 Nov 2015 20:52:53 +0100
Cc: Brian Foster <bfoster@xxxxxxxxxx>, xfs@xxxxxxxxxxx, Andreas Gruenbacher <agruenba@xxxxxxxxxx>, Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1446493974-24669-1-git-send-email-agruenba@xxxxxxxxxx>
In-reply-to: <20151102025352.GY19199@dastard>
References: <1446493974-24669-1-git-send-email-agruenba@xxxxxxxxxx>
References: <1446217508-22157-1-git-send-email-agruenba@xxxxxxxxxx> <20151102025352.GY19199@dastard>
Don't match arbitrary name prefixes like "S" when checking for the
attribute names "SGI_ACL_{FILE,DEFAULT}".

Function forget_cached_acl only exists in kernels that have POSIX ACL
support; guard calls to that function by CONFIG_XFS_POSIX_ACL.

Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
---
 fs/xfs/xfs_xattr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 2e1eb80..1542d64 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -80,10 +80,12 @@ xfs_xattr_set(struct dentry *dentry, const char *name, 
const void *value,
         * consistent.
         */
        if (!error && (xflags & ATTR_ROOT)) {
-               if (!strncmp(name, SGI_ACL_FILE, strlen(name)))
+#ifdef CONFIG_XFS_POSIX_ACL
+               if (!strcmp(name, SGI_ACL_FILE)
                        forget_cached_acl(VFS_I(ip), ACL_TYPE_ACCESS);
-               else if (!strncmp(name, SGI_ACL_DEFAULT, strlen(name)))
+               else if (!strcmp(name, SGI_ACL_DEFAULT))
                        forget_cached_acl(VFS_I(ip), ACL_TYPE_DEFAULT);
+#endif
        }
 
        return error;
-- 
2.5.0

<Prev in Thread] Current Thread [Next in Thread>