]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jul 2016 02:31:51 +0000 (19:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jul 2016 02:31:51 +0000 (19:31 -0700)
added patches:
posix_acl-add-set_posix_acl.patch

queue-4.4/posix_acl-add-set_posix_acl.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/posix_acl-add-set_posix_acl.patch b/queue-4.4/posix_acl-add-set_posix_acl.patch
new file mode 100644 (file)
index 0000000..df16a5f
--- /dev/null
@@ -0,0 +1,87 @@
+From 485e71e8fb6356c08c7fc6bcce4bf02c9a9a663f Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruenba@redhat.com>
+Date: Wed, 22 Jun 2016 23:57:25 +0200
+Subject: posix_acl: Add set_posix_acl
+
+From: Andreas Gruenbacher <agruenba@redhat.com>
+
+commit 485e71e8fb6356c08c7fc6bcce4bf02c9a9a663f upstream.
+
+Factor out part of posix_acl_xattr_set into a common function that takes
+a posix_acl, which nfsd can also call.
+
+The prototype already exists in include/linux/posix_acl.h.
+
+Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
+Cc: Christoph Hellwig <hch@infradead.org>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/posix_acl.c |   41 +++++++++++++++++++++++------------------
+ 1 file changed, 23 insertions(+), 18 deletions(-)
+
+--- a/fs/posix_acl.c
++++ b/fs/posix_acl.c
+@@ -788,6 +788,28 @@ posix_acl_xattr_get(const struct xattr_h
+       return error;
+ }
++int
++set_posix_acl(struct inode *inode, int type, struct posix_acl *acl)
++{
++      if (!IS_POSIXACL(inode))
++              return -EOPNOTSUPP;
++      if (!inode->i_op->set_acl)
++              return -EOPNOTSUPP;
++
++      if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
++              return acl ? -EACCES : 0;
++      if (!inode_owner_or_capable(inode))
++              return -EPERM;
++
++      if (acl) {
++              int ret = posix_acl_valid(acl);
++              if (ret)
++                      return ret;
++      }
++      return inode->i_op->set_acl(inode, acl, type);
++}
++EXPORT_SYMBOL(set_posix_acl);
++
+ static int
+ posix_acl_xattr_set(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+@@ -799,30 +821,13 @@ posix_acl_xattr_set(const struct xattr_h
+       if (strcmp(name, "") != 0)
+               return -EINVAL;
+-      if (!IS_POSIXACL(inode))
+-              return -EOPNOTSUPP;
+-      if (!inode->i_op->set_acl)
+-              return -EOPNOTSUPP;
+-
+-      if (handler->flags == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
+-              return value ? -EACCES : 0;
+-      if (!inode_owner_or_capable(inode))
+-              return -EPERM;
+       if (value) {
+               acl = posix_acl_from_xattr(&init_user_ns, value, size);
+               if (IS_ERR(acl))
+                       return PTR_ERR(acl);
+-
+-              if (acl) {
+-                      ret = posix_acl_valid(acl);
+-                      if (ret)
+-                              goto out;
+-              }
+       }
+-
+-      ret = inode->i_op->set_acl(inode, acl, handler->flags);
+-out:
++      ret = set_posix_acl(inode, handler->flags, acl);
+       posix_acl_release(acl);
+       return ret;
+ }
index f8c94fc37384d789475d70d789091d23e7203ea2..36f37759a9a518068aa03c96344c10bc6e94fd75 100644 (file)
@@ -30,6 +30,7 @@ writeback-use-higher-precision-calculation-in-domain_dirty_limits.patch
 nfsd4-rpc-move-backchannel-create-logic-into-rpc-code.patch
 nfsd-always-lock-state-exclusively.patch
 nfsd-extend-the-mutex-holding-region-around-in-nfsd4_process_open2.patch
+posix_acl-add-set_posix_acl.patch
 nfsd-check-permissions-when-setting-acls.patch
 make-nfs_atomic_open-call-d_drop-on-all-open_context-errors.patch
 nfs-fix-another-open_downgrade-bug.patch