Merge branch 'fixes-for-v4.9-rc2' of http://git.agner.ch/git/linux-drm-fsl-dcu into...
[cascardo/linux.git] / fs / quota / dquot.c
index b1322dd..1bfac28 100644 (file)
@@ -841,6 +841,9 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)
        unsigned int hashent = hashfn(sb, qid);
        struct dquot *dquot, *empty = NULL;
 
+       if (!qid_has_mapping(sb->s_user_ns, qid))
+               return ERR_PTR(-EINVAL);
+
         if (!sb_has_quota_active(sb, qid.type))
                return ERR_PTR(-ESRCH);
 we_slept:
@@ -2268,6 +2271,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
                error = -EINVAL;
                goto out_fmt;
        }
+       /* Filesystems outside of init_user_ns not yet supported */
+       if (sb->s_user_ns != &init_user_ns) {
+               error = -EINVAL;
+               goto out_fmt;
+       }
        /* Usage always has to be set... */
        if (!(flags & DQUOT_USAGE_ENABLED)) {
                error = -EINVAL;