Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-11-01 14:04:41 +1100
committerNeilBrown <neilb@suse.com>2018-11-01 14:06:15 +1100
commite72d60f4c12ba55d739a009aee3bc83e0be11571 (patch)
treee2be68209fae2ca850567d198b42d83b2c6cd91a
parente22c5148c06e52cea1346b648a4ef15ad7b8204e (diff)
vfs: fix freeze protection in mnt_want_write_file() for
overlayfs (git-fixes).
-rw-r--r--patches.fixes/vfs-fix-freeze-protection-in-mnt_want_write_file-for.patch49
-rw-r--r--series.conf1
2 files changed, 50 insertions, 0 deletions
diff --git a/patches.fixes/vfs-fix-freeze-protection-in-mnt_want_write_file-for.patch b/patches.fixes/vfs-fix-freeze-protection-in-mnt_want_write_file-for.patch
new file mode 100644
index 0000000000..21df29be45
--- /dev/null
+++ b/patches.fixes/vfs-fix-freeze-protection-in-mnt_want_write_file-for.patch
@@ -0,0 +1,49 @@
+From: Miklos Szeredi <mszeredi@redhat.com>
+Date: Wed, 18 Jul 2018 15:44:43 +0200
+Subject: [PATCH] vfs: fix freeze protection in mnt_want_write_file() for
+ overlayfs
+Git-commit: a6795a585929d94ca3e931bc8518f8deb8bbe627
+Patch-mainline: v4.19
+References: git-fixes
+
+The underlying real file used by overlayfs still contains the overlay path.
+This results in mnt_want_write_file() calls by the filesystem getting
+freeze protection on the wrong inode (the overlayfs one instead of the real
+one).
+
+Fix by using file_inode(file)->i_sb instead of file->f_path.mnt->mnt_sb.
+
+Reported-by: Amir Goldstein <amir73il@gmail.com>
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Acked-by: NeilBrown <neilb@suse.com>
+
+---
+ fs/namespace.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/fs/namespace.c
++++ b/fs/namespace.c
+@@ -441,10 +441,10 @@ int mnt_want_write_file(struct file *fil
+ {
+ int ret;
+
+- sb_start_write(file->f_path.mnt->mnt_sb);
++ sb_start_write(file_inode(file)->i_sb);
+ ret = __mnt_want_write_file(file);
+ if (ret)
+- sb_end_write(file->f_path.mnt->mnt_sb);
++ sb_end_write(file_inode(file)->i_sb);
+ return ret;
+ }
+ EXPORT_SYMBOL_GPL(mnt_want_write_file);
+@@ -486,7 +486,8 @@ void __mnt_drop_write_file(struct file *
+
+ void mnt_drop_write_file(struct file *file)
+ {
+- mnt_drop_write(file->f_path.mnt);
++ __mnt_drop_write_file(file);
++ sb_end_write(file_inode(file)->i_sb);
+ }
+ EXPORT_SYMBOL(mnt_drop_write_file);
+
diff --git a/series.conf b/series.conf
index 5ffca0264c..8b0fb5365e 100644
--- a/series.conf
+++ b/series.conf
@@ -17773,6 +17773,7 @@
patches.drivers/power-generic-adc-battery-fix-out-of-bounds-write-wh
patches.drivers/power-generic-adc-battery-check-for-duplicate-proper
patches.drivers/power-supply-max77693_charger-fix-unintentional-fall
+ patches.fixes/vfs-fix-freeze-protection-in-mnt_want_write_file-for.patch
patches.fixes/fuse-fix-double-request_end.patch
patches.fixes/fuse-fix-unlocked-access-to-processing-queue.patch
patches.fixes/fuse-umount-should-wait-for-all-requests.patch