Skip to content

Commit

Permalink
quota: Improve checking of quota file header
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jankara committed Dec 23, 2009
1 parent 765f836 commit 869835d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/quota/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ static int v2_read_file_info(struct super_block *sb, int type)
unsigned int version;

if (!v2_read_header(sb, type, &dqhead))
return 0;
return -1;
version = le32_to_cpu(dqhead.dqh_version);
if ((info->dqi_fmt_id == QFMT_VFS_V0 && version != 0) ||
(info->dqi_fmt_id == QFMT_VFS_V1 && version != 1))
return -1;

size = sb->s_op->quota_read(sb, type, (char *)&dinfo,
sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
Expand Down

0 comments on commit 869835d

Please sign in to comment.