Skip to content

Commit

Permalink
quota: paranoia: check quota tree root
Browse files Browse the repository at this point in the history
Root level in quota tree must be already allocated otherwise this block
could be used for something else.

Signed-off-by: Konstantin Khlebnikov <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
koct9i authored and jankara committed Mar 4, 2015
1 parent 5bcd3b6 commit 69a25ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/quota/quota_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ static inline int dq_insert_tree(struct qtree_mem_dqinfo *info,
struct dquot *dquot)
{
int tmp = QT_TREEOFF;

#ifdef __QUOTA_QT_PARANOIA
if (info->dqi_blocks <= QT_TREEOFF) {
quota_error(dquot->dq_sb, "Quota tree root isn't allocated!");
return -EIO;
}
#endif
return do_insert_tree(info, dquot, &tmp, 0);
}

Expand Down

0 comments on commit 69a25ee

Please sign in to comment.