From: Christoph Hellwig Date: Sat, 14 Mar 2020 02:59:30 +0000 (-0400) Subject: xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE X-Git-Tag: v5.6.0-rc0~23 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=352abebff73ff8e1878bdb890e37664e6e132a60;p=users%2Fhch%2Fxfsprogs.git xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE Source kernel commit: 953aa9d136f53e226448dbd801a905c28f8071bf Don't allow passing arbitrary flags as they change behavior including memory allocation that the call stack is not prepared for. Fixes: ddbca70cc45c ("xfs: allocate xattr buffer on demand") Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 94badfa17..91c2cb142 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -26,7 +26,7 @@ struct xfs_attr_list_context; *========================================================================*/ -#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */ +#define ATTR_DONTFOLLOW 0x0001 /* -- ignored, from IRIX -- */ #define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */ #define ATTR_TRUST 0x0004 /* -- unused, from IRIX -- */ #define ATTR_SECURE 0x0008 /* use attrs in security namespace */ @@ -37,7 +37,10 @@ struct xfs_attr_list_context; #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */ #define ATTR_INCOMPLETE 0x4000 /* [kernel] return INCOMPLETE attr keys */ -#define ATTR_ALLOC 0x8000 /* allocate xattr buffer on demand */ +#define ATTR_ALLOC 0x8000 /* [kernel] allocate xattr buffer on demand */ + +#define ATTR_KERNEL_FLAGS \ + (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_INCOMPLETE | ATTR_ALLOC) #define XFS_ATTR_FLAGS \ { ATTR_DONTFOLLOW, "DONTFOLLOW" }, \