Commit 90ad58a8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Niv Sardi

[XFS] Check for invalid flags in xfs_attrlist_by_handle.

xfs_attrlist_by_handle should only take the ATTR_ flags for the root
namespaces. The ATTR_KERN* flags may change at anytime and expect special
preconditions that can't be guaranteed for userspace-originating requests.
For example passing down ATTR_KERNNOVAL through xfs_attrlist_by_handle
will hit an assert in debug builds currently.

SGI-PV: 983677

SGI-Modid: xfs-linux-melb:xfs-kern:31351a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent 07fe4dd4
...@@ -468,6 +468,12 @@ xfs_attrlist_by_handle( ...@@ -468,6 +468,12 @@ xfs_attrlist_by_handle(
if (al_hreq.buflen > XATTR_LIST_MAX) if (al_hreq.buflen > XATTR_LIST_MAX)
return -XFS_ERROR(EINVAL); return -XFS_ERROR(EINVAL);
/*
* Reject flags, only allow namespaces.
*/
if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
return -XFS_ERROR(EINVAL);
error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, &inode); error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, &inode);
if (error) if (error)
goto out; goto out;
......
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