From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756032AbbBLOEK (ORCPT ); Thu, 12 Feb 2015 09:04:10 -0500 Received: from cantor2.suse.de ([195.135.220.15]:38701 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755865AbbBLOEI (ORCPT ); Thu, 12 Feb 2015 09:04:08 -0500 Date: Thu, 12 Feb 2015 15:04:06 +0100 From: Jan Kara To: Konstantin Khlebnikov Cc: linux-fsdevel@vger.kernel.org, Jan Kara , linux-kernel@vger.kernel.org Subject: Re: [PATCH] quota: paranoia: check quota tree root Message-ID: <20150212140406.GB12905@quack.suse.cz> References: <20150212093649.6117.62111.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150212093649.6117.62111.stgit@buzz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 12-02-15 12:36:49, Konstantin Khlebnikov wrote: > Root level in quota tree must be already allocated otherwise this block > could be used for something else. Thanks. I've added the patch to my tree. Honza > > Signed-off-by: Konstantin Khlebnikov > --- > fs/quota/quota_tree.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c > index d65877f..58efb83 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); > } > > -- Jan Kara SUSE Labs, CR