* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_MDS
#include <obd_class.h>
-#include <lustre_ver.h>
#include <lprocfs_status.h>
#include <lustre_mds.h>
#include <lustre_idmap.h>
ENTRY;
lu_buf_check_and_alloc(&mdd_env_info(env)->mti_xattr_buf,
- mdd_obj2mdd_dev(o)->mdd_dt_conf.ddp_max_ea_size);
+ MIN(mdd_obj2mdd_dev(o)->mdd_dt_conf.ddp_max_ea_size,
+ XATTR_SIZE_MAX));
buf = mdd_env_info(env)->mti_xattr_buf;
+ if (buf.lb_buf == NULL)
+ RETURN(-ENOMEM);
+
+ if (buf.lb_len > XATTR_SIZE_MAX)
+ buf.lb_len = XATTR_SIZE_MAX;
+
rc = mdo_xattr_get(env, o, &buf, XATTR_NAME_ACL_ACCESS);
if ((rc == -EOPNOTSUPP) || (rc == -ENODATA))
RETURN(0);
buf.lb_len = rc;
head = (posix_acl_xattr_header *)(buf.lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf.lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
ENTRY;
head = (posix_acl_xattr_header *)(buf->lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf->lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
ENTRY;
head = (posix_acl_xattr_header *)(buf->lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf->lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
ENTRY;
lu_buf_check_and_alloc(&mdd_env_info(env)->mti_xattr_buf,
- mdd_obj2mdd_dev(obj)->mdd_dt_conf.ddp_max_ea_size);
+ MIN(mdd_obj2mdd_dev(obj)->mdd_dt_conf.ddp_max_ea_size,
+ XATTR_SIZE_MAX));
buf = mdd_env_info(env)->mti_xattr_buf;
+ if (buf.lb_buf == NULL)
+ RETURN(-ENOMEM);
+
+ if (buf.lb_len > XATTR_SIZE_MAX)
+ buf.lb_len = XATTR_SIZE_MAX;
+
rc = mdo_xattr_get(env, obj, &buf, XATTR_NAME_ACL_ACCESS);
if (rc <= 0)
RETURN(rc ? : -EACCES);
buf.lb_len = rc;
head = (posix_acl_xattr_header *)(buf.lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = posix_acl_xattr_count(buf.lb_len);
/* Disregard empty ACLs and fall back to