Patchwork ext4: Fix oops in ext4_quota_off()

login
register
mail settings
Submitter Jan Kara
Date May 16, 2011, 9:46 a.m.
Message ID <1305539183-7181-1-git-send-email-jack@suse.cz>
Download mbox | patch
Permalink /patch/95703/
State Superseded
Headers show

Comments

Jan Kara - May 16, 2011, 9:46 a.m.
When quota is not enabled when ext4_quota_off() is called, we must not
dereference quota file inode since it is NULL. Check properly for this.  This
is a regression caused by commit 21f976975cbecbdaf23ceeacc1cab2b1c05a028e.

Debugged-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/super.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a86e693..2a4a9b2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4652,6 +4652,8 @@  static int ext4_quota_off(struct super_block *sb, int type)
 	if (test_opt(sb, DELALLOC))
 		sync_filesystem(sb);
 
+	if (!inode)
+		goto out;
 	/* Update modification times of quota files when userspace can
 	 * start looking at them */
 	handle = ext4_journal_start(inode, 1);