Commit 08ae5ec4 authored by Hou Tao's avatar Hou Tao Committed by Greg Kroah-Hartman

ubifs: Reject unsupported ioctl flags explicitly

commit 2fe8b2d5 upstream.

Reject unsupported ioctl flags explicitly, so the following command
on a regular ubifs file will fail:
	chattr +d ubifs_file

And xfstests generic/424 will pass.
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b522ff02
......@@ -28,6 +28,11 @@
#include <linux/mount.h>
#include "ubifs.h"
/* Need to be kept consistent with checked flags in ioctl2ubifs() */
#define UBIFS_SUPPORTED_IOCTL_FLAGS \
(FS_COMPR_FL | FS_SYNC_FL | FS_APPEND_FL | \
FS_IMMUTABLE_FL | FS_DIRSYNC_FL)
/**
* ubifs_set_inode_flags - set VFS inode flags.
* @inode: VFS inode to set flags for
......@@ -169,6 +174,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (get_user(flags, (int __user *) arg))
return -EFAULT;
if (flags & ~UBIFS_SUPPORTED_IOCTL_FLAGS)
return -EOPNOTSUPP;
if (!S_ISDIR(inode->i_mode))
flags &= ~FS_DIRSYNC_FL;
......
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