Commit a36f97b1 authored by Felix Blyakher's avatar Felix Blyakher Committed by Stephen Lord

[XFS] Modified to always pass NULL as data parameter to VOP_ATTR_GET(),

whenever ATTR_KERNOVAL flag is used. 

SGI Modid: 2.5.x-xfs:slinx:147567a
parent 77518190
...@@ -663,8 +663,10 @@ linvfs_getxattr( ...@@ -663,8 +663,10 @@ linvfs_getxattr(
} }
/* Convert Linux syscall to XFS internal ATTR flags */ /* Convert Linux syscall to XFS internal ATTR flags */
if (!size) if (!size) {
xflags |= ATTR_KERNOVAL; xflags |= ATTR_KERNOVAL;
data = NULL;
}
if (strncmp(name, xfs_namespaces[ROOT_NAMES].name, if (strncmp(name, xfs_namespaces[ROOT_NAMES].name,
xfs_namespaces[ROOT_NAMES].namelen) == 0) { xfs_namespaces[ROOT_NAMES].namelen) == 0) {
......
...@@ -226,19 +226,23 @@ xfs_acl_vget( ...@@ -226,19 +226,23 @@ xfs_acl_vget(
int kind) int kind)
{ {
int error; int error;
xfs_acl_t *xfs_acl; xfs_acl_t *xfs_acl = NULL;
posix_acl_xattr_header *ext_acl = acl; posix_acl_xattr_header *ext_acl = acl;
int flags = 0;
VN_HOLD(vp); VN_HOLD(vp);
if ((error = _MAC_VACCESS(vp, NULL, VREAD))) if ((error = _MAC_VACCESS(vp, NULL, VREAD)))
goto out; goto out;
if(size) {
if (!(_ACL_ALLOC(xfs_acl))) { if (!(_ACL_ALLOC(xfs_acl))) {
error = ENOMEM; error = ENOMEM;
goto out; goto out;
} }
memset(xfs_acl, 0, sizeof(xfs_acl_t)); memset(xfs_acl, 0, sizeof(xfs_acl_t));
xfs_acl_get_attr(vp, xfs_acl, kind, size? 0 : ATTR_KERNOVAL, &error); } else
flags = ATTR_KERNOVAL;
xfs_acl_get_attr(vp, xfs_acl, kind, flags, &error);
if (error) if (error)
goto out; goto out;
...@@ -262,6 +266,7 @@ xfs_acl_vget( ...@@ -262,6 +266,7 @@ xfs_acl_vget(
} }
out: out:
VN_RELE(vp); VN_RELE(vp);
if(xfs_acl)
_ACL_FREE(xfs_acl); _ACL_FREE(xfs_acl);
return -error; return -error;
} }
...@@ -657,6 +662,7 @@ xfs_acl_get_attr( ...@@ -657,6 +662,7 @@ xfs_acl_get_attr(
{ {
int len = sizeof(xfs_acl_t); int len = sizeof(xfs_acl_t);
ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1);
flags |= ATTR_ROOT; flags |= ATTR_ROOT;
VOP_ATTR_GET(vp, VOP_ATTR_GET(vp,
kind == _ACL_TYPE_ACCESS ? SGI_ACL_FILE : SGI_ACL_DEFAULT, kind == _ACL_TYPE_ACCESS ? SGI_ACL_FILE : SGI_ACL_DEFAULT,
......
...@@ -115,15 +115,17 @@ xfs_cap_vget( ...@@ -115,15 +115,17 @@ xfs_cap_vget(
int flags = ATTR_ROOT; int flags = ATTR_ROOT;
xfs_cap_set_t xfs_cap = { 0 }; xfs_cap_set_t xfs_cap = { 0 };
posix_cap_xattr *xattr_cap = cap; posix_cap_xattr *xattr_cap = cap;
char *data = (char *)&xfs_cap;
VN_HOLD(vp); VN_HOLD(vp);
if ((error = _MAC_VACCESS(vp, NULL, VREAD))) if ((error = _MAC_VACCESS(vp, NULL, VREAD)))
goto out; goto out;
if (!size) if (!size) {
flags |= ATTR_KERNOVAL; flags |= ATTR_KERNOVAL;
VOP_ATTR_GET(vp, SGI_CAP_LINUX, (char *)&xfs_cap, data = NULL;
&len, flags, sys_cred, error); }
VOP_ATTR_GET(vp, SGI_CAP_LINUX, data, &len, flags, sys_cred, error);
if (error) if (error)
goto out; goto out;
ASSERT(len == sizeof(xfs_cap_set_t)); ASSERT(len == sizeof(xfs_cap_set_t));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment