linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] VFS: POSIX ACL fixes
@ 2015-11-03 14:25 Andreas Gruenbacher
  2015-11-03 14:25 ` [PATCH 1/2] vfs: Check attribute names in posix acl xattr handers Andreas Gruenbacher
  2015-11-03 14:25 ` [PATCH 2/2] vfs: Fix the posix_acl_xattr_list return value Andreas Gruenbacher
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2015-11-03 14:25 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel; +Cc: Andreas Gruenbacher

Al,

here are two small POSIX ACL fixes; please merge.

Thanks,
Andreas

Andreas Gruenbacher (2):
  vfs: Check attribute names in posix acl xattr handers
  vfs: Fix the posix_acl_xattr_list return value

 fs/posix_acl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.5.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] vfs: Check attribute names in posix acl xattr handers
  2015-11-03 14:25 [PATCH 0/2] VFS: POSIX ACL fixes Andreas Gruenbacher
@ 2015-11-03 14:25 ` Andreas Gruenbacher
  2015-11-03 14:25 ` [PATCH 2/2] vfs: Fix the posix_acl_xattr_list return value Andreas Gruenbacher
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2015-11-03 14:25 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel; +Cc: Andreas Gruenbacher

The get and set operations of the POSIX ACL xattr handlers failed to check
the attribute names, so all names with "system.posix_acl_access" or
"system.posix_acl_default" as a prefix were accepted.  Reject invalid names
from now on.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/posix_acl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 4fb17de..b1a66e8 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -768,6 +768,8 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
 	struct posix_acl *acl;
 	int error;
 
+	if (strcmp(name, "") != 0)
+		return -EINVAL;
 	if (!IS_POSIXACL(d_backing_inode(dentry)))
 		return -EOPNOTSUPP;
 	if (d_is_symlink(dentry))
@@ -793,6 +795,8 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
 	struct posix_acl *acl = NULL;
 	int ret;
 
+	if (strcmp(name, "") != 0)
+		return -EINVAL;
 	if (!IS_POSIXACL(inode))
 		return -EOPNOTSUPP;
 	if (!inode->i_op->set_acl)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] vfs: Fix the posix_acl_xattr_list return value
  2015-11-03 14:25 [PATCH 0/2] VFS: POSIX ACL fixes Andreas Gruenbacher
  2015-11-03 14:25 ` [PATCH 1/2] vfs: Check attribute names in posix acl xattr handers Andreas Gruenbacher
@ 2015-11-03 14:25 ` Andreas Gruenbacher
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2015-11-03 14:25 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel; +Cc: Andreas Gruenbacher

When a filesystem that contains POSIX ACLs is mounted without ACL support
(-o noacl), the appropriate behavior is not to list any existing POSIX ACL
xattrs.  The return value for list xattr handlers in this case is 0, not an
error code: several filesystems that use the POSIX ACL xattr handlers do
not expect the list operation to fail.

Symlinks cannot have ACLs, so posix_acl_xattr_list will never be called for
symlinks in the first place.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/posix_acl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index b1a66e8..2fdca61 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -833,9 +833,7 @@ posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size,
 	size_t size;
 
 	if (!IS_POSIXACL(d_backing_inode(dentry)))
-		return -EOPNOTSUPP;
-	if (d_is_symlink(dentry))
-		return -EOPNOTSUPP;
+		return 0;
 
 	if (type == ACL_TYPE_ACCESS)
 		xname = POSIX_ACL_XATTR_ACCESS;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-03 14:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 14:25 [PATCH 0/2] VFS: POSIX ACL fixes Andreas Gruenbacher
2015-11-03 14:25 ` [PATCH 1/2] vfs: Check attribute names in posix acl xattr handers Andreas Gruenbacher
2015-11-03 14:25 ` [PATCH 2/2] vfs: Fix the posix_acl_xattr_list return value Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).