Commit 84fd081f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: reject invalid flags combinations in XFS_IOC_ATTRMULTI_BY_HANDLE

While the flags field in the ABI and the on-disk format allows for
multiple namespace flags, that is a logically invalid combination that
scrub complains about.  Reject it at the ioctl level, as all other
interface already get this right at higher levels.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 953aa9d1
...@@ -462,6 +462,11 @@ xfs_attrmulti_by_handle( ...@@ -462,6 +462,11 @@ xfs_attrmulti_by_handle(
error = 0; error = 0;
for (i = 0; i < am_hreq.opcount; i++) { for (i = 0; i < am_hreq.opcount; i++) {
if ((ops[i].am_flags & ATTR_ROOT) &&
(ops[i].am_flags & ATTR_SECURE)) {
ops[i].am_error = -EINVAL;
continue;
}
ops[i].am_flags &= ~ATTR_KERNEL_FLAGS; ops[i].am_flags &= ~ATTR_KERNEL_FLAGS;
ops[i].am_error = strncpy_from_user((char *)attr_name, ops[i].am_error = strncpy_from_user((char *)attr_name,
......
...@@ -450,6 +450,11 @@ xfs_compat_attrmulti_by_handle( ...@@ -450,6 +450,11 @@ xfs_compat_attrmulti_by_handle(
error = 0; error = 0;
for (i = 0; i < am_hreq.opcount; i++) { for (i = 0; i < am_hreq.opcount; i++) {
if ((ops[i].am_flags & ATTR_ROOT) &&
(ops[i].am_flags & ATTR_SECURE)) {
ops[i].am_error = -EINVAL;
continue;
}
ops[i].am_flags &= ~ATTR_KERNEL_FLAGS; ops[i].am_flags &= ~ATTR_KERNEL_FLAGS;
ops[i].am_error = strncpy_from_user((char *)attr_name, ops[i].am_error = strncpy_from_user((char *)attr_name,
......
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