xfs
[Top] [All Lists]

[PATCH] check for invalid flags in xfs_attrlist_by_handle

To: xfs@xxxxxxxxxxx
Subject: [PATCH] check for invalid flags in xfs_attrlist_by_handle
From: Christoph Hellwig <hch@xxxxxx>
Date: Sat, 31 May 2008 09:58:29 +0200
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
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.


Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c     2008-05-28 
17:37:02.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c  2008-05-28 17:42:18.000000000 
+0200
@@ -470,6 +470,12 @@ xfs_attrlist_by_handle(
        if (al_hreq.buflen > XATTR_LIST_MAX)
                return -XFS_ERROR(EINVAL);
 
+       /*
+        * Reject flags, only allow namespaces.
+        */
+       if (al_hreq.flags & ~(ATTR_ROOT|ATTR_TRUST|ATTR_SECURE))
+               return -XFS_ERROR(EINVAL);
+
        error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, &inode);
        if (error)
                goto out;


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] check for invalid flags in xfs_attrlist_by_handle, Christoph Hellwig <=