[PATCH] Fix oops in vfs_quotaon_mount()
authorJan Kara <jack@suse.cz>
Mon, 28 Nov 2005 21:44:14 +0000 (13:44 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 28 Nov 2005 22:42:26 +0000 (14:42 -0800)
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@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/dquot.c

index 05b60283c9c2710d65fa96ccfe20d47f1da13f64..2a62b3dc20ec00a76c665a8f1e9dda9808e715b6 100644 (file)
@@ -1513,10 +1513,16 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
        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;
 }