From: Jan Kara Date: Tue, 29 Mar 2016 15:20:10 +0000 (+0200) Subject: quota: Handle Q_GETNEXTQUOTA when quota is disabled X-Git-Tag: v4.14-rc1~3483^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17e8a8936c3f28085a858e65baee90dff5e8d48b;p=platform%2Fkernel%2Flinux-rpi.git quota: Handle Q_GETNEXTQUOTA when quota is disabled Currently we oopsed when Q_GETNEXTQUOTA got called when quota was disabled. Properly check whether quota is enabled for the filesystem before calling into quota format handler. Reported-by: Ted Tso Signed-off-by: Jan Kara --- diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index ba827da..ff21980 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -2047,11 +2047,20 @@ int dquot_get_next_id(struct super_block *sb, struct kqid *qid) struct quota_info *dqopt = sb_dqopt(sb); int err; - if (!dqopt->ops[qid->type]->get_next_id) - return -ENOSYS; + mutex_lock(&dqopt->dqonoff_mutex); + if (!sb_has_quota_active(sb, qid->type)) { + err = -ESRCH; + goto out; + } + if (!dqopt->ops[qid->type]->get_next_id) { + err = -ENOSYS; + goto out; + } mutex_lock(&dqopt->dqio_mutex); err = dqopt->ops[qid->type]->get_next_id(sb, qid); mutex_unlock(&dqopt->dqio_mutex); +out: + mutex_unlock(&dqopt->dqonoff_mutex); return err; }