From: Sasha Levin Date: Mon, 12 May 2025 11:15:18 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v5.15.183~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1b33212243e375d5f04dffb73cd2993ed029d0a;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/do_umount-add-missing-barrier-before-refcount-checks.patch b/queue-5.4/do_umount-add-missing-barrier-before-refcount-checks.patch new file mode 100644 index 0000000000..82638757e3 --- /dev/null +++ b/queue-5.4/do_umount-add-missing-barrier-before-refcount-checks.patch @@ -0,0 +1,50 @@ +From 539f7b6545d67c860ce9b10855e6eb4056a7468e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Apr 2025 23:56:14 -0400 +Subject: do_umount(): add missing barrier before refcount checks in sync case + +From: Al Viro + +[ Upstream commit 65781e19dcfcb4aed1167d87a3ffcc2a0c071d47 ] + +do_umount() analogue of the race fixed in 119e1ef80ecf "fix +__legitimize_mnt()/mntput() race". Here we want to make sure that +if __legitimize_mnt() doesn't notice our lock_mount_hash(), we will +notice their refcount increment. Harder to hit than mntput_no_expire() +one, fortunately, and consequences are milder (sync umount acting +like umount -l on a rare race with RCU pathwalk hitting at just the +wrong time instead of use-after-free galore mntput_no_expire() +counterpart used to be hit). Still a bug... + +Fixes: 48a066e72d97 ("RCU'd vfsmounts") +Reviewed-by: Christian Brauner +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + fs/namespace.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/namespace.c b/fs/namespace.c +index 281f08eaba5b9..809ec3acb147c 100644 +--- a/fs/namespace.c ++++ b/fs/namespace.c +@@ -569,7 +569,7 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq) + return 0; + mnt = real_mount(bastard); + mnt_add_count(mnt, 1); +- smp_mb(); // see mntput_no_expire() ++ smp_mb(); // see mntput_no_expire() and do_umount() + if (likely(!read_seqretry(&mount_lock, seq))) + return 0; + if (bastard->mnt_flags & MNT_SYNC_UMOUNT) { +@@ -1588,6 +1588,7 @@ static int do_umount(struct mount *mnt, int flags) + umount_tree(mnt, UMOUNT_PROPAGATE); + retval = 0; + } else { ++ smp_mb(); // paired with __legitimize_mnt() + shrink_submounts(mnt); + retval = -EBUSY; + if (!propagate_mount_busy(mnt, 2)) { +-- +2.39.5 + diff --git a/queue-5.4/iio-adc-dln2-use-aligned_s64-for-timestamp.patch b/queue-5.4/iio-adc-dln2-use-aligned_s64-for-timestamp.patch new file mode 100644 index 0000000000..7df1362cbd --- /dev/null +++ b/queue-5.4/iio-adc-dln2-use-aligned_s64-for-timestamp.patch @@ -0,0 +1,45 @@ +From 927097427083782501323e8c5712cac25db19886 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 13 Apr 2025 11:34:26 +0100 +Subject: iio: adc: dln2: Use aligned_s64 for timestamp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jonathan Cameron + +[ Upstream commit 5097eaae98e53f9ab9d35801c70da819b92ca907 ] + +Here the lack of marking allows the overall structure to not be +sufficiently aligned resulting in misplacement of the timestamp +in iio_push_to_buffers_with_timestamp(). Use aligned_s64 to +force the alignment on all architectures. + +Fixes: 7c0299e879dd ("iio: adc: Add support for DLN2 ADC") +Reported-by: David Lechner +Reviewed-by: Andy Shevchenko +Reviewed-by: Nuno Sá +Reviewed-by: David Lechner +Link: https://patch.msgid.link/20250413103443.2420727-4-jic23@kernel.org +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/adc/dln2-adc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iio/adc/dln2-adc.c b/drivers/iio/adc/dln2-adc.c +index 2e37834633ff8..02addbd33ebe6 100644 +--- a/drivers/iio/adc/dln2-adc.c ++++ b/drivers/iio/adc/dln2-adc.c +@@ -483,7 +483,7 @@ static irqreturn_t dln2_adc_trigger_h(int irq, void *p) + struct iio_dev *indio_dev = pf->indio_dev; + struct { + __le16 values[DLN2_ADC_MAX_CHANNELS]; +- int64_t timestamp_space; ++ aligned_s64 timestamp_space; + } data; + struct dln2_adc_get_all_vals dev_data; + struct dln2_adc *dln2 = iio_priv(indio_dev); +-- +2.39.5 + diff --git a/queue-5.4/mips-fix-max_reg_offset.patch b/queue-5.4/mips-fix-max_reg_offset.patch new file mode 100644 index 0000000000..11c1e15f14 --- /dev/null +++ b/queue-5.4/mips-fix-max_reg_offset.patch @@ -0,0 +1,39 @@ +From 0aa77d58ffae37be0e534ddddfbfc770e8210579 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 27 Apr 2025 13:34:24 +0200 +Subject: MIPS: Fix MAX_REG_OFFSET + +From: Thorsten Blum + +[ Upstream commit c44572e0cc13c9afff83fd333135a0aa9b27ba26 ] + +Fix MAX_REG_OFFSET to point to the last register in 'pt_regs' and not to +the marker itself, which could allow regs_get_register() to return an +invalid offset. + +Fixes: 40e084a506eb ("MIPS: Add uprobes support.") +Suggested-by: Maciej W. Rozycki +Signed-off-by: Thorsten Blum +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/ptrace.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h +index ae578860f7295..4ec9b306556f6 100644 +--- a/arch/mips/include/asm/ptrace.h ++++ b/arch/mips/include/asm/ptrace.h +@@ -65,7 +65,8 @@ static inline void instruction_pointer_set(struct pt_regs *regs, + + /* Query offset/name of register from its name/offset */ + extern int regs_query_register_offset(const char *name); +-#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last)) ++#define MAX_REG_OFFSET \ ++ (offsetof(struct pt_regs, __last) - sizeof(unsigned long)) + + /** + * regs_get_register() - get register value from its offset +-- +2.39.5 + diff --git a/queue-5.4/nvme-unblock-ctrl-state-transition-for-firmware-upda.patch b/queue-5.4/nvme-unblock-ctrl-state-transition-for-firmware-upda.patch new file mode 100644 index 0000000000..34d5f5eb3b --- /dev/null +++ b/queue-5.4/nvme-unblock-ctrl-state-transition-for-firmware-upda.patch @@ -0,0 +1,53 @@ +From 35bc279cd6ae06a92c358093f9a4237cf4d272b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 May 2025 10:58:00 +0200 +Subject: nvme: unblock ctrl state transition for firmware update + +From: Daniel Wagner + +[ Upstream commit 650415fca0a97472fdd79725e35152614d1aad76 ] + +The original nvme subsystem design didn't have a CONNECTING state; the +state machine allowed transitions from RESETTING to LIVE directly. + +With the introduction of nvme fabrics the CONNECTING state was +introduce. Over time the nvme-pci started to use the CONNECTING state as +well. + +Eventually, a bug fix for the nvme-fc started to depend that the only +valid transition to LIVE was from CONNECTING. Though this change didn't +update the firmware update handler which was still depending on +RESETTING to LIVE transition. + +The simplest way to address it for the time being is to switch into +CONNECTING state before going to LIVE state. + +Fixes: d2fe192348f9 ("nvme: only allow entering LIVE from CONNECTING state") +Reported-by: Guenter Roeck +Signed-off-by: Daniel Wagner +Closes: https://lore.kernel.org/all/0134ea15-8d5f-41f7-9e9a-d7e6d82accaa@roeck-us.net +Reviewed-by: Keith Busch +Reviewed-by: Sagi Grimberg +Reviewed-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 9816debe5cb51..94c8ef4a54d3f 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -3980,7 +3980,8 @@ static void nvme_fw_act_work(struct work_struct *work) + msleep(100); + } + +- if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE)) ++ if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) || ++ !nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE)) + return; + + nvme_start_queues(ctrl); +-- +2.39.5 + diff --git a/queue-5.4/series b/queue-5.4/series index 024d5db5eb..99e6fb721f 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -54,3 +54,8 @@ usb-usbtmc-use-interruptible-sleep-in-usbtmc_read.patch usb-usbtmc-fix-erroneous-get_stb-ioctl-error-returns.patch usb-usbtmc-fix-erroneous-wait_srq-ioctl-return.patch usb-usbtmc-fix-erroneous-generic_read-ioctl-return.patch +types-complement-the-aligned-types-with-signed-64-bi.patch +iio-adc-dln2-use-aligned_s64-for-timestamp.patch +mips-fix-max_reg_offset.patch +nvme-unblock-ctrl-state-transition-for-firmware-upda.patch +do_umount-add-missing-barrier-before-refcount-checks.patch diff --git a/queue-5.4/types-complement-the-aligned-types-with-signed-64-bi.patch b/queue-5.4/types-complement-the-aligned-types-with-signed-64-bi.patch new file mode 100644 index 0000000000..4e4cfe304d --- /dev/null +++ b/queue-5.4/types-complement-the-aligned-types-with-signed-64-bi.patch @@ -0,0 +1,52 @@ +From dbd9449544b97edd1edbe9a78232116056954c1c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Sep 2024 20:59:04 +0300 +Subject: types: Complement the aligned types with signed 64-bit one + +From: Andy Shevchenko + +[ Upstream commit e4ca0e59c39442546866f3dd514a3a5956577daf ] + +Some user may want to use aligned signed 64-bit type. +Provide it for them. + +Signed-off-by: Andy Shevchenko +Link: https://patch.msgid.link/20240903180218.3640501-2-andriy.shevchenko@linux.intel.com +Signed-off-by: Jonathan Cameron +Stable-dep-of: 5097eaae98e5 ("iio: adc: dln2: Use aligned_s64 for timestamp") +Signed-off-by: Sasha Levin +--- + include/linux/types.h | 3 ++- + include/uapi/linux/types.h | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/linux/types.h b/include/linux/types.h +index 05030f608be32..71e55c06c9639 100644 +--- a/include/linux/types.h ++++ b/include/linux/types.h +@@ -114,8 +114,9 @@ typedef u64 u_int64_t; + typedef s64 int64_t; + #endif + +-/* this is a special 64bit data type that is 8-byte aligned */ ++/* These are the special 64-bit data types that are 8-byte aligned */ + #define aligned_u64 __aligned_u64 ++#define aligned_s64 __aligned_s64 + #define aligned_be64 __aligned_be64 + #define aligned_le64 __aligned_le64 + +diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h +index 2fce8b6876e90..cf5f4617ba5aa 100644 +--- a/include/uapi/linux/types.h ++++ b/include/uapi/linux/types.h +@@ -46,6 +46,7 @@ typedef __u32 __bitwise __wsum; + * No conversions are necessary between 32-bit user-space and a 64-bit kernel. + */ + #define __aligned_u64 __u64 __attribute__((aligned(8))) ++#define __aligned_s64 __s64 __attribute__((aligned(8))) + #define __aligned_be64 __be64 __attribute__((aligned(8))) + #define __aligned_le64 __le64 __attribute__((aligned(8))) + +-- +2.39.5 +