diff options
author | Jan Kara <jack@suse.cz> | 2009-12-21 15:57:04 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-12-23 07:44:13 -0500 |
commit | 869835dfad3eb6f7d90c3255a24b084fea82f30d (patch) | |
tree | 738e438bcbab1330e8585ad6ee59dd8a66263a2c /fs | |
parent | 765f8361902d015c864d5e62019b2f139452d7ef (diff) |
quota: Improve checking of quota file header
When we are asked for vfsv0 quota format and the file is in vfsv1
format (or vice versa), refuse to use the quota file. Also return
with error when we don't like the header of quota file.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/quota/quota_v2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c index 669855cf9b61..e3da02f4986f 100644 --- a/fs/quota/quota_v2.c +++ b/fs/quota/quota_v2.c | |||
@@ -97,8 +97,11 @@ static int v2_read_file_info(struct super_block *sb, int type) | |||
97 | unsigned int version; | 97 | unsigned int version; |
98 | 98 | ||
99 | if (!v2_read_header(sb, type, &dqhead)) | 99 | if (!v2_read_header(sb, type, &dqhead)) |
100 | return 0; | 100 | return -1; |
101 | version = le32_to_cpu(dqhead.dqh_version); | 101 | version = le32_to_cpu(dqhead.dqh_version); |
102 | if ((info->dqi_fmt_id == QFMT_VFS_V0 && version != 0) || | ||
103 | (info->dqi_fmt_id == QFMT_VFS_V1 && version != 1)) | ||
104 | return -1; | ||
102 | 105 | ||
103 | size = sb->s_op->quota_read(sb, type, (char *)&dinfo, | 106 | size = sb->s_op->quota_read(sb, type, (char *)&dinfo, |
104 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); | 107 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); |