From: Greg Kroah-Hartman Date: Thu, 20 Nov 2025 16:41:11 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.6.117~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6239bbb1c76fa8b4c99cf8f43931a25a5504a60;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: btrfs-do-not-update-last_log_commit-when-logging-inode-due-to-a-new-name.patch edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch loongarch-use-physical-addresses-for-csr_merrentry-csr_tlbrentry.patch selftests-mptcp-connect-trunc-read-all-recv-data.patch --- diff --git a/queue-6.1/btrfs-do-not-update-last_log_commit-when-logging-inode-due-to-a-new-name.patch b/queue-6.1/btrfs-do-not-update-last_log_commit-when-logging-inode-due-to-a-new-name.patch new file mode 100644 index 0000000000..c24bc2f268 --- /dev/null +++ b/queue-6.1/btrfs-do-not-update-last_log_commit-when-logging-inode-due-to-a-new-name.patch @@ -0,0 +1,108 @@ +From bfe3d755ef7cec71aac6ecda34a107624735aac7 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Wed, 29 Oct 2025 13:05:32 +0000 +Subject: btrfs: do not update last_log_commit when logging inode due to a new name + +From: Filipe Manana + +commit bfe3d755ef7cec71aac6ecda34a107624735aac7 upstream. + +When logging that a new name exists, we skip updating the inode's +last_log_commit field to prevent a later explicit fsync against the inode +from doing nothing (as updating last_log_commit makes btrfs_inode_in_log() +return true). We are detecting, at btrfs_log_inode(), that logging a new +name is happening by checking the logging mode is not LOG_INODE_EXISTS, +but that is not enough because we may log parent directories when logging +a new name of a file in LOG_INODE_ALL mode - we need to check that the +logging_new_name field of the log context too. + +An example scenario where this results in an explicit fsync against a +directory not persisting changes to the directory is the following: + + $ mkfs.btrfs -f /dev/sdc + $ mount /dev/sdc /mnt + + $ touch /mnt/foo + + $ sync + + $ mkdir /mnt/dir + + # Write some data to our file and fsync it. + $ xfs_io -c "pwrite -S 0xab 0 64K" -c "fsync" /mnt/foo + + # Add a new link to our file. Since the file was logged before, we + # update it in the log tree by calling btrfs_log_new_name(). + $ ln /mnt/foo /mnt/dir/bar + + # fsync the root directory - we expect it to persist the dentry for + # the new directory "dir". + $ xfs_io -c "fsync" /mnt + + + +After mounting the fs the entry for directory "dir" does not exists, +despite the explicit fsync on the root directory. + +Here's why this happens: + +1) When we fsync the file we log the inode, so that it's present in the + log tree; + +2) When adding the new link we enter btrfs_log_new_name(), and since the + inode is in the log tree we proceed to updating the inode in the log + tree; + +3) We first set the inode's last_unlink_trans to the current transaction + (early in btrfs_log_new_name()); + +4) We then eventually enter btrfs_log_inode_parent(), and after logging + the file's inode, we call btrfs_log_all_parents() because the inode's + last_unlink_trans matches the current transaction's ID (updated in the + previous step); + +5) So btrfs_log_all_parents() logs the root directory by calling + btrfs_log_inode() for the root's inode with a log mode of LOG_INODE_ALL + so that new dentries are logged; + +6) At btrfs_log_inode(), because the log mode is LOG_INODE_ALL, we + update root inode's last_log_commit to the last transaction that + changed the inode (->last_sub_trans field of the inode), which + corresponds to the current transaction's ID; + +7) Then later when user space explicitly calls fsync against the root + directory, we enter btrfs_sync_file(), which calls skip_inode_logging() + and that returns true, since its call to btrfs_inode_in_log() returns + true and there are no ordered extents (it's a directory, never has + ordered extents). This results in btrfs_sync_file() returning without + syncing the log or committing the current transaction, so all the + updates we did when logging the new name, including logging the root + directory, are not persisted. + +So fix this by but updating the inode's last_log_commit if we are sure +we are not logging a new name (if ctx->logging_new_name is false). + +A test case for fstests will follow soon. + +Reported-by: Vyacheslav Kovalevsky +Link: https://lore.kernel.org/linux-btrfs/03c5d7ec-5b3d-49d1-95bc-8970a7f82d87@gmail.com/ +Fixes: 130341be7ffa ("btrfs: always update the logged transaction when logging new names") +CC: stable@vger.kernel.org # 6.1+ +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/tree-log.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -6705,7 +6705,7 @@ log_extents: + * a power failure unless the log was synced as part of an fsync + * against any other unrelated inode. + */ +- if (inode_only != LOG_INODE_EXISTS) ++ if (!ctx->logging_new_name && inode_only != LOG_INODE_EXISTS) + inode->last_log_commit = inode->last_sub_trans; + spin_unlock(&inode->lock); + diff --git a/queue-6.1/edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch b/queue-6.1/edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch new file mode 100644 index 0000000000..388e874a71 --- /dev/null +++ b/queue-6.1/edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch @@ -0,0 +1,55 @@ +From fd3ecda38fe0cb713d167b5477d25f6b350f0514 Mon Sep 17 00:00:00 2001 +From: Niravkumar L Rabara +Date: Tue, 11 Nov 2025 16:08:01 +0800 +Subject: EDAC/altera: Handle OCRAM ECC enable after warm reset + +From: Niravkumar L Rabara + +commit fd3ecda38fe0cb713d167b5477d25f6b350f0514 upstream. + +The OCRAM ECC is always enabled either by the BootROM or by the Secure Device +Manager (SDM) during a power-on reset on SoCFPGA. + +However, during a warm reset, the OCRAM content is retained to preserve data, +while the control and status registers are reset to their default values. As +a result, ECC must be explicitly re-enabled after a warm reset. + +Fixes: 17e47dc6db4f ("EDAC/altera: Add Stratix10 OCRAM ECC support") +Signed-off-by: Niravkumar L Rabara +Signed-off-by: Borislav Petkov (AMD) +Acked-by: Dinh Nguyen +Cc: stable@vger.kernel.org +Link: https://patch.msgid.link/20251111080801.1279401-1-niravkumarlaxmidas.rabara@altera.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/edac/altera_edac.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/edac/altera_edac.c ++++ b/drivers/edac/altera_edac.c +@@ -1194,10 +1194,22 @@ altr_check_ocram_deps_init(struct altr_e + if (ret) + return ret; + +- /* Verify OCRAM has been initialized */ ++ /* ++ * Verify that OCRAM has been initialized. ++ * During a warm reset, OCRAM contents are retained, but the control ++ * and status registers are reset to their default values. Therefore, ++ * ECC must be explicitly re-enabled in the control register. ++ * Error condition: if INITCOMPLETEA is clear and ECC_EN is already set. ++ */ + if (!ecc_test_bits(ALTR_A10_ECC_INITCOMPLETEA, +- (base + ALTR_A10_ECC_INITSTAT_OFST))) +- return -ENODEV; ++ (base + ALTR_A10_ECC_INITSTAT_OFST))) { ++ if (!ecc_test_bits(ALTR_A10_ECC_EN, ++ (base + ALTR_A10_ECC_CTRL_OFST))) ++ ecc_set_bits(ALTR_A10_ECC_EN, ++ (base + ALTR_A10_ECC_CTRL_OFST)); ++ else ++ return -ENODEV; ++ } + + /* Enable IRQ on Single Bit Error */ + writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST)); diff --git a/queue-6.1/edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch b/queue-6.1/edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch new file mode 100644 index 0000000000..ac0e250dc4 --- /dev/null +++ b/queue-6.1/edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch @@ -0,0 +1,49 @@ +From 281326be67252ac5794d1383f67526606b1d6b13 Mon Sep 17 00:00:00 2001 +From: Niravkumar L Rabara +Date: Tue, 11 Nov 2025 16:13:33 +0800 +Subject: EDAC/altera: Use INTTEST register for Ethernet and USB SBE injection + +From: Niravkumar L Rabara + +commit 281326be67252ac5794d1383f67526606b1d6b13 upstream. + +The current single-bit error injection mechanism flips bits directly in ECC RAM +by performing write and read operations. When the ECC RAM is actively used by +the Ethernet or USB controller, this approach sometimes trigger a false +double-bit error. + +Switch both Ethernet and USB EDAC devices to use the INTTEST register +(altr_edac_a10_device_inject_fops) for single-bit error injection, similar to +the existing double-bit error injection method. + +Fixes: 064acbd4f4ab ("EDAC, altera: Add Stratix10 peripheral support") +Signed-off-by: Niravkumar L Rabara +Signed-off-by: Borislav Petkov (AMD) +Acked-by: Dinh Nguyen +Cc: stable@vger.kernel.org +Link: https://patch.msgid.link/20251111081333.1279635-1-niravkumarlaxmidas.rabara@altera.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/edac/altera_edac.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/edac/altera_edac.c ++++ b/drivers/edac/altera_edac.c +@@ -1379,7 +1379,7 @@ static const struct edac_device_prv_data + .ue_set_mask = ALTR_A10_ECC_TDERRA, + .set_err_ofst = ALTR_A10_ECC_INTTEST_OFST, + .ecc_irq_handler = altr_edac_a10_ecc_irq, +- .inject_fops = &altr_edac_a10_device_inject2_fops, ++ .inject_fops = &altr_edac_a10_device_inject_fops, + }; + + #endif /* CONFIG_EDAC_ALTERA_ETHERNET */ +@@ -1469,7 +1469,7 @@ static const struct edac_device_prv_data + .ue_set_mask = ALTR_A10_ECC_TDERRA, + .set_err_ofst = ALTR_A10_ECC_INTTEST_OFST, + .ecc_irq_handler = altr_edac_a10_ecc_irq, +- .inject_fops = &altr_edac_a10_device_inject2_fops, ++ .inject_fops = &altr_edac_a10_device_inject_fops, + }; + + #endif /* CONFIG_EDAC_ALTERA_USB */ diff --git a/queue-6.1/loongarch-use-physical-addresses-for-csr_merrentry-csr_tlbrentry.patch b/queue-6.1/loongarch-use-physical-addresses-for-csr_merrentry-csr_tlbrentry.patch new file mode 100644 index 0000000000..5d6ec4b09c --- /dev/null +++ b/queue-6.1/loongarch-use-physical-addresses-for-csr_merrentry-csr_tlbrentry.patch @@ -0,0 +1,34 @@ +From 4e67526840fc55917581b90f6a4b65849a616dd8 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Sun, 9 Nov 2025 16:02:00 +0800 +Subject: LoongArch: Use physical addresses for CSR_MERRENTRY/CSR_TLBRENTRY + +From: Huacai Chen + +commit 4e67526840fc55917581b90f6a4b65849a616dd8 upstream. + +Now we use virtual addresses to fill CSR_MERRENTRY/CSR_TLBRENTRY, but +hardware hope physical addresses. Now it works well because the high +bits are ignored above PA_BITS (48 bits), but explicitly use physical +addresses can avoid potential bugs. So fix it. + +Cc: stable@vger.kernel.org +Signed-off-by: Huacai Chen +Signed-off-by: Greg Kroah-Hartman +--- + arch/loongarch/kernel/traps.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/loongarch/kernel/traps.c ++++ b/arch/loongarch/kernel/traps.c +@@ -657,8 +657,8 @@ static void configure_exception_vector(v + tlbrentry = (unsigned long)exception_handlers + 80*VECSIZE; + + csr_write64(eentry, LOONGARCH_CSR_EENTRY); +- csr_write64(eentry, LOONGARCH_CSR_MERRENTRY); +- csr_write64(tlbrentry, LOONGARCH_CSR_TLBRENTRY); ++ csr_write64(__pa(eentry), LOONGARCH_CSR_MERRENTRY); ++ csr_write64(__pa(tlbrentry), LOONGARCH_CSR_TLBRENTRY); + } + + void per_cpu_trap_init(int cpu) diff --git a/queue-6.1/selftests-mptcp-connect-trunc-read-all-recv-data.patch b/queue-6.1/selftests-mptcp-connect-trunc-read-all-recv-data.patch new file mode 100644 index 0000000000..9b74221ee9 --- /dev/null +++ b/queue-6.1/selftests-mptcp-connect-trunc-read-all-recv-data.patch @@ -0,0 +1,82 @@ +From ee79980f7a428ec299f6261bea4c1084dcbc9631 Mon Sep 17 00:00:00 2001 +From: "Matthieu Baerts (NGI0)" +Date: Mon, 10 Nov 2025 19:23:44 +0100 +Subject: selftests: mptcp: connect: trunc: read all recv data + +From: Matthieu Baerts (NGI0) + +commit ee79980f7a428ec299f6261bea4c1084dcbc9631 upstream. + +MPTCP Join "fastclose server" selftest is sometimes failing because the +client output file doesn't have the expected size, e.g. 296B instead of +1024B. + +When looking at a packet trace when this happens, the server sent the +expected 1024B in two parts -- 100B, then 924B -- then the MP_FASTCLOSE. +It is then strange to see the client only receiving 296B, which would +mean it only got a part of the second packet. The problem is then not on +the networking side, but rather on the data reception side. + +When mptcp_connect is launched with '-f -1', it means the connection +might stop before having sent everything, because a reset has been +received. When this happens, the program was directly stopped. But it is +also possible there are still some data to read, simply because the +previous 'read' step was done with a buffer smaller than the pending +data, see do_rnd_read(). In this case, it is important to read what's +left in the kernel buffers before stopping without error like before. + +SIGPIPE is now ignored, not to quit the app before having read +everything. + +Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases") +Cc: stable@vger.kernel.org +Reviewed-by: Geliang Tang +Signed-off-by: Matthieu Baerts (NGI0) +Link: https://patch.msgid.link/20251110-net-mptcp-sft-join-unstable-v1-5-a4332c714e10@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/mptcp/mptcp_connect.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c ++++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c +@@ -655,8 +655,14 @@ static int copyfd_io_poll(int infd, int + + bw = do_rnd_write(peerfd, wbuf + woff, wlen); + if (bw < 0) { +- if (cfg_rcv_trunc) +- return 0; ++ /* expected reset, continue to read */ ++ if (cfg_rcv_trunc && ++ (errno == ECONNRESET || ++ errno == EPIPE)) { ++ fds.events &= ~POLLOUT; ++ continue; ++ } ++ + perror("write"); + return 111; + } +@@ -682,8 +688,10 @@ static int copyfd_io_poll(int infd, int + } + + if (fds.revents & (POLLERR | POLLNVAL)) { +- if (cfg_rcv_trunc) +- return 0; ++ if (cfg_rcv_trunc) { ++ fds.events &= ~(POLLERR | POLLNVAL); ++ continue; ++ } + fprintf(stderr, "Unexpected revents: " + "POLLERR/POLLNVAL(%x)\n", fds.revents); + return 5; +@@ -1332,7 +1340,7 @@ static void parse_opts(int argc, char ** + */ + if (cfg_truncate < 0) { + cfg_rcv_trunc = true; +- signal(SIGPIPE, handle_signal); ++ signal(SIGPIPE, SIG_IGN); + } + break; + case 'j': diff --git a/queue-6.1/series b/queue-6.1/series index e96db7080f..8d31478610 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -408,3 +408,8 @@ fs-proc-fix-uaf-in-proc_readdir_de.patch mmc-sdhci-of-dwcmshc-change-dll_strbin_tapnum_default-to-0x4.patch alsa-usb-audio-fix-potential-overflow-of-pcm-transfer-buffer.patch spi-try-to-get-acpi-gpio-irq-earlier.patch +loongarch-use-physical-addresses-for-csr_merrentry-csr_tlbrentry.patch +edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch +edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch +btrfs-do-not-update-last_log_commit-when-logging-inode-due-to-a-new-name.patch +selftests-mptcp-connect-trunc-read-all-recv-data.patch