summaryrefslogtreecommitdiff
path: root/fs/quota
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>2015-02-12 12:36:49 +0300
committerJan Kara <jack@suse.cz>2015-03-04 16:42:45 +0100
commit69a25ee217ba8c93a6d4c6671d9208c0155c0485 (patch)
tree73a30e75c15e5d0a6533db1852e4b193491e3e6a /fs/quota
parent5bcd3b6f639c277ed7fa71f2f8ed6fb072615011 (diff)
quota: paranoia: check quota tree root
Root level in quota tree must be already allocated otherwise this block could be used for something else. Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/quota_tree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
index d65877fbe8f4..58efb83dec1c 100644
--- a/fs/quota/quota_tree.c
+++ b/fs/quota/quota_tree.c
@@ -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);
}