提交 be12b77e 编写于 作者: Z Zhong Jinghua 提交者: Yongqiang Liu

Revert "quota: Check next/prev free block number after reading from quota file"

hulk inclusion
category: bugfix
bugzilla: 187046, https://gitee.com/openeuler/kernel/issues/I5QH0X
CVE: NA

--------------------------------

This reverts commit 6c27d754.

The mainline of this patch already exists, revert the interim patch.
Signed-off-by: NZhong Jinghua <zhongjinghua@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 592e66e1
...@@ -79,35 +79,6 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) ...@@ -79,35 +79,6 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
return ret; return ret;
} }
static inline int do_check_range(struct super_block *sb, uint val, uint max_val)
{
if (val >= max_val) {
quota_error(sb, "Getting block too big (%u >= %u)",
val, max_val);
return -EUCLEAN;
}
return 0;
}
static int check_free_block(struct qtree_mem_dqinfo *info,
struct qt_disk_dqdbheader *dh)
{
int err = 0;
uint nextblk, prevblk;
nextblk = le32_to_cpu(dh->dqdh_next_free);
err = do_check_range(info->dqi_sb, nextblk, info->dqi_blocks);
if (err)
return err;
prevblk = le32_to_cpu(dh->dqdh_prev_free);
err = do_check_range(info->dqi_sb, prevblk, info->dqi_blocks);
if (err)
return err;
return err;
}
/* Remove empty block from list and return it */ /* Remove empty block from list and return it */
static int get_free_dqblk(struct qtree_mem_dqinfo *info) static int get_free_dqblk(struct qtree_mem_dqinfo *info)
{ {
...@@ -122,9 +93,6 @@ static int get_free_dqblk(struct qtree_mem_dqinfo *info) ...@@ -122,9 +93,6 @@ static int get_free_dqblk(struct qtree_mem_dqinfo *info)
ret = read_blk(info, blk, buf); ret = read_blk(info, blk, buf);
if (ret < 0) if (ret < 0)
goto out_buf; goto out_buf;
ret = check_free_block(info, dh);
if (ret)
goto out_buf;
info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free); info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free);
} }
else { else {
...@@ -272,9 +240,6 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, ...@@ -272,9 +240,6 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
*err = read_blk(info, blk, buf); *err = read_blk(info, blk, buf);
if (*err < 0) if (*err < 0)
goto out_buf; goto out_buf;
*err = check_free_block(info, dh);
if (*err)
goto out_buf;
} else { } else {
blk = get_free_dqblk(info); blk = get_free_dqblk(info);
if ((int)blk < 0) { if ((int)blk < 0) {
...@@ -467,9 +432,6 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, ...@@ -467,9 +432,6 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
goto out_buf; goto out_buf;
} }
dh = (struct qt_disk_dqdbheader *)buf; dh = (struct qt_disk_dqdbheader *)buf;
ret = check_free_block(info, dh);
if (ret)
goto out_buf;
le16_add_cpu(&dh->dqdh_entries, -1); le16_add_cpu(&dh->dqdh_entries, -1);
if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */ if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */
ret = remove_free_dqentry(info, buf, blk); ret = remove_free_dqentry(info, buf, blk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册