public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] quota: paranoia: check quota tree root
@ 2015-02-12  9:36 Konstantin Khlebnikov
  2015-02-12 14:04 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2015-02-12  9:36 UTC (permalink / raw)
  To: linux-fsdevel, Jan Kara; +Cc: linux-kernel

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>
---
 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);
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-12 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12  9:36 [PATCH] quota: paranoia: check quota tree root Konstantin Khlebnikov
2015-02-12 14:04 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox