]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
quota: avoid missing put_quota_format when DQUOT_SUSPENDED is passed
authorKemeng Shi <shikemeng@huaweicloud.com>
Mon, 15 Jul 2024 13:05:31 +0000 (21:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:03 +0000 (16:33 +0200)
[ Upstream commit d16a5f852025be546b6e4ceef15899db3490f4d7 ]

Avoid missing put_quota_format when DQUOT_SUSPENDED is passed to
dquot_load_quota_sb.

Link: https://patch.msgid.link/20240715130534.2112678-2-shikemeng@huaweicloud.com
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Fixes: d44c57663723 ("quota: Remove BUG_ON in dquot_load_quota_sb()")
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/quota/dquot.c

index 627eb2f72ef376dab2e89168121e03bad9ebc18d..23fcf9e9d6c555b42263d40137854b221ccccf83 100644 (file)
@@ -2408,7 +2408,7 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
 int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
        unsigned int flags)
 {
-       struct quota_format_type *fmt = find_quota_format(format_id);
+       struct quota_format_type *fmt;
        struct quota_info *dqopt = sb_dqopt(sb);
        int error;
 
@@ -2418,6 +2418,7 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
        if (WARN_ON_ONCE(flags & DQUOT_SUSPENDED))
                return -EINVAL;
 
+       fmt = find_quota_format(format_id);
        if (!fmt)
                return -ESRCH;
        if (!sb->dq_op || !sb->s_qcop ||