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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
Christoph Hellwig 2020-01-07 15:25:38 -08:00 committed by Darrick J. Wong
parent 953aa9d136
commit 84fd081f8a
2 changed files with 10 additions and 0 deletions

View File

@ -462,6 +462,11 @@ xfs_attrmulti_by_handle(
error = 0;
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_error = strncpy_from_user((char *)attr_name,

View File

@ -450,6 +450,11 @@ xfs_compat_attrmulti_by_handle(
error = 0;
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_error = strncpy_from_user((char *)attr_name,