You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
ext4: make sure quota gets properly shutdown on error
commit 15fc69bbbb upstream.
When we hit an error when enabling quotas and setting inode flags, we do
not properly shutdown quota subsystem despite returning error from
Q_QUOTAON quotactl. This can lead to some odd situations like kernel
using quota file while it is still writeable for userspace. Make sure we
properly cleanup the quota subsystem in case of error.
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20211007155336.12493-2-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
762e4c33e9
commit
115b762b48
@@ -6341,10 +6341,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
||||
|
||||
lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA);
|
||||
err = dquot_quota_on(sb, type, format_id, path);
|
||||
if (err) {
|
||||
lockdep_set_quota_inode(path->dentry->d_inode,
|
||||
I_DATA_SEM_NORMAL);
|
||||
} else {
|
||||
if (!err) {
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
handle_t *handle;
|
||||
|
||||
@@ -6364,7 +6361,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
||||
ext4_journal_stop(handle);
|
||||
unlock_inode:
|
||||
inode_unlock(inode);
|
||||
if (err)
|
||||
dquot_quota_off(sb, type);
|
||||
}
|
||||
if (err)
|
||||
lockdep_set_quota_inode(path->dentry->d_inode,
|
||||
I_DATA_SEM_NORMAL);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user