Skip to content

Commit

Permalink
quota: Fix error codes in v2_read_file_info()
Browse files Browse the repository at this point in the history
v2_read_file_info() returned -1 instead of proper error codes on error.
Luckily this is not easily visible from userspace as we have called
->check_quota_file shortly before and thus already verified the quota
file is sane. Still set the error codes to proper values.

Reviewed-by: Andreas Dilger <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Aug 17, 2017
1 parent 42fdb85 commit cb8d01b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/quota/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ static int v2_read_file_info(struct super_block *sb, int type)

down_read(&dqopt->dqio_sem);
if (!v2_read_header(sb, type, &dqhead)) {
ret = -1;
ret = -EIO;
goto out;
}
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)) {
ret = -1;
ret = -EINVAL;
goto out;
}

size = sb->s_op->quota_read(sb, type, (char *)&dinfo,
sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
if (size != sizeof(struct v2_disk_dqinfo)) {
quota_error(sb, "Can't read info structure");
ret = -1;
ret = -EIO;
goto out;
}
info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
Expand Down

0 comments on commit cb8d01b

Please sign in to comment.