From: Konstantin Khlebnikov Date: Thu, 12 Feb 2015 09:36:49 +0000 (+0300) Subject: quota: paranoia: check quota tree root X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=69a25ee217ba8c93a6d4c6671d9208c0155c0485;p=linux-beck.git 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 Signed-off-by: Jan Kara --- 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); }