mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, chao@kernel.org
Subject: Re: [PATCH] f2fs: add sanity check for quota sysfile ino
Date: Tue, 30 Jan 2018 17:35:56 -0800	[thread overview]
Message-ID: <20180131013556.GE65489@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <20180129082933.64556-1-yuchao0@huawei.com>

On 01/29, Chao Yu wrote:
> Add missing sanity check for quota sysfile ino.

We don't need to limit the specific inode numbers for quota files, since
we may be able to set any inode numbers later. How about checkint the
numbers are allocated as quota?

> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/super.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 368f63d7bad2..6011071688ca 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2116,6 +2116,25 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
>  		return 1;
>  	}
>  
> +	/* check quota sysfile ino info */
> +	if (raw_super->feature & cpu_to_le32(F2FS_FEATURE_QUOTA_INO)) {
> +		if (le32_to_cpu(raw_super->qf_ino[0]) != 4 ||
> +			le32_to_cpu(raw_super->qf_ino[1]) != 5) {
> +			f2fs_msg(sb, KERN_INFO,
> +				"Invalid Quota Ino: user_ino(%u), grp_ino(%u)",
> +				le32_to_cpu(raw_super->qf_ino[0]),
> +				le32_to_cpu(raw_super->qf_ino[1]));
> +			return 1;
> +		}
> +		if (raw_super->feature & cpu_to_le32(F2FS_FEATURE_PRJQUOTA) &&
> +			le32_to_cpu(raw_super->qf_ino[2]) != 6) {
> +			f2fs_msg(sb, KERN_INFO,
> +				"Invalid Quota Ino: prj_ino(%u)",
> +				le32_to_cpu(raw_super->qf_ino[2]));
> +			return 1;
> +		}
> +	}
> +
>  	if (le32_to_cpu(raw_super->segment_count) > F2FS_MAX_SEGMENT) {
>  		f2fs_msg(sb, KERN_INFO,
>  			"Invalid segment count (%u)",
> -- 
> 2.15.0.55.gc2ece9dc4de6

  reply	other threads:[~2018-01-31  1:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29  8:29 Chao Yu
2018-01-31  1:35 ` Jaegeuk Kim [this message]
2018-01-31  2:01   ` Chao Yu
2018-01-31  2:36     ` Jaegeuk Kim
2018-01-31  3:38       ` Chao Yu
2018-01-31  3:49         ` Jaegeuk Kim
2018-01-31  6:02           ` Chao Yu
2018-01-31 21:57             ` Jaegeuk Kim
2018-02-01 13:41               ` Chao Yu

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=20180131013556.GE65489@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.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

all inboxes | Powered by JetHome®