Commit e821d94d authored by Niu YaWei's avatar Niu YaWei Committed by Linus Torvalds

[PATCH] quota: possible bug in quota format v2 support

Don't put root block of quota tree to the free list (when quota file is
completely empty).  That should not actually happen anyway (somebody should
get accounted for the filesystem root and so quota file should never be
empty) but better prevent it here than solve magical quota file
corruption.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31e7ad6a
...@@ -503,7 +503,8 @@ static int remove_tree(struct dquot *dquot, uint *blk, int depth) ...@@ -503,7 +503,8 @@ static int remove_tree(struct dquot *dquot, uint *blk, int depth)
int i; int i;
ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0); ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0);
for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */ for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */
if (i == V2_DQBLKSIZE) { /* Don't put the root block into the free block list */
if (i == V2_DQBLKSIZE && *blk != V2_DQTREEOFF) {
put_free_dqblk(sb, type, buf, *blk); put_free_dqblk(sb, type, buf, *blk);
*blk = 0; *blk = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment