From: Ye Bin <yebin10@huawei.com>
To: <jack@suse.com>, <linux-kernel@vger.kernel.org>
Cc: <yebin10@huawei.com>, Jan Kara <jack@suse.cz>,
<syzbot+e633c79ceaecbf479854@syzkaller.appspotmail.com>
Subject: [PATCH v2 1/2] quota: Properly disable quotas when add_dquot_ref() fails
Date: Mon, 5 Jun 2023 22:07:30 +0800 [thread overview]
Message-ID: <20230605140731.2427629-2-yebin10@huawei.com> (raw)
In-Reply-To: <20230605140731.2427629-1-yebin10@huawei.com>
From: Jan Kara <jack@suse.cz>
When add_dquot_ref() fails (usually due to IO error or ENOMEM), we want
to disable quotas we are trying to enable. However dquot_disable() call
was passed just the flags we are enabling so in case flags ==
DQUOT_USAGE_ENABLED dquot_disable() call will just fail with EINVAL
instead of properly disabling quotas. Fix the problem by always passing
DQUOT_LIMITS_ENABLED | DQUOT_USAGE_ENABLED to dquot_disable() in this
case.
Reported-and-tested-by: Ye Bin <yebin10@huawei.com>
Reported-by: syzbot+e633c79ceaecbf479854@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/quota/dquot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index ffd40dc3e4e9..6beceed34e08 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2420,7 +2420,8 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
error = add_dquot_ref(sb, type);
if (error)
- dquot_disable(sb, type, flags);
+ dquot_disable(sb, type,
+ DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
return error;
out_fmt:
--
2.31.1
next prev parent reply other threads:[~2023-06-05 14:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 14:07 [PATCH v2 0/2] fix two issue about quota Ye Bin
2023-06-05 14:07 ` Ye Bin [this message]
2023-06-05 14:07 ` [PATCH v2 2/2] quota: fix warning in dqgrab() Ye Bin
2023-06-05 14:52 ` [PATCH v2 0/2] fix two issue about quota Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605140731.2427629-2-yebin10@huawei.com \
--to=yebin10@huawei.com \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+e633c79ceaecbf479854@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®