From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] xfs: sanitize remount options
Date: Mon, 15 Feb 2016 13:54:25 -0500 [thread overview]
Message-ID: <20160215185424.GB33291@bfoster.bfoster> (raw)
In-Reply-To: <56BBCA55.3000506@sandeen.net>
On Wed, Feb 10, 2016 at 05:40:05PM -0600, Eric Sandeen wrote:
> Perform basic sanitization of remount options by
> passing the option string and a dummy mount structure
> through xfs_parseargs and returning the result.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 934233a..d1cd4fa 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1168,6 +1168,27 @@ xfs_quiesce_attr(
> }
>
> STATIC int
> +xfs_test_remount_options(
> + struct super_block *sb,
> + struct xfs_mount *mp,
> + char *options)
> +{
> + int error = 0;
> + struct xfs_mount *tmp;
> +
> + tmp = kmem_zalloc(sizeof(*tmp), KM_MAYFAIL);
> + if (!tmp)
> + return -ENOMEM;
> +
> + tmp->m_super = sb;
> + error = xfs_parseargs(tmp, options);
> + xfs_free_fsname(tmp);
> + kfree(tmp);
> +
> + return error;
> +}
This seems fine:
Reviewed-by: Brian Foster <bfoster@redhat.com>
... though I get a little bit nervous about xfs_parseargs() changing
some other data structure down the road. I wonder if we should constify
the sb pointer in xfs_parseargs() with a quick comment as to why..?
Brian
> +
> +STATIC int
> xfs_fs_remount(
> struct super_block *sb,
> int *flags,
> @@ -1179,6 +1200,11 @@ xfs_fs_remount(
> char *p;
> int error;
>
> + /* First, check for complete junk; i.e. invalid options */
> + error = xfs_test_remount_options(sb, mp, options);
> + if (error)
> + return error;
> +
> sync_filesystem(sb);
> while ((p = strsep(&options, ",")) != NULL) {
> int token;
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-02-15 18:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 23:36 [PATCH 0/3] xfs: mount option handling fixups Eric Sandeen
2016-02-10 23:38 ` [PATCH 1/3] xfs: convert mount option parsing to tokens Eric Sandeen
2016-02-15 18:54 ` Brian Foster
2016-02-15 21:20 ` [PATCH 1/3 V2] " Eric Sandeen
2016-02-17 16:54 ` Christoph Hellwig
2016-02-17 17:19 ` [PATCH 1/3 V3] " Eric Sandeen
2016-02-10 23:40 ` [PATCH 2/3] xfs: sanitize remount options Eric Sandeen
2016-02-15 18:54 ` Brian Foster [this message]
2016-02-17 4:29 ` [PATCH 2/3 V2] " Eric Sandeen
2016-02-17 16:55 ` Christoph Hellwig
2016-02-10 23:45 ` [PATCH 3/3] xfs: test for valid remount options, error if not Eric Sandeen
2016-02-15 18:54 ` Brian Foster
2016-02-15 20:25 ` Dave Chinner
2016-02-15 23:07 ` Eric Sandeen
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=20160215185424.GB33291@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/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