From 0f60783778ce9913b60ea5c9fab2933542572b1b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 4 Nov 2020 10:13:19 +0100 Subject: [PATCH] drop ext4-fix-superblock-checksum-calculation-race.patch from everywhere --- ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-4.14/series | 1 - ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-4.19/series | 1 - ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-4.4/series | 1 - ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-4.9/series | 1 - ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-5.4/series | 1 - ...r-check-failed-when-mount-fs-with-ro.patch | 4 +- ...superblock-checksum-calculation-race.patch | 60 ------------------- queue-5.9/series | 1 - 13 files changed, 2 insertions(+), 368 deletions(-) delete mode 100644 queue-4.14/ext4-fix-superblock-checksum-calculation-race.patch delete mode 100644 queue-4.19/ext4-fix-superblock-checksum-calculation-race.patch delete mode 100644 queue-4.4/ext4-fix-superblock-checksum-calculation-race.patch delete mode 100644 queue-4.9/ext4-fix-superblock-checksum-calculation-race.patch delete mode 100644 queue-5.4/ext4-fix-superblock-checksum-calculation-race.patch delete mode 100644 queue-5.9/ext4-fix-superblock-checksum-calculation-race.patch diff --git a/queue-4.14/ext4-fix-superblock-checksum-calculation-race.patch b/queue-4.14/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index dc0af69a931..00000000000 --- a/queue-4.14/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -200,7 +200,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - void *ext4_kvmalloc(size_t size, gfp_t flags) diff --git a/queue-4.14/series b/queue-4.14/series index 6e845ea0b7c..d64e4be76b9 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -107,7 +107,6 @@ vringh-fix-__vringh_iov-when-riov-and-wiov-are-different.patch ext4-fix-leaking-sysfs-kobject-after-failed-mount.patch ext4-fix-error-handling-code-in-add_new_gdb.patch ext4-fix-invalid-inode-checksum.patch -ext4-fix-superblock-checksum-calculation-race.patch drm-ttm-fix-eviction-valuable-range-check.patch rtc-rx8010-don-t-modify-the-global-rtc-ops.patch tty-make-fontx-ioctl-use-the-tty-pointer-they-were-actually-passed.patch diff --git a/queue-4.19/ext4-fix-superblock-checksum-calculation-race.patch b/queue-4.19/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index dc0af69a931..00000000000 --- a/queue-4.19/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -200,7 +200,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - void *ext4_kvmalloc(size_t size, gfp_t flags) diff --git a/queue-4.19/series b/queue-4.19/series index adcbd52152e..60ac5b4c630 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -174,7 +174,6 @@ vringh-fix-__vringh_iov-when-riov-and-wiov-are-different.patch ext4-fix-leaking-sysfs-kobject-after-failed-mount.patch ext4-fix-error-handling-code-in-add_new_gdb.patch ext4-fix-invalid-inode-checksum.patch -ext4-fix-superblock-checksum-calculation-race.patch drm-ttm-fix-eviction-valuable-range-check.patch rtc-rx8010-don-t-modify-the-global-rtc-ops.patch tty-make-fontx-ioctl-use-the-tty-pointer-they-were-actually-passed.patch diff --git a/queue-4.4/ext4-fix-superblock-checksum-calculation-race.patch b/queue-4.4/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index e0f80b66195..00000000000 --- a/queue-4.4/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -144,7 +144,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - void *ext4_kvmalloc(size_t size, gfp_t flags) diff --git a/queue-4.4/series b/queue-4.4/series index 0167d18b82f..d4a2e692a67 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -54,7 +54,6 @@ libceph-clear-con-out_msg-on-policy-stateful_server-faults.patch 9p-cast-to-loff_t-before-multiplying.patch ring-buffer-return-0-on-success-from-ring_buffer_resize.patch vringh-fix-__vringh_iov-when-riov-and-wiov-are-different.patch -ext4-fix-superblock-checksum-calculation-race.patch tty-make-fontx-ioctl-use-the-tty-pointer-they-were-actually-passed.patch arm64-berlin-select-dw_apb_timer_of.patch cachefiles-handle-readpage-error-correctly.patch diff --git a/queue-4.9/ext4-fix-superblock-checksum-calculation-race.patch b/queue-4.9/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index 69013cc3ad6..00000000000 --- a/queue-4.9/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -175,7 +175,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - void *ext4_kvmalloc(size_t size, gfp_t flags) diff --git a/queue-4.9/series b/queue-4.9/series index ea50c791325..567917e70d6 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -76,7 +76,6 @@ libceph-clear-con-out_msg-on-policy-stateful_server-faults.patch 9p-cast-to-loff_t-before-multiplying.patch ring-buffer-return-0-on-success-from-ring_buffer_resize.patch vringh-fix-__vringh_iov-when-riov-and-wiov-are-different.patch -ext4-fix-superblock-checksum-calculation-race.patch rtc-rx8010-don-t-modify-the-global-rtc-ops.patch tty-make-fontx-ioctl-use-the-tty-pointer-they-were-actually-passed.patch arm64-berlin-select-dw_apb_timer_of.patch diff --git a/queue-5.4/ext4-fix-superblock-checksum-calculation-race.patch b/queue-5.4/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index 4ba823e996f..00000000000 --- a/queue-5.4/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -201,7 +201,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - void *ext4_kvmalloc(size_t size, gfp_t flags) diff --git a/queue-5.4/series b/queue-5.4/series index 7647ec9623c..19416770854 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -192,7 +192,6 @@ vringh-fix-__vringh_iov-when-riov-and-wiov-are-different.patch ext4-fix-leaking-sysfs-kobject-after-failed-mount.patch ext4-fix-error-handling-code-in-add_new_gdb.patch ext4-fix-invalid-inode-checksum.patch -ext4-fix-superblock-checksum-calculation-race.patch drm-ttm-fix-eviction-valuable-range-check.patch mmc-sdhci-of-esdhc-set-timeout-to-max-before-tuning.patch mmc-sdhci-use-auto-cmd-auto-select-only-when-v4_mode-is-true.patch diff --git a/queue-5.9/ext4-fix-bdev-write-error-check-failed-when-mount-fs-with-ro.patch b/queue-5.9/ext4-fix-bdev-write-error-check-failed-when-mount-fs-with-ro.patch index 7f6fffea4d1..91b0c1609ef 100644 --- a/queue-5.9/ext4-fix-bdev-write-error-check-failed-when-mount-fs-with-ro.patch +++ b/queue-5.9/ext4-fix-bdev-write-error-check-failed-when-mount-fs-with-ro.patch @@ -33,7 +33,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/fs/ext4/super.c +++ b/fs/ext4/super.c -@@ -4826,9 +4826,8 @@ no_journal: +@@ -4815,9 +4815,8 @@ no_journal: * used to detect the metadata async write error. */ spin_lock_init(&sbi->s_bdev_wb_lock); @@ -45,7 +45,7 @@ Signed-off-by: Greg Kroah-Hartman sb->s_bdev->bd_super = sb; EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; ext4_orphan_cleanup(sb, es); -@@ -5721,14 +5720,6 @@ static int ext4_remount(struct super_blo +@@ -5710,14 +5709,6 @@ static int ext4_remount(struct super_blo } /* diff --git a/queue-5.9/ext4-fix-superblock-checksum-calculation-race.patch b/queue-5.9/ext4-fix-superblock-checksum-calculation-race.patch deleted file mode 100644 index 2f42d526869..00000000000 --- a/queue-5.9/ext4-fix-superblock-checksum-calculation-race.patch +++ /dev/null @@ -1,60 +0,0 @@ -From acaa532687cdc3a03757defafece9c27aa667546 Mon Sep 17 00:00:00 2001 -From: Constantine Sapuntzakis -Date: Mon, 14 Sep 2020 10:10:14 -0600 -Subject: ext4: fix superblock checksum calculation race - -From: Constantine Sapuntzakis - -commit acaa532687cdc3a03757defafece9c27aa667546 upstream. - -The race condition could cause the persisted superblock checksum -to not match the contents of the superblock, causing the -superblock to be considered corrupt. - -An example of the race follows. A first thread is interrupted in the -middle of a checksum calculation. Then, another thread changes the -superblock, calculates a new checksum, and sets it. Then, the first -thread resumes and sets the checksum based on the older superblock. - -To fix, serialize the superblock checksum calculation using the buffer -header lock. While a spinlock is sufficient, the buffer header is -already there and there is precedent for locking it (e.g. in -ext4_commit_super). - -Tested the patch by booting up a kernel with the patch, creating -a filesystem and some files (including some orphans), and then -unmounting and remounting the file system. - -Cc: stable@kernel.org -Signed-off-by: Constantine Sapuntzakis -Reviewed-by: Jan Kara -Suggested-by: Jan Kara -Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com -Signed-off-by: Theodore Ts'o -Signed-off-by: Greg Kroah-Hartman - ---- - fs/ext4/super.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -201,7 +201,18 @@ void ext4_superblock_csum_set(struct sup - if (!ext4_has_metadata_csum(sb)) - return; - -+ /* -+ * Locking the superblock prevents the scenario -+ * where: -+ * 1) a first thread pauses during checksum calculation. -+ * 2) a second thread updates the superblock, recalculates -+ * the checksum, and updates s_checksum -+ * 3) the first thread resumes and finishes its checksum calculation -+ * and updates s_checksum with a potentially stale or torn value. -+ */ -+ lock_buffer(EXT4_SB(sb)->s_sbh); - es->s_checksum = ext4_superblock_csum(sb, es); -+ unlock_buffer(EXT4_SB(sb)->s_sbh); - } - - ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, diff --git a/queue-5.9/series b/queue-5.9/series index 239ea3fdc89..2857957d5dc 100644 --- a/queue-5.9/series +++ b/queue-5.9/series @@ -341,7 +341,6 @@ ext4-fix-leaking-sysfs-kobject-after-failed-mount.patch ext4-fix-error-handling-code-in-add_new_gdb.patch ext4-implement-swap_activate-aops-using-iomap.patch ext4-fix-invalid-inode-checksum.patch -ext4-fix-superblock-checksum-calculation-race.patch ext4-clear-buffer-verified-flag-if-read-meta-block-from-disk.patch ext4-fix-bdev-write-error-check-failed-when-mount-fs-with-ro.patch ext4-fix-bs-ps-issue-reported-with-dioread_nolock-mount-opt.patch -- 2.47.3