[PATCH] Fix oops in vfs_quotaon_mount()

From: Jan Kara
Date: Mon Nov 28 2005 - 07:23:39 EST


Hello,

attached patch fixes a possible oops in journaled quotas. If quota file
specified in mount options did not exist, quota code tried to dereference
NULL pointer with the obvious result. Attached is a fix against 2.6.14
kernel. Please apply.

Honza

--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
When quota file specified in mount options did not exist, we tried to
dereference NULL pointer later. Fix it.

Signed-off-by: Jan Kara <jack@xxxxxxx>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.14-1-punch-ioctl/fs/dquot.c linux-2.6.14-2-quotaon_oops/fs/dquot.c
--- linux-2.6.14-1-punch-ioctl/fs/dquot.c 2005-09-11 22:41:52.000000000 +0200
+++ linux-2.6.14-2-quotaon_oops/fs/dquot.c 2005-11-29 15:42:17.000000000 +0100
@@ -1526,10 +1526,16 @@ int vfs_quota_on_mount(struct super_bloc
if (IS_ERR(dentry))
return PTR_ERR(dentry);

+ if (!dentry->d_inode) {
+ error = -ENOENT;
+ goto out;
+ }
+
error = security_quota_on(dentry);
if (!error)
error = vfs_quota_on_inode(dentry->d_inode, type, format_id);

+out:
dput(dentry);
return error;
}