Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:27 +0100
committerJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:41 +0100
commit19c7d54a3a0dd539b7b479fc1953c44707b7bb01 (patch)
treee9cded1284c1b73146c6eab46445a1d234812712
parentc1c346db9ccb40149582eb5cfe4ed0e30cc0d967 (diff)
ext4: fix a potential fiemap/page fault deadlock w/ inline_data
-rw-r--r--patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch52
-rw-r--r--series.conf1
2 files changed, 53 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch b/patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch
new file mode 100644
index 0000000000..a22a10914e
--- /dev/null
+++ b/patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch
@@ -0,0 +1,52 @@
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Tue, 25 Dec 2018 00:56:33 -0500
+Subject: [PATCH] ext4: fix a potential fiemap/page fault deadlock w/
+ inline_data
+References: bnc#1012628
+Patch-mainline: 4.20.3
+Git-commit: 2b08b1f12cd664dc7d5c84ead9ff25ae97ad5491
+
+commit 2b08b1f12cd664dc7d5c84ead9ff25ae97ad5491 upstream.
+
+The ext4_inline_data_fiemap() function calls fiemap_fill_next_extent()
+while still holding the xattr semaphore. This is not necessary and it
+triggers a circular lockdep warning. This is because
+fiemap_fill_next_extent() could trigger a page fault when it writes
+into page which triggers a page fault. If that page is mmaped from
+the inline file in question, this could very well result in a
+deadlock.
+
+This problem can be reproduced using generic/519 with a file system
+configuration which has the inline_data feature enabled.
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Cc: stable@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/ext4/inline.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
+index 27373d88b5f0..56f6e1782d5f 100644
+--- a/fs/ext4/inline.c
++++ b/fs/ext4/inline.c
+@@ -1890,12 +1890,12 @@ int ext4_inline_data_fiemap(struct inode *inode,
+ physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
+ physical += offsetof(struct ext4_inode, i_block);
+
+- if (physical)
+- error = fiemap_fill_next_extent(fieinfo, start, physical,
+- inline_len, flags);
+ brelse(iloc.bh);
+ out:
+ up_read(&EXT4_I(inode)->xattr_sem);
++ if (physical)
++ error = fiemap_fill_next_extent(fieinfo, start, physical,
++ inline_len, flags);
+ return (error < 0 ? error : 0);
+ }
+
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 3e721ea149..9d1bcf1474 100644
--- a/series.conf
+++ b/series.conf
@@ -285,6 +285,7 @@
patches.kernel.org/4.20.3-045-drm-amdgpu-Don-t-fail-resume-process-if-resumi.patch
patches.kernel.org/4.20.3-046-rbd-don-t-return-0-on-unmap-if-RBD_DEV_FLAG_RE.patch
patches.kernel.org/4.20.3-047-ext4-make-sure-enough-credits-are-reserved-for.patch
+ patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch
########################################################
# Build fixes that apply to the vanilla kernel too.