]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 23 Jan 2022 17:19:17 +0000 (18:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 23 Jan 2022 17:19:17 +0000 (18:19 +0100)
added patches:
ext4-make-sure-quota-gets-properly-shutdown-on-error.patch

queue-4.14/ext4-make-sure-quota-gets-properly-shutdown-on-error.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/ext4-make-sure-quota-gets-properly-shutdown-on-error.patch b/queue-4.14/ext4-make-sure-quota-gets-properly-shutdown-on-error.patch
new file mode 100644 (file)
index 0000000..4b13f60
--- /dev/null
@@ -0,0 +1,51 @@
+From 15fc69bbbbbc8c72e5f6cc4e1be0f51283c5448e Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Thu, 7 Oct 2021 17:53:35 +0200
+Subject: ext4: make sure quota gets properly shutdown on error
+
+From: Jan Kara <jack@suse.cz>
+
+commit 15fc69bbbbbc8c72e5f6cc4e1be0f51283c5448e 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>
+---
+ fs/ext4/super.c |   10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -5678,10 +5678,7 @@ static int ext4_quota_on(struct super_bl
+       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;
+@@ -5701,7 +5698,12 @@ static int ext4_quota_on(struct super_bl
+               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;
+ }
index 0d2e4c02504bda2d3cb45a2e99d2f4cc6f622269..6c12f04c3fe8ae086ec1dcfdc90ca4223e645e55 100644 (file)
@@ -150,3 +150,4 @@ serial-fix-incorrect-rs485-polarity-on-uart-open.patch
 cputime-cpuacct-include-guest-time-in-user-time-in-cpuacct.stat.patch
 iwlwifi-mvm-increase-the-scan-timeout-guard-to-30-seconds.patch
 drm-etnaviv-limit-submit-sizes.patch
+ext4-make-sure-quota-gets-properly-shutdown-on-error.patch