[PATCH] fs: fix regression querying for ACL on fs's that don't support them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the not too distant past, the VFS ACL infrastructure would return
-EOPNOTSUPP on filesystems (like NFS) that set SB_POSIXACL but that
don't supply a get_acl or get_inode_acl method. On more recent kernels
this returns -ENODATA, which breaks one method of detecting when ACLs
are supported.

Fix __get_acl to also check whether the inode has a "get_(inode_)?acl"
method and to just return -EOPNOTSUPP if not.

Reported-by: Ondrej Valousek <ondrej.valousek.xm@xxxxxxxxxxx>
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
This patch is another approach to fixing this issue. I don't care too
much either way which approach we take, but this may fix the problem
for other filesystems too. Should we take a belt and suspenders
approach here and fix it in both places?
---
 fs/posix_acl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index a05fe94970ce..4c7c62040c43 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -130,8 +130,12 @@ static struct posix_acl *__get_acl(struct mnt_idmap *idmap,
 	if (!is_uncached_acl(acl))
 		return acl;
 
-	if (!IS_POSIXACL(inode))
-		return NULL;
+	/*
+	 * NB: checking this after checking for a cached ACL allows tmpfs
+	 * (which doesn't specify a get_acl operation) to work properly.
+	 */
+	if (!IS_POSIXACL(inode) || (!inode->i_op->get_acl && !inode->i_op->get_inode_acl))
+		return ERR_PTR(-EOPNOTSUPP);
 
 	sentinel = uncached_acl_sentinel(current);
 	p = acl_by_type(inode, type);

---
base-commit: a48fa7efaf1161c1c898931fe4c7f0070964233a
change-id: 20230908-acl-fix-6f8f86930f32

Best regards,
-- 
Jeff Layton <jlayton@xxxxxxxxxx>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux