From 953aa9d136f53e226448dbd801a905c28f8071bf Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 7 Jan 2020 15:25:37 -0800 Subject: xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE 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 --- fs/xfs/xfs_ioctl32.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/xfs/xfs_ioctl32.c') diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index a49bd80b2c3b..20b3edc10f48 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -450,6 +450,8 @@ xfs_compat_attrmulti_by_handle( error = 0; for (i = 0; i < am_hreq.opcount; i++) { + ops[i].am_flags &= ~ATTR_KERNEL_FLAGS; + ops[i].am_error = strncpy_from_user((char *)attr_name, compat_ptr(ops[i].am_attrname), MAXNAMELEN); -- cgit v1.2.3-59-g8ed1b