Skip to content

Commit

Permalink
[PATCH] quota: possible bug in quota format v2 support
Browse files Browse the repository at this point in the history
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: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Niu YaWei authored and Linus Torvalds committed Apr 16, 2005
1 parent 31e7ad6 commit e821d94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ static int remove_tree(struct dquot *dquot, uint *blk, int depth)
int i;
ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0);
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);
*blk = 0;
}
Expand Down

0 comments on commit e821d94

Please sign in to comment.