linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Hou Tao <houtao1@huawei.com>
Cc: linux-mtd@lists.infradead.org, adrian.hunter@intel.com,
	dedekind1@gmail.com
Subject: Re: [PATCH] ubifs: reject unsupported ioctl flags explicitly
Date: Thu, 14 Feb 2019 08:43:47 +0100	[thread overview]
Message-ID: <4196190.pOxQ1y5nLB@blindfold> (raw)
In-Reply-To: <20190209085420.2375-1-houtao1@huawei.com>

Am Samstag, 9. Februar 2019, 09:54:20 CET schrieb Hou Tao:
> 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: Hou Tao <houtao1@huawei.com>
> ---
>  fs/ubifs/ioctl.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
> index 0164bcc827f8..daf9f93e15de 100644
> --- a/fs/ubifs/ioctl.c
> +++ b/fs/ubifs/ioctl.c
> @@ -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;
>  
> 

Makes sense, will queue for the next merge window. :-)

Thanks,
//richard




______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      parent reply	other threads:[~2019-02-14  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09  8:54 [PATCH] ubifs: reject unsupported ioctl flags explicitly Hou Tao
2019-02-13  6:50 ` Hou Tao
2019-02-13  9:37   ` Richard Weinberger
2019-02-14  7:43 ` Richard Weinberger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4196190.pOxQ1y5nLB@blindfold \
    --to=richard@nod.at \
    --cc=adrian.hunter@intel.com \
    --cc=dedekind1@gmail.com \
    --cc=houtao1@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).