Skip to contentSkip to conversation

6.2.15-rc1 review

PATCH In review Greg Kroah-Hartman 8 participants 673 messages May 8, 2023 – May 9, 2023 Page 1 of 6

Subsystems (6)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/663 ASOC: Intel: sof_sdw: add quirk for Intel Rooks County NUC M15

In reply to Greg Kroah-Hartman

From: Eugene Huang <[email protected]>

[ Upstream commit 3c728b1bc5b99c5275ac5c7788ef814c0e51ef54 ]

Same quirks as the 'Bishop County' NUC M15, except the rt711 is in the 'JD2 100K' jack detection mode.

---
 sound/soc/intel/boards/sof_sdw.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
sound/soc/intel/boards/sof_sdw.c +11 -0
index d2ed807abde95..767fa89d08708 100644
@@ -213,6 +213,17 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
 					SOF_SDW_PCH_DMIC |
 					RT711_JD1),
 	},
+	{
+		/* NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */
+		.callback = sof_sdw_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LAPRC"),
+		},
+		.driver_data = (void *)(SOF_SDW_TGL_HDMI |
+					SOF_SDW_PCH_DMIC |
+					RT711_JD2_100K),
+	},
 	/* TigerLake-SDCA devices */
 	{
 		.callback = sof_sdw_quirk_cb,
Signature · 1 line
2.39.2
author maintainer
#10 lore raw

PATCH 10/663 wifi: mt76: mt7921: Fix use-after-free in fw features query.

In reply to Greg Kroah-Hartman

From: Ben Greear <[email protected]>

[ Upstream commit 2ceb76f734e37833824b7fab6af17c999eb48d2b ]

Stop referencing 'features' memory after release_firmware is called.

Fixes this crash:

RIP: 0010:mt7921_check_offload_capability+0x17d
mt7921_pci_probe+0xca/0x4b0

...

---
 drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +5 -2
index d4b681d7e1d22..f2c6ec4d8e2ee 100644
@@ -162,12 +162,12 @@ mt7921_mac_init_band(struct mt7921_dev *dev, u8 band)
 
 u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
 {
-	struct mt7921_fw_features *features = NULL;
 	const struct mt76_connac2_fw_trailer *hdr;
 	struct mt7921_realease_info *rel_info;
 	const struct firmware *fw;
 	int ret, i, offset = 0;
 	const u8 *data, *end;
+	u8 offload_caps = 0;
 
 	ret = request_firmware(&fw, fw_wm, dev);
 	if (ret)
@@ -199,7 +199,10 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
 		data += sizeof(*rel_info);
 
 		if (rel_info->tag == MT7921_FW_TAG_FEATURE) {
+			struct mt7921_fw_features *features;
+
 			features = (struct mt7921_fw_features *)data;
+			offload_caps = features->data;
 			break;
 		}
 
@@ -209,7 +212,7 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
 out:
 	release_firmware(fw);
 
-	return features ? features->data : 0;
+	return offload_caps;
 }
 EXPORT_SYMBOL_GPL(mt7921_check_offload_capability);
 
Signature · 1 line
2.39.2
author maintainer
#11 lore raw

PATCH 11/663 selftests mount: Fix mount_setattr_test builds failed

In reply to Greg Kroah-Hartman

From: Anh Tuan Phan <[email protected]>

[ Upstream commit f1594bc676579133a3cd906d7d27733289edfb86 ]

When compiling selftests with target mount_setattr I encountered some errors with the below messages:
mount_setattr_test.c: In function ‘mount_setattr_thread’:
mount_setattr_test.c:343:16: error: variable ‘attr’ has initializer but incomplete type

  343 |         struct mount_attr attr = {
      |                ^~~~~~~~~~

These errors might be because of linux/mount.h is not included. This patch resolves that issue.

---
 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mount_setattr/mount_setattr_test.c +1 -0
index 8c5fea68ae677..969647228817b 100644
@@ -18,6 +18,7 @@
 #include <grp.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include <linux/mount.h>
 
 #include "../kselftest_harness.h"
 
Signature · 1 line
2.39.2
author maintainer
#12 lore raw

PATCH 12/663 scsi: mpi3mr: Handle soft reset in progress fault code (0xF002)

In reply to Greg Kroah-Hartman

From: Ranjan Kumar <[email protected]>

[ Upstream commit a3d27dfdcfc27ac3f46de5391bb6d24f04af7941 ]

The driver is exiting from the fault watchdog thread if it sees the 0xF002 (Soft reset in progress) fault code.

If the driver initiates the soft reset, then the driver restarts the watchdog at the end of the soft reset completion. However, if the soft reset is initiated by the firmware asynchronously, then the driver will never restart the watchdog and never re-initialize the controller after the asynchronous soft reset completion.

---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +1 -1
index a565817aa56d4..d109a4ceb72b1 100644
@@ -2526,7 +2526,7 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
 		mrioc->unrecoverable = 1;
 		goto schedule_work;
 	case MPI3_SYSIF_FAULT_CODE_SOFT_RESET_IN_PROGRESS:
-		return;
+		goto schedule_work;
 	case MPI3_SYSIF_FAULT_CODE_CI_ACTIVATION_RESET:
 		reset_reason = MPI3MR_RESET_FROM_CIACTIV_FAULT;
 		break;
Signature · 1 line
2.39.2
author maintainer
#13 lore raw

PATCH 13/663 net: sfp: add quirk enabling 2500Base-x for HG MXPD-483II

In reply to Greg Kroah-Hartman

From: Daniel Golle <[email protected]>

[ Upstream commit ad651d68cee75e9ac20002254c4e5d09ee67a84b ]

The HG MXPD-483II 1310nm SFP module is meant to operate with 2500Base-X, however, in their EEPROM they incorrectly specify:
Transceiver type : Ethernet: 1000BASE-LX
...
BR, Nominal : 2600MBd

Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway.

https://forum.banana-pi.org/t/bpi-r3-sfp-module-compatibility/14573/60

---
 drivers/net/phy/sfp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/phy/sfp.c +4 -0
index b224800d7db0b..10e66c89ca0fe 100644
@@ -395,6 +395,10 @@ static const struct sfp_quirk sfp_quirks[] = {
 
 	SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp),
 
+	// HG MXPD-483II-F 2.5G supports 2500Base-X, but incorrectly reports
+	// 2600MBd in their EERPOM
+	SFP_QUIRK_M("HG GENUINE", "MXPD-483II", sfp_quirk_2500basex),
+
 	// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd NRZ in
 	// their EEPROM
 	SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
Signature · 1 line
2.39.2
author maintainer
#14 lore raw

PATCH 14/663 platform/x86: thinkpad_acpi: Add missing T14s Gen1 type to s2idle quirk list

In reply to Greg Kroah-Hartman

From: Benjamin Asbach <[email protected]>

[ Upstream commit 9a469c6dfab38326f99f105386db84230be09ee3 ]

Quoted 9 lines

From the commit message adding the first s2idle quirks:

Lenovo laptops that contain NVME SSDs across a variety of generations have trouble resuming from suspend to idle when the IOMMU translation layer is active for the NVME storage device.

This generally manifests as a large resume delay or page faults. These delays and page faults occur as a result of a Lenovo BIOS specific SMI that runs during the D3->D0 transition on NVME devices.

Add the DMI ids for another variant of the T14s Gen1, which also needs the s2idle quirk.

---
 drivers/platform/x86/thinkpad_acpi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +8 -0
index 32c10457399e4..7191ff2625b1e 100644
@@ -4478,6 +4478,14 @@ static const struct dmi_system_id fwbug_list[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "20UH"),
 		}
 	},
+	{
+		.ident = "T14s Gen1 AMD",
+		.driver_data = &quirk_s2idle_bug,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "20UJ"),
+		}
+	},
 	{
 		.ident = "P14s Gen1 AMD",
 		.driver_data = &quirk_s2idle_bug,
Signature · 1 line
2.39.2
author maintainer
#15 lore raw

PATCH 15/663 wifi: ath11k: reduce the MHI timeout to 20s

In reply to Greg Kroah-Hartman

From: Kalle Valo <[email protected]>

[ Upstream commit cf5fa3ca0552f1b7ba8490de40700bbfb6979b17 ]

Currently ath11k breaks after hibernation, the reason being that ath11k expects that the wireless device will have power during suspend and the firmware will continue running. But of course during hibernation the power from the device is cut off and firmware is not running when resuming, so ath11k will fail.

(The reason why ath11k needs the firmware running is the interaction between mac80211 and MHI stack, it's a long story and more info in the bugzilla report.)

In SUSE kernels the watchdog timeout is reduced from the default 120 to 60 seconds:

CONFIG_DPM_WATCHDOG_TIMEOUT=60

But as the ath11k MHI timeout is 90 seconds the kernel will crash before will ath11k will recover in resume callback. To avoid the crash reduce the MHI timeout to just 20 seconds.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.9

---
 drivers/net/wireless/ath/ath11k/mhi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mhi.c +1 -1
index 86995e8dc9135..a62ee05c54097 100644
@@ -16,7 +16,7 @@
 #include "pci.h"
 #include "pcic.h"
 
-#define MHI_TIMEOUT_DEFAULT_MS	90000
+#define MHI_TIMEOUT_DEFAULT_MS	20000
 #define RDDM_DUMP_SIZE	0x420000
 
 static struct mhi_channel_config ath11k_mhi_channels_qca6390[] = {
Signature · 1 line
2.39.2
author maintainer
#16 lore raw

PATCH 16/663 tracing: Error if a trace event has an array for a __field()

In reply to Greg Kroah-Hartman

From: Steven Rostedt (Google) <[email protected]>

[ Upstream commit f82e7ca019dfad3b006fd3b772f7ac569672db55 ]

A __field() in the TRACE_EVENT() macro is used to set up the fields of the trace event data. It is for single storage units (word, char, int, pointer, etc) and not for complex structures or arrays. Unfortunately, there's nothing preventing the build from accepting:

    __field(int, arr[5]);

from building. It will turn into a array value. This use to work fine, as the offset and size use to be determined by the macro using the field name, but things have changed and the offset and size are now determined by the type. So the above would only be size 4, and the next field will be located 4 bytes from it (instead of 20).

The proper way to declare static arrays is to use the __array() macro.

Instead of __field(int, arr[5]) it should be __array(int, arr, 5).

Add some macro tricks to the building of a trace event from the TRACE_EVENT() macro such that __field(int, arr[5]) will fail to build. A comment by the failure will explain why the build failed.

---
 include/trace/stages/stage5_get_offsets.h | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
include/trace/stages/stage5_get_offsets.h +17 -4
index ac5c24d3beeb2..e30a13be46ba5 100644
@@ -9,17 +9,30 @@
 #undef __entry
 #define __entry entry
 
+/*
+ * Fields should never declare an array: i.e. __field(int, arr[5])
+ * If they do, it will cause issues in parsing and possibly corrupt the
+ * events. To prevent that from happening, test the sizeof() a fictitious
+ * type called "struct _test_no_array_##item" which will fail if "item"
+ * contains array elements (like "arr[5]").
+ *
+ * If you hit this, use __array(int, arr, 5) instead.
+ */
 #undef __field
-#define __field(type, item)
+#define __field(type, item)					\
+	{ (void)sizeof(struct _test_no_array_##item *); }
 
 #undef __field_ext
-#define __field_ext(type, item, filter_type)
+#define __field_ext(type, item, filter_type)			\
+	{ (void)sizeof(struct _test_no_array_##item *); }
 
 #undef __field_struct
-#define __field_struct(type, item)
+#define __field_struct(type, item)				\
+	{ (void)sizeof(struct _test_no_array_##item *); }
 
 #undef __field_struct_ext
-#define __field_struct_ext(type, item, filter_type)
+#define __field_struct_ext(type, item, filter_type)		\
+	{ (void)sizeof(struct _test_no_array_##item *); }
 
 #undef __array
 #define __array(type, item, len)
Signature · 1 line
2.39.2
author maintainer
#17 lore raw

PATCH 17/663 asm-generic/io.h: suppress endianness warnings for readq() and writeq()

In reply to Greg Kroah-Hartman

From: Vladimir Oltean <[email protected]>

[ Upstream commit d564fa1ff19e893e2971d66e5c8f49dc1cdc8ffc ]

Commit c1d55d50139b ("asm-generic/io.h: Fix sparse warnings on big-endian architectures") missed fixing the 64-bit accessors.

Arnd explains in the attached link why the casts are necessary, even if __raw_readq() and __raw_writeq() do not take endian-specific types.

---
 include/asm-generic/io.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/io.h +2 -2
index 4c44a29b5e8ef..d78c3056c98f9 100644
@@ -236,7 +236,7 @@ static inline u64 readq(const volatile void __iomem *addr)
 
 	log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);
 	__io_br();
-	val = __le64_to_cpu(__raw_readq(addr));
+	val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
 	__io_ar(val);
 	log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);
 	return val;
@@ -287,7 +287,7 @@ static inline void writeq(u64 value, volatile void __iomem *addr)
 {
 	log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
 	__io_bw();
-	__raw_writeq(__cpu_to_le64(value), addr);
+	__raw_writeq((u64 __force)__cpu_to_le64(value), addr);
 	__io_aw();
 	log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
 }
Signature · 1 line
2.39.2
author maintainer
#18 lore raw

PATCH 18/663 asm-generic/io.h: suppress endianness warnings for relaxed accessors

In reply to Greg Kroah-Hartman

From: Vladimir Oltean <[email protected]>

[ Upstream commit 05d3855b4d21ef3c2df26be1cbba9d2c68915fcb ]

Copy the forced type casts from the normal MMIO accessors to suppress the sparse warnings that point out __raw_readl() returns a native endian word (just like readl()).

---
 include/asm-generic/io.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/asm-generic/io.h +6 -6
index d78c3056c98f9..587e7e9b9a375 100644
@@ -319,7 +319,7 @@ static inline u16 readw_relaxed(const volatile void __iomem *addr)
 	u16 val;
 
 	log_read_mmio(16, addr, _THIS_IP_, _RET_IP_);
-	val = __le16_to_cpu(__raw_readw(addr));
+	val = __le16_to_cpu((__le16 __force)__raw_readw(addr));
 	log_post_read_mmio(val, 16, addr, _THIS_IP_, _RET_IP_);
 	return val;
 }
@@ -332,7 +332,7 @@ static inline u32 readl_relaxed(const volatile void __iomem *addr)
 	u32 val;
 
 	log_read_mmio(32, addr, _THIS_IP_, _RET_IP_);
-	val = __le32_to_cpu(__raw_readl(addr));
+	val = __le32_to_cpu((__le32 __force)__raw_readl(addr));
 	log_post_read_mmio(val, 32, addr, _THIS_IP_, _RET_IP_);
 	return val;
 }
@@ -345,7 +345,7 @@ static inline u64 readq_relaxed(const volatile void __iomem *addr)
 	u64 val;
 
 	log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);
-	val = __le64_to_cpu(__raw_readq(addr));
+	val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
 	log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);
 	return val;
 }
@@ -366,7 +366,7 @@ static inline void writeb_relaxed(u8 value, volatile void __iomem *addr)
 static inline void writew_relaxed(u16 value, volatile void __iomem *addr)
 {
 	log_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);
-	__raw_writew(cpu_to_le16(value), addr);
+	__raw_writew((u16 __force)cpu_to_le16(value), addr);
 	log_post_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);
 }
 #endif
@@ -376,7 +376,7 @@ static inline void writew_relaxed(u16 value, volatile void __iomem *addr)
 static inline void writel_relaxed(u32 value, volatile void __iomem *addr)
 {
 	log_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);
-	__raw_writel(__cpu_to_le32(value), addr);
+	__raw_writel((u32 __force)__cpu_to_le32(value), addr);
 	log_post_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);
 }
 #endif
@@ -386,7 +386,7 @@ static inline void writel_relaxed(u32 value, volatile void __iomem *addr)
 static inline void writeq_relaxed(u64 value, volatile void __iomem *addr)
 {
 	log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
-	__raw_writeq(__cpu_to_le64(value), addr);
+	__raw_writeq((u64 __force)__cpu_to_le64(value), addr);
 	log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
 }
 #endif
Signature · 1 line
2.39.2
author maintainer
#19 lore raw

PATCH 19/663 x86/cpu: Add model number for Intel Arrow Lake processor

In reply to Greg Kroah-Hartman

From: Tony Luck <[email protected]>

[ Upstream commit 81515ecf155a38f3532bf5ddef88d651898df6be ]

Successor to Lunar Lake.

---
 arch/x86/include/asm/intel-family.h |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/include/asm/intel-family.h +2 -0
@@ -125,6 +125,8 @@
 
 #define INTEL_FAM6_LUNARLAKE_M		0xBD
 
+#define INTEL_FAM6_ARROWLAKE		0xC6
+
 /* "Small Core" Processors (Atom/E-Core) */
 
 #define INTEL_FAM6_ATOM_BONNELL		0x1C /* Diamondville, Pineview */
author maintainer
#2 lore raw

PATCH 2/663 ASoC: Intel: soc-acpi: add table for Intel Rooks County NUC M15

In reply to Greg Kroah-Hartman

From: Eugene Huang <[email protected]>

[ Upstream commit 9c691a42b8926c8966561265cdae3ddc7464d3a2 ]

Same topology as the HP Omen 16-k0005TX, except with the rt1316 amp on link2.

---
 .../intel/common/soc-acpi-intel-adl-match.c   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
sound/soc/intel/common/soc-acpi-intel-adl-match.c +20 -0
index 28dd2046e4ac5..d8c80041388a7 100644
@@ -354,6 +354,20 @@ static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link3[] = {
 	{}
 };
 
+static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link2[] = {
+	{
+		.mask = BIT(0),
+		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
+		.adr_d = rt711_sdca_0_adr,
+	},
+	{
+		.mask = BIT(2),
+		.num_adr = ARRAY_SIZE(rt1316_2_single_adr),
+		.adr_d = rt1316_2_single_adr,
+	},
+	{}
+};
+
 static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = {
 	{
 		.adr = 0x000223019F837300ull,
@@ -624,6 +638,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
 		.drv_name = "sof_sdw",
 		.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l3.tplg",
 	},
+	{
+		.link_mask = 0x5, /* 2 active links required */
+		.links = adl_sdw_rt711_link0_rt1316_link2,
+		.drv_name = "sof_sdw",
+		.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l2.tplg",
+	},
 	{
 		.link_mask = 0x1, /* link0 required */
 		.links = adl_rvp,
Signature · 1 line
2.39.2
author maintainer
#20 lore raw

PATCH 20/663 wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset

In reply to Greg Kroah-Hartman

From: Mario Limonciello <[email protected]>

commit 09d4d6da1b65d09414e7bce61459593f3c80ead1 upstream.

When the BIOS has been configured for Fast Boot, systems with mt7921e have non-functional wifi. Turning on Fast boot caused both bus master enable and memory space enable bits in PCI_COMMAND not to get configured.

The mt7921 driver already sets bus master enable, but explicitly check and set memory access enable as well to fix this problem.

---
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +6 -0
@@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_d
 	struct mt76_dev *mdev;
 	u8 features;
 	int ret;
+	u16 cmd;
 
 	ret = pcim_enable_device(pdev);
 	if (ret)
@@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_d
 	if (ret)
 		return ret;
 
+	pci_read_config_word(pdev, PCI_COMMAND, &cmd);
+	if (!(cmd & PCI_COMMAND_MEMORY)) {
+		cmd |= PCI_COMMAND_MEMORY;
+		pci_write_config_word(pdev, PCI_COMMAND, cmd);
+	}
 	pci_set_master(pdev);
 
 	ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
author maintainer
#21 lore raw

PATCH 21/663 ASoC: amd: ps: update the acp clock source.

In reply to Greg Kroah-Hartman

From: Syed Saba Kareem <[email protected]>

commit a4d432e9132c0b29d857b09ca2ec4c1f455b5948 upstream.

Updating the clock source from ACLK to default clock

---
 sound/soc/amd/ps/pci-ps.c |    2 --
 1 file changed, 2 deletions(-)
sound/soc/amd/ps/pci-ps.c +0 -2
@@ -91,7 +91,6 @@ static int acp63_init(void __iomem *acp_
 		dev_err(dev, "ACP reset failed\n");
 		return ret;
 	}
-	acp63_writel(0x03, acp_base + ACP_CLKMUX_SEL);
 	acp63_enable_interrupts(acp_base);
 	return 0;
 }
@@ -106,7 +105,6 @@ static int acp63_deinit(void __iomem *ac
 		dev_err(dev, "ACP reset failed\n");
 		return ret;
 	}
-	acp63_writel(0, acp_base + ACP_CLKMUX_SEL);
 	acp63_writel(0, acp_base + ACP_CONTROL);
 	return 0;
 }
author maintainer
#22 lore raw

PATCH 22/663 arm64: Always load shadow stack pointer directly from the task struct

In reply to Greg Kroah-Hartman

From: Ard Biesheuvel <[email protected]>

commit 2198d07c509f1db4a1185d1f65aaada794c6ea59 upstream.

All occurrences of the scs_load macro load the value of the shadow call stack pointer from the task which is current at that point. So instead of taking a task struct register argument in the scs_load macro to specify the task struct to load from, let's always reference the current task directly. This should make it much harder to exploit any instruction sequences reloading the shadow call stack pointer register from memory.

---
 arch/arm64/include/asm/scs.h |    7 ++++---
 arch/arm64/kernel/entry.S    |    4 ++--
 arch/arm64/kernel/head.S     |    2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)
arch/arm64/include/asm/scs.h +4 -3
@@ -10,15 +10,16 @@
 #ifdef CONFIG_SHADOW_CALL_STACK
 	scs_sp	.req	x18
 
-	.macro scs_load tsk
-	ldr	scs_sp, [\tsk, #TSK_TI_SCS_SP]
+	.macro scs_load_current
+	get_current_task scs_sp
+	ldr	scs_sp, [scs_sp, #TSK_TI_SCS_SP]
 	.endm
 
 	.macro scs_save tsk
 	str	scs_sp, [\tsk, #TSK_TI_SCS_SP]
 	.endm
 #else
-	.macro scs_load tsk
+	.macro scs_load_current
 	.endm
 
 	.macro scs_save tsk
arch/arm64/kernel/entry.S +2 -2
@@ -275,7 +275,7 @@ alternative_if ARM64_HAS_ADDRESS_AUTH
 alternative_else_nop_endif
 1:
 
-	scs_load tsk
+	scs_load_current
 	.else
 	add	x21, sp, #PT_REGS_SIZE
 	get_current_task tsk
@@ -848,7 +848,7 @@ SYM_FUNC_START(cpu_switch_to)
 	msr	sp_el0, x1
 	ptrauth_keys_install_kernel x1, x8, x9, x10
 	scs_save x0
-	scs_load x1
+	scs_load_current
 	ret
 SYM_FUNC_END(cpu_switch_to)
 NOKPROBE(cpu_switch_to)
arch/arm64/kernel/head.S +1 -1
@@ -404,7 +404,7 @@ SYM_FUNC_END(create_kernel_mapping)
 	stp	xzr, xzr, [sp, #S_STACKFRAME]
 	add	x29, sp, #S_STACKFRAME
 
-	scs_load \tsk
+	scs_load_current
 
 	adr_l	\tmp1, __per_cpu_offset
 	ldr	w\tmp2, [\tsk, #TSK_TI_CPU]
author maintainer
#23 lore raw

PATCH 23/663 arm64: Stash shadow stack pointer in the task struct on interrupt

In reply to Greg Kroah-Hartman

From: Ard Biesheuvel <[email protected]>

commit 59b37fe52f49955791a460752c37145f1afdcad1 upstream.

Instead of reloading the shadow call stack pointer from the ordinary stack, which may be vulnerable to the kind of gadget based attacks shadow call stacks were designed to prevent, let's store a task's shadow call stack pointer in the task struct when switching to the shadow IRQ stack.

Given that currently, the task_struct::scs_sp field is only used to preserve the shadow call stack pointer while a task is scheduled out or running in user space, reusing this field to preserve and restore it while running off the IRQ stack must be safe, as those occurrences are guaranteed to never overlap. (The stack switching logic only switches stacks when running from the task stack, and so the value being saved here always corresponds to the task mode shadow stack)

While at it, fold a mov/add/mov sequence into a single add.

---
 arch/arm64/kernel/entry.S |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
arch/arm64/kernel/entry.S +5 -7
@@ -876,19 +876,19 @@ NOKPROBE(ret_from_fork)
  */
 SYM_FUNC_START(call_on_irq_stack)
 #ifdef CONFIG_SHADOW_CALL_STACK
-	stp	scs_sp, xzr, [sp, #-16]!
+	get_current_task x16
+	scs_save x16
 	ldr_this_cpu scs_sp, irq_shadow_call_stack_ptr, x17
 #endif
+
 	/* Create a frame record to save our LR and SP (implicit in FP) */
 	stp	x29, x30, [sp, #-16]!
 	mov	x29, sp
 
 	ldr_this_cpu x16, irq_stack_ptr, x17
-	mov	x15, #IRQ_STACK_SIZE
-	add	x16, x16, x15
 
 	/* Move to the new stack and call the function there */
-	mov	sp, x16
+	add	sp, x16, #IRQ_STACK_SIZE
 	blr	x1
 
 	/*
@@ -897,9 +897,7 @@ SYM_FUNC_START(call_on_irq_stack)
 	 */
 	mov	sp, x29
 	ldp	x29, x30, [sp], #16
-#ifdef CONFIG_SHADOW_CALL_STACK
-	ldp	scs_sp, xzr, [sp], #16
-#endif
+	scs_load_current
 	ret
 SYM_FUNC_END(call_on_irq_stack)
 NOKPROBE(call_on_irq_stack)
author maintainer
#24 lore raw

PATCH 24/663 powerpc/boot: Fix boot wrapper code generation with CONFIG_POWER10_CPU

In reply to Greg Kroah-Hartman

From: Nicholas Piggin <[email protected]>

commit 648a1783fe2551f5a091c9a5f8f463cb2cbf8745 upstream.

-mcpu=power10 will generate prefixed and pcrel code by default, which we do not support. The general kernel disables these with cflags, but those were missed for the boot wrapper.

Fixes 4b2a9315f20d ("powerpc/64s: POWER10 CPU Kconfig build option")
---
 arch/powerpc/boot/Makefile |    2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/boot/Makefile +2 -0
@@ -34,6 +34,8 @@ endif
 
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
+		 $(call cc-option,-mno-prefixed) $(call cc-option,-mno-pcrel) \
+		 $(call cc-option,-mno-mma) \
 		 $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \
 		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
 		 $(LINUXINCLUDE)
author maintainer
#25 lore raw

PATCH 25/663 PCI: kirin: Select REGMAP_MMIO

In reply to Greg Kroah-Hartman

From: Josh Triplett <[email protected]>

commit 3a2776e8a0e156a61f5b59ae341d8fffc730b962 upstream.

pcie-kirin uses regmaps, and needs to pull them in; otherwise, with CONFIG_PCIE_KIRIN=y and without CONFIG_REGMAP_MMIO pcie-kirin produces a linker failure looking for __devm_regmap_init_mmio_clk().

---
 drivers/pci/controller/dwc/Kconfig |    1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/Kconfig +1 -0
@@ -286,6 +286,7 @@ config PCIE_KIRIN
 	tristate "HiSilicon Kirin series SoCs PCIe controllers"
 	depends on PCI_MSI
 	select PCIE_DW_HOST
+	select REGMAP_MMIO
 	help
 	  Say Y here if you want PCIe controller support
 	  on HiSilicon Kirin series SoCs.
author maintainer
#26 lore raw

PATCH 26/663 PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock

In reply to Greg Kroah-Hartman

From: Lukas Wunner <[email protected]>

commit f5eff5591b8f9c5effd25c92c758a127765f74c1 upstream.

In 2013, commits

2e35afaefe64 ("PCI: pciehp: Add reset_slot() method") 608c388122c7 ("PCI: Add slot reset option to pci_dev_reset()")

amended PCIe hotplug to mask Presence Detect Changed events during a Secondary Bus Reset. The reset thus no longer causes gratuitous slot bringdown and bringup.

However the commits neglected to serialize reset with code paths reading slot registers. For instance, a slot bringup due to an earlier hotplug event may see the Presence Detect State bit cleared during a concurrent Secondary Bus Reset.

In 2018, commit

5b3f7b7d062b ("PCI: pciehp: Avoid slot access during reset")

retrofitted the missing locking. It introduced a reset_lock which serializes a Secondary Bus Reset with other parts of pciehp.

Unfortunately the locking turns out to be overzealous: reset_lock is held for the entire enumeration and de-enumeration of hotplugged devices, including driver binding and unbinding.

Driver binding and unbinding acquires device_lock while the reset_lock of the ancestral hotplug port is held. A concurrent Secondary Bus Reset acquires the ancestral reset_lock while already holding the device_lock. The asymmetric locking order in the two code paths can lead to AB-BA deadlocks.

Michael Haeuptle reports such deadlocks on simultaneous hot-removal and vfio release (the latter implies a Secondary Bus Reset):

pciehp_ist() # down_read(reset_lock)

    pciehp_handle_presence_or_link_change()
      pciehp_disable_slot()
        __pciehp_disable_slot()
          remove_board()
            pciehp_unconfigure_device()
              pci_stop_and_remove_bus_device()
                pci_stop_bus_device()
                  pci_stop_dev()
                    device_release_driver()
                      device_release_driver_internal()
                        __device_driver_lock()    # device_lock()

SYS_munmap()
vfio_device_fops_release()
vfio_device_group_close()
vfio_device_close()
vfio_device_last_close()
vfio_pci_core_close_device()
vfio_pci_core_disable() # device_lock()
__pci_reset_function_locked()
pci_reset_bus_function()
pci_dev_reset_slot_function()
pci_reset_hotplug_slot()
pciehp_reset_slot() # down_write(reset_lock)

Ian May reports the same deadlock on simultaneous hot-removal and an AER-induced Secondary Bus Reset:

aer_recover_work_func()
pcie_do_recovery()
aer_root_reset()
pci_bus_error_reset()
pci_slot_reset()
pci_slot_lock() # device_lock()
pci_reset_hotplug_slot()
pciehp_reset_slot() # down_write(reset_lock)

Fix by releasing the reset_lock during driver binding and unbinding, thereby splitting and shrinking the critical section.

Driver binding and unbinding is protected by the device_lock() and thus serialized with a Secondary Bus Reset. There's no need to additionally protect it with the reset_lock. However, pciehp does not bind and unbind devices directly, but rather invokes PCI core functions which also perform certain enumeration and de-enumeration steps.

The reset_lock's purpose is to protect slot registers, not enumeration and de-enumeration of hotplugged devices. That would arguably be the job of the PCI core, not the PCIe hotplug driver. After all, an AER-induced Secondary Bus Reset may as well happen during boot-time enumeration of the PCI hierarchy and there's no locking to prevent that either.

Exempting *de-enumeration* from the reset_lock is relatively harmless:
A concurrent Secondary Bus Reset may foil config space accesses such as PME interrupt disablement. But if the device is physically gone, those accesses are pointless anyway. If the device is physically present and only logically removed through an Attention Button press or the sysfs "power" attribute, PME interrupts as well as DMA cannot come through because pciehp_unconfigure_device() disables INTx and Bus Master bits. That's still protected by the reset_lock in the present commit.

Exempting *enumeration* from the reset_lock also has limited impact:
The exempted call to pci_bus_add_device() may perform device accesses through pcibios_bus_add_device() and pci_fixup_device() which are now no longer protected from a concurrent Secondary Bus Reset. Otherwise there should be no impact.

In essence, the present commit seeks to fix the AB-BA deadlocks while still retaining a best-effort reset protection for enumeration and de-enumeration of hotplugged devices -- until a general solution is implemented in the PCI core.

---
 drivers/pci/hotplug/pciehp_pci.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/hotplug/pciehp_pci.c +15 -0
@@ -63,7 +63,14 @@ int pciehp_configure_device(struct contr
 
 	pci_assign_unassigned_bridge_resources(bridge);
 	pcie_bus_configure_settings(parent);
+
+	/*
+	 * Release reset_lock during driver binding
+	 * to avoid AB-BA deadlock with device_lock.
+	 */
+	up_read(&ctrl->reset_lock);
 	pci_bus_add_devices(parent);
+	down_read_nested(&ctrl->reset_lock, ctrl->depth);
 
  out:
 	pci_unlock_rescan_remove();
@@ -104,7 +111,15 @@ void pciehp_unconfigure_device(struct co
 	list_for_each_entry_safe_reverse(dev, temp, &parent->devices,
 					 bus_list) {
 		pci_dev_get(dev);
+
+		/*
+		 * Release reset_lock during driver unbinding
+		 * to avoid AB-BA deadlock with device_lock.
+		 */
+		up_read(&ctrl->reset_lock);
 		pci_stop_and_remove_bus_device(dev);
+		down_read_nested(&ctrl->reset_lock, ctrl->depth);
+
 		/*
 		 * Ensure that no new Requests will be generated from
 		 * the device.
author maintainer
#27 lore raw

PATCH 27/663 PCI: qcom: Fix the incorrect register usage in v2.7.0 config

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

commit 2542e16c392508800f1d9037feee881a9c444951 upstream.

Qcom PCIe IP version v2.7.0 and its derivatives don't contain the PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT register. Instead, they have the new PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2 register. So fix the incorrect register usage which is modifying a different register.

Also in this IP version, this register change doesn't depend on MSI being enabled. So remove that check also.

Fixes ed8cc3b1fc84 ("PCI: qcom: Add support for SDM845 PCIe controller")
Cc <[email protected]> # 5.6+
---
 drivers/pci/controller/dwc/pcie-qcom.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +3 -5
@@ -1279,11 +1279,9 @@ static int qcom_pcie_init_2_7_0(struct q
 	val &= ~REQ_NOT_ENTR_L1;
 	writel(val, pcie->parf + PCIE20_PARF_PM_CTRL);
 
-	if (IS_ENABLED(CONFIG_PCI_MSI)) {
-		val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT);
-		val |= BIT(31);
-		writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT);
-	}
+	val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val |= BIT(31);
+	writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
 
 	return 0;
 err_disable_clocks:
author maintainer
#28 lore raw

PATCH 28/663 bus: mhi: host: pci_generic: Revert "Add a secondary AT port to Telit FN990"

In reply to Greg Kroah-Hartman

From: Slark Xiao <[email protected]>

commit 14853a0676c126aad836eb249499552fa9d6e85a upstream.

This reverts commit 2d5253a096c6057bbf7caa5520856dcdf7eca8bb. There are 2 commits with commit message "Add a secondary AT port to Telit FN990":

commit 2d5253a096c6 ("bus: mhi: host: pci_generic: Add a secondary AT port to Telit FN990")
commit 479aa3b0ec2e ("bus: mhi: host: pci_generic: Add a secondary AT port to Telit FN990")

This turned out to be due to the patch getting applied through different trees and git settled on a resolution while applying it second time. But the second AT port of Foxconn devices don't work in PCIe mode. So the second commit needs to be reverted.

Fixes 2d5253a096c6 ("bus: mhi: host: pci_generic: Add a secondary AT port to Telit FN990")
[mani: massaged the commit message a bit, added fixes tag and CCed stable]
---
 drivers/bus/mhi/host/pci_generic.c |    2 --
 1 file changed, 2 deletions(-)
drivers/bus/mhi/host/pci_generic.c +0 -2
@@ -344,8 +344,6 @@ static const struct mhi_channel_config m
 	MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0),
 	MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
 	MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
-	MHI_CHANNEL_CONFIG_UL(92, "DUN2", 32, 1),
-	MHI_CHANNEL_CONFIG_DL(93, "DUN2", 32, 1),
 	MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2),
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
author maintainer
#29 lore raw

PATCH 29/663 phy: qcom-qmp-pcie: sc8180x PCIe PHY has 2 lanes

In reply to Greg Kroah-Hartman

From: Dmitry Baryshkov <[email protected]>

commit 1db6b0a4246ce708b89f5136571130b9987741d1 upstream.

All PCIe PHYs on sc8180x platform have 2 lanes, so change the number of lanes to 2.

Fixes f839f14e24f2 ("phy: qcom-qmp: Add sc8180x PCIe support")
---
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +1 -1
@@ -1854,7 +1854,7 @@ static const struct qmp_phy_cfg msm8998_
 };
 
 static const struct qmp_phy_cfg sc8180x_pciephy_cfg = {
-	.lanes			= 1,
+	.lanes			= 2,
 
 	.tbls = {
 		.serdes		= sc8180x_qmp_pcie_serdes_tbl,
author maintainer
#3 lore raw

PATCH 3/663 ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm

In reply to Greg Kroah-Hartman

From: Shengjiu Wang <[email protected]>

[ Upstream commit 083a25b18d6ad9f1f540e629909aa3eaaaf01823 ]

The hw->formats may be set by snd_dmaengine_pcm_refine_runtime_hwparams() in component's startup()/open(), but soc_pcm_hw_init() will init hw->formats in dpcm_runtime_setup_fe() after component's startup()/open(), which causes the valuable hw->formats to be cleared.

So need to store the hw->formats before initialization, then restore it after initialization.

---
 sound/soc/soc-pcm.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/soc-pcm.c +4 -0
index 579a44d81d9a3..d409b99af75b2 100644
@@ -1649,10 +1649,14 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
 	struct snd_pcm_hardware *hw = &runtime->hw;
 	struct snd_soc_dai *dai;
 	int stream = substream->stream;
+	u64 formats = hw->formats;
 	int i;
 
 	soc_pcm_hw_init(hw);
 
+	if (formats)
+		hw->formats &= formats;
+
 	for_each_rtd_cpu_dais(fe, i, dai) {
 		struct snd_soc_pcm_stream *cpu_stream;
 
Signature · 1 line
2.39.2
author maintainer
#30 lore raw

PATCH 30/663 IMA: allow/fix UML builds

In reply to Greg Kroah-Hartman

From: Randy Dunlap <[email protected]>

commit 644f17412f5acf01a19af9d04a921937a2bc86c6 upstream.

UML supports HAS_IOMEM since 0bbadafdc49d (um: allow disabling NO_IOMEM).

Current IMA build on UML fails on allmodconfig (with TCG_TPM=m):

ld: security/integrity/ima/ima_queue.o: in function `ima_add_template_entry':
ima_queue.c:(.text+0x2d9): undefined reference to `tpm_pcr_extend'
ld: security/integrity/ima/ima_init.o: in function `ima_init':
ima_init.c:(.init.text+0x43f): undefined reference to `tpm_default_chip'
ld: security/integrity/ima/ima_crypto.o: in function `ima_calc_boot_aggregate_tfm':
ima_crypto.c:(.text+0x1044): undefined reference to `tpm_pcr_read'
ld: ima_crypto.c:(.text+0x10d8): undefined reference to `tpm_pcr_read'

Modify the IMA Kconfig entry so that it selects TCG_TPM if HAS_IOMEM is set, regardless of the UML Kconfig setting.
This updates TCG_TPM from =m to =y and fixes the linker errors.

Fixes f4a0391dfa91 ("ima: fix Kconfig dependencies")
Cc Stable <[email protected]> # v5.14+
Cc Fabio Estevam <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc Johannes Berg <[email protected]>
---
 security/integrity/ima/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/Kconfig +1 -1
@@ -8,7 +8,7 @@ config IMA
 	select CRYPTO_HMAC
 	select CRYPTO_SHA1
 	select CRYPTO_HASH_INFO
-	select TCG_TPM if HAS_IOMEM && !UML
+	select TCG_TPM if HAS_IOMEM
 	select TCG_TIS if TCG_TPM && X86
 	select TCG_CRB if TCG_TPM && ACPI
 	select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES
author maintainer
#4 lore raw

PATCH 4/663 x86/hyperv: Block root partition functionality in a Confidential VM

In reply to Greg Kroah-Hartman

From: Michael Kelley <[email protected]>

[ Upstream commit f8acb24aaf89fc46cd953229462ea8abe31b395f ]

Hyper-V should never specify a VM that is a Confidential VM and also running in the root partition. Nonetheless, explicitly block such a combination to guard against a compromised Hyper-V maliciously trying to exploit root partition functionality in a Confidential VM to expose Confidential VM secrets. No known bug is being fixed, but the attack surface for Confidential VMs on Hyper-V is reduced.

---
 arch/x86/kernel/cpu/mshyperv.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/mshyperv.c +8 -4
index 46668e2554210..1ce228dc267ae 100644
@@ -291,12 +291,16 @@ static void __init ms_hyperv_init_platform(void)
 	 * To mirror what Windows does we should extract CPU management
 	 * features and use the ReservedIdentityBit to detect if Linux is the
 	 * root partition. But that requires negotiating CPU management
-	 * interface (a process to be finalized).
+	 * interface (a process to be finalized). For now, use the privilege
+	 * flag as the indicator for running as root.
 	 *
-	 * For now, use the privilege flag as the indicator for running as
-	 * root.
+	 * Hyper-V should never specify running as root and as a Confidential
+	 * VM. But to protect against a compromised/malicious Hyper-V trying
+	 * to exploit root behavior to expose Confidential VM memory, ignore
+	 * the root partition setting if also a Confidential VM.
 	 */
-	if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_CPU_MANAGEMENT) {
+	if ((ms_hyperv.priv_high & HV_CPU_MANAGEMENT) &&
+	    !(ms_hyperv.priv_high & HV_ISOLATION)) {
 		hv_root_partition = true;
 		pr_info("Hyper-V: running as root partition\n");
 	}
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH 5/663 ASoC: amd: yc: Add DMI entries to support Victus by HP Laptop 16-e1xxx (8A22)

In reply to Greg Kroah-Hartman

From: Ge-org Brohammer <[email protected]>

[ Upstream commit 205efd4619b860404ebb5882e5a119eb3b3b3716 ]

This model requires an additional detection quirk to enable the internal microphone.

Tried to use git send-email this time.

---
 sound/soc/amd/yc/acp6x-mach.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
index 4a69ce702360c..0acdf0156f075 100644
@@ -269,6 +269,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
 			DMI_MATCH(DMI_BOARD_NAME, "8A43"),
 		}
 	},
+	{
+		.driver_data = &acp6x_card,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
+			DMI_MATCH(DMI_BOARD_NAME, "8A22"),
+		}
+	},
 	{}
 };
 
Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH 6/663 iio: adc: palmas_gpadc: fix NULL dereference on rmmod

In reply to Greg Kroah-Hartman

From: Patrik Dahlström <[email protected]>

[ Upstream commit 49f76c499d38bf67803438eee88c8300d0f6ce09 ]

Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL.

---
 drivers/iio/adc/palmas_gpadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/palmas_gpadc.c +1 -1
index fd000345ec5cf..849a697a467e5 100644
@@ -639,7 +639,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev)
 
 static int palmas_gpadc_remove(struct platform_device *pdev)
 {
-	struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev);
+	struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev);
 	struct palmas_gpadc *adc = iio_priv(indio_dev);
 
 	if (adc->wakeup1_enable || adc->wakeup2_enable)
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

PATCH 7/663 ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750

In reply to Greg Kroah-Hartman

From: Hans de Goede <[email protected]>

[ Upstream commit e38c5e80c3d293a883c6f1d553f2146ec0bda35e ]

The Acer Iconia One 7 B1-750 tablet mostly works fine with the defaults for an Bay Trail CR tablet. Except for the internal mic, instead of an analog mic on IN3 a digital mic on DMIC1 is uses.

Add a quirk with these settings for this tablet.

---
 sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
index 79e0039c79a38..5a12940ef9070 100644
@@ -533,6 +533,18 @@ static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,
 
 /* Please keep this list alphabetically sorted */
 static const struct dmi_system_id byt_rt5640_quirk_table[] = {
+	{	/* Acer Iconia One 7 B1-750 */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "VESPA2"),
+		},
+		.driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
+					BYT_RT5640_JD_SRC_JD1_IN4P |
+					BYT_RT5640_OVCD_TH_1500UA |
+					BYT_RT5640_OVCD_SF_0P75 |
+					BYT_RT5640_SSP0_AIF1 |
+					BYT_RT5640_MCLK_EN),
+	},
 	{	/* Acer Iconia Tab 8 W1-810 */
 		.matches = {
 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
Signature · 1 line
2.39.2
author maintainer
#8 lore raw

PATCH 8/663 ASoC: da7213.c: add missing pm_runtime_disable()

In reply to Greg Kroah-Hartman

From: Duy Nguyen <[email protected]>

[ Upstream commit 44378cd113e5f15bb0a89f5ac5a0e687b52feb90 ]

da7213.c is missing pm_runtime_disable(), thus we will get below error when rmmod -> insmod.

	$ rmmod  snd-soc-da7213.ko
	$ insmod snd-soc-da7213.ko
	da7213 0-001a: Unbalanced pm_runtime_enable!"

[Kuninori adjusted to latest upstream]

---
 sound/soc/codecs/da7213.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/soc/codecs/da7213.c +6 -0
index 544ccbcfc8844..5678683c71bee 100644
@@ -1996,6 +1996,11 @@ static int da7213_i2c_probe(struct i2c_client *i2c)
 	return ret;
 }
 
+static void da7213_i2c_remove(struct i2c_client *i2c)
+{
+	pm_runtime_disable(&i2c->dev);
+}
+
 static int __maybe_unused da7213_runtime_suspend(struct device *dev)
 {
 	struct da7213_priv *da7213 = dev_get_drvdata(dev);
@@ -2039,6 +2044,7 @@ static struct i2c_driver da7213_i2c_driver = {
 		.pm = &da7213_pm,
 	},
 	.probe_new	= da7213_i2c_probe,
+	.remove		= da7213_i2c_remove,
 	.id_table	= da7213_i2c_id,
 };
 
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH 9/663 net: wwan: t7xx: do not compile with -Werror

In reply to Greg Kroah-Hartman

From: Jiri Slaby (SUSE) <[email protected]>

[ Upstream commit 362f0b6678ad1377c322a7dd237ea6785efc7342 ]

When playing with various compilers or their versions, some choke on the t7xx code. For example (with gcc 13):
In file included from ./arch/s390/include/generated/asm/rwonce.h:1,

                  from ../include/linux/compiler.h:247,
                  from ../include/linux/build_bug.h:5,
                  from ../include/linux/bits.h:22,
                  from ../drivers/net/wwan/t7xx/t7xx_state_monitor.c:17:
 In function 'preempt_count',
     inlined from 't7xx_fsm_append_event' at ../drivers/net/wwan/t7xx/t7xx_state_monitor.c:439:43:

../include/asm-generic/rwonce.h:44:26: error: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Werror=array-bounds=]

There is no reason for any code in the kernel to be built with -Werror by default. Note that we have generic CONFIG_WERROR. So if anyone wants -Werror, they can enable that.

Cc Chandrashekar Devegowda <[email protected]>
Cc Intel Corporation <[email protected]>
Cc Chiranjeevi Rapolu <[email protected]>
Cc Liu Haijun <[email protected]>
Cc M Chetan Kumar <[email protected]>
Cc Ricardo Martinez <[email protected]>
Cc Loic Poulain <[email protected]>
Cc Sergey Ryazanov <[email protected]>
Cc Johannes Berg <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
---
 drivers/net/wwan/t7xx/Makefile | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wwan/t7xx/Makefile +0 -2
index 268ff9e87e5b3..2652cd00504e6 100644
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-ccflags-y += -Werror
-
 obj-${CONFIG_MTK_T7XX} := mtk_t7xx.o
 mtk_t7xx-y:=	t7xx_pci.o \
 		t7xx_pcie_mac.o \
Signature · 1 line
2.39.2

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 6.2.15-rc1 review

This is the start of the stable review cycle for the 6.2.15 release. There are 663 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 10 May 2023 09:42:40 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.2.15-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.2.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 6.2.15-rc1

Thomas Gleixner <[email protected]>
debugobject: Ensure pool refill (again)

Jan Sokolowski <[email protected]>
i40e: use int for i40e_status

Jan Sokolowski <[email protected]>
i40e: Remove string printing for i40e_status

Jan Sokolowski <[email protected]>
i40e: Remove unused i40e status codes

Adrian Hunter <[email protected]>
perf intel-pt: Fix CYC timestamps after standalone CBR

Adrian Hunter <[email protected]>
perf auxtrace: Fix address filter entire kernel size

Jiri Slaby (SUSE) <[email protected]>
thunderbolt: Use correct type in tb_port_is_clx_enabled() prototype

Paulo Alcantara <[email protected]>
cifs: protect access of TCP_Server_Info::{origin,leaf}_fullpath

Paulo Alcantara <[email protected]>
cifs: fix potential race when tree connecting ipc

Paulo Alcantara <[email protected]>
cifs: fix sharing of DFS connections

Paulo Alcantara <[email protected]>
cifs: protect session status check in smb2_reconnect()

Paulo Alcantara <[email protected]>
cifs: fix potential use-after-free bugs in TCP_Server_Info::hostname

Arnd Bergmann <[email protected]>
blk-iocost: avoid 64-bit division in ioc_timer_fn

Li Lingfeng <[email protected]>
dm: don't lock fs when the map is NULL in process of resume

Mike Snitzer <[email protected]>
dm ioctl: fix nested locking in table_clear() to remove deadlock concern

Mikulas Patocka <[email protected]>
dm flakey: fix a crash with invalid table line

Mike Snitzer <[email protected]>
dm integrity: call kmem_cache_destroy() in dm_integrity_init() error path

Mike Snitzer <[email protected]>
dm clone: call kmem_cache_destroy() in dm_clone_init() error path

Yeongjin Gil <[email protected]>
dm verity: fix error handling for check_at_most_once on FEC

Cindy Lu <[email protected]>
vhost_vdpa: fix unmap process in no-batch mode

Lorenzo Stoakes <[email protected]>
mm/mempolicy: correctly update prev when policy is equal on mbind

Hugh Dickins <[email protected]>
ia64: fix an addr to taddr in huge_pte_offset()

Stefan Haberland <[email protected]>
s390/dasd: fix hanging blockdevice after request requeue

Qu Wenruo <[email protected]>
btrfs: scrub: reject unsupported scrub flags

Peng Liu <[email protected]>
scripts/gdb: fix lx-timerlist for Python3

Quentin Schulz <[email protected]>
clk: rockchip: rk3399: allow clk_cifout to force clk_cifout_src to reparent

Conor Dooley <[email protected]>
clk: microchip: fix potential UAF in auxdev release callback

Ping-Ke Shih <[email protected]>
wifi: rtw89: fix potential race condition between napi_init and napi_enable

Sascha Hauer <[email protected]>
wifi: rtw88: rtw8821c: Fix rfe_option field width

Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: RTL8192EU always needs full init

Huanhuan Wang <[email protected]>
nfp: fix incorrect pointer deference when offloading IPsec with bonding

Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix typo in IPI documentation

Marco Elver <[email protected]>
kcsan: Avoid READ_ONCE() in read_instrumented_memory()

Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix IPI isr handling

Tanmay Shah <[email protected]>
drivers: remoteproc: xilinx: Fix carveout names

Tudor Ambarus <[email protected]>
mtd: spi-nor: core: Update flash's current address mode when changing address mode

Michael Walle <[email protected]>
mtd: core: fix error path for nvmem provider

Michael Walle <[email protected]>
mtd: core: fix nvmem error reporting

Michael Walle <[email protected]>
mtd: core: provide unique name for nvmem device, take two

Mark Rutland <[email protected]>
kasan: hw_tags: avoid invalid virt_to_page()

Jan Kara <[email protected]>
md/raid5: Improve performance for sequential IO

Li Nan <[email protected]>
md/raid10: fix null-ptr-deref in raid10_sync_request

Christoph Böhmwalder <[email protected]>
drbd: correctly submit flush bio on barrier

Jan Kara <[email protected]>
mm: do not reclaim private data from pinned page

Ryusuke Konishi <[email protected]>
nilfs2: fix infinite loop in nilfs_mdt_get_block()

Ryusuke Konishi <[email protected]>
nilfs2: do not write dirty data after degenerating to read-only

Kai-Heng Feng <[email protected]>
ALSA: hda/realtek: Fix mute and micmute LEDs for an HP laptop

Caleb Harper <[email protected]>

    ALSA: hda/realtek: support HP Pavilion Aero 13-be0xxx Mute LED

Mark Asselstine <[email protected]>
ALSA: hda/realtek: Add quirk for ASUS UM3402YAR using CS35L41

Vitaly Rodionov <[email protected]>
ALSA: hda/realtek: Add quirk for ThinkPad P1 Gen 6

Geraldo Nascimento <[email protected]>
ALSA: usb-audio: Add quirk for Pioneer DDJ-800

Helge Deller <[email protected]>
parisc: Ensure page alignment in flush functions

Helge Deller <[email protected]>
parisc: Fix argument pointer in real64_call_asm()

Marc Dionne <[email protected]>
afs: Avoid endless loop if file is larger than expected

David Howells <[email protected]>
afs: Fix getattr to report server i_size on dirs, not local size

Marc Dionne <[email protected]>
afs: Fix updating of i_size with dv jump from server

Chen Yu <[email protected]>
PM: hibernate: Do not get block device exclusively in test_resume mode

Chen Yu <[email protected]>
PM: hibernate: Turn snapshot_test into global variable

Hans de Goede <[email protected]>
ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini

Dan Carpenter <[email protected]>
hte: tegra-194: Fix off by one in tegra_hte_map_to_line_id()

Arnd Bergmann <[email protected]>
hte: tegra: fix 'struct of_device_id' build error

Charles Keepax <[email protected]>
mfd: arizona-spi: Add missing MODULE_DEVICE_TABLE

Colin Foster <[email protected]>
mfd: ocelot-spi: Fix unsupported bulk read

Matthias Schiffer <[email protected]>
mfd: tqmx86: Correct board names for TQMxE39x

Matthias Schiffer <[email protected]>
mfd: tqmx86: Specify IO port register range more precisely

Matthias Schiffer <[email protected]>
mfd: tqmx86: Do not access I2C_DETECT register through io_base

Kang Chen <[email protected]>
thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe

Hans Verkuil <[email protected]>
pinctrl-bcm2835.c: fix race condition when setting gpio dir

Claudiu Beznea <[email protected]>
dmaengine: at_xdmac: do not enable all cyclic channels

Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing

Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to change for continuous transfer

Dmitry Baryshkov <[email protected]>
dma: gpi: remove spurious unlock in gpi_ch_init

Siddharth Vadapalli <[email protected]>
phy: ti: j721e-wiz: Fix unreachable code in wiz_mode_select()

Gaosheng Cui <[email protected]>
phy: tegra: xusb: Add missing tegra_xusb_port_unregister for usb2_port and ulpi_port

Pierre-Louis Bossart <[email protected]>
soundwire: intel: don't save hw_params for use in prepare

AngeloGioacchino Del Regno <[email protected]>
pwm: mtk-disp: Configure double buffering before reading in .get_state()

AngeloGioacchino Del Regno <[email protected]>
pwm: mtk-disp: Disable shadow registers before setting backlight values

H. Nikolaus Schaller <[email protected]>
leds: tca6507: Fix error handling of using fwnode_property_read_string

Christophe JAILLET <[email protected]>
dmaengine: mv_xor_v2: Fix an error code.

Arınç ÜNAL <[email protected]>
pinctrl: ralink: reintroduce ralink,rt2880-pinmux compatible string

Randy Dunlap <[email protected]>
leds: TI_LMU_COMMON: select REGMAP instead of depending on it

Geert Uytterhoeven <[email protected]>
pinctrl: renesas: r8a779g0: Fix ERROROUTC function names

Geert Uytterhoeven <[email protected]>
pinctrl: renesas: r8a779g0: Fix Group 6/7 pin functions

Geert Uytterhoeven <[email protected]>
pinctrl: renesas: r8a779g0: Fix Group 4/5 pin functions

Phong Hoang <[email protected]>
pinctrl: renesas: r8a779f0: Fix tsn1_avtp_pps pin group

Hai Pham <[email protected]>
pinctrl: renesas: r8a779a0: Remove incorrect AVB[01] pinmux configuration

Ye Bin <[email protected]>
ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline

Zhihao Cheng <[email protected]>
ext4: fix i_disksize exceeding i_size problem in paritally written case

Bharath SM <[email protected]>
SMB3: Close deferred file handles in case of handle lease break

Bharath SM <[email protected]>
SMB3: Add missing locks to protect deferred close file list

Geert Uytterhoeven <[email protected]>
timekeeping: Fix references to nonexistent ktime_get_fast_ns()

Stafford Horne <[email protected]>
openrisc: Properly store r31 to pt_regs on unhandled exceptions

Qinrun Dai <[email protected]>
clocksource/drivers/davinci: Fix memory leak in davinci_timer_register when init fails

Mark Zhang <[email protected]>
RDMA/mlx5: Use correct device num_ports when modify DC

Dai Ngo <[email protected]>
SUNRPC: remove the maximum number of retries in call_bind_status

Mark Bloch <[email protected]>
RDMA/mlx5: Fix flow counter query via DEVX

Avihai Horon <[email protected]>
RDMA/mlx5: Check pcie_relaxed_ordering_enabled() in UMR

Zhu Yanjun <[email protected]>
RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"

Bob Pearson <[email protected]>
RDMA/rxe: Remove __rxe_do_task()

Bob Pearson <[email protected]>
RDMA/rxe: Convert tasklet args to queue pairs

Michael Kelley <[email protected]>
swiotlb: fix debugfs reporting of reserved memory pools

Doug Berger <[email protected]>
swiotlb: relocate PageHighMem test away from rmem_swiotlb_setup

Miaoqian Lin <[email protected]>
Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe

Konrad Dybcio <[email protected]>
clk: qcom: dispcc-qcm2290: Remove inexistent DSI1PHY clk

Dmitry Baryshkov <[email protected]>
clk: qcom: dispcc-qcm2290: get rid of test clock

Dmitry Baryshkov <[email protected]>
clk: qcom: gcc-sm8350: fix PCIe PIPE clocks handling

Mohammad Rafi Shaik <[email protected]>
clk: qcom: lpassaudiocc-sc7280: Add required gdsc power domain clks in lpass_cc_sc7280_desc

Srinivasa Rao Mandadapu <[email protected]>
clk: qcom: lpasscc-sc7280: Skip qdsp6ss clock registration

Heiko Carstens <[email protected]>
s390/checksum: always use cksm instruction

Jerry Snitselaar <[email protected]>
iommu/amd: Set page size bitmap during V2 domain allocation

Trond Myklebust <[email protected]>
NFSv4.1: Always send a RECLAIM_COMPLETE after establishing lease

Peng Fan <[email protected]>
clk: imx: imx8ulp: Fix XBAR_DIVBUS and AD_SLOW clock parents

Peng Fan <[email protected]>
clk: imx: fracn-gppll: disable hardware select control

Peng Fan <[email protected]>
clk: imx: fracn-gppll: fix the rate table

Patrick Kelsey <[email protected]>
IB/hfi1: Fix bugs with non-PAGE_SIZE-end multi-iovec user SDMA requests

Patrick Kelsey <[email protected]>
IB/hfi1: Fix SDMA mmu_rb_node not being evicted in LRU order

Saravanan Vajravel <[email protected]>
RDMA/srpt: Add a check for valid 'mad_agent' pointer

Mark Zhang <[email protected]>
RDMA/cm: Trace icm_send_rej event before the cm state is reset

Chris Morgan <[email protected]>
power: supply: rk817: Fix low SOC bugs

Konrad Dybcio <[email protected]>
clk: qcom: gcc-sm6115: Mark RCGs shared where applicable

Tetsuo Handa <[email protected]>
RDMA/siw: Remove namespace check from siw_netdev_event()

Clément Léger <[email protected]>
clk: add missing of_node_put() in "assigned-clocks" property parsing

Sebastian Reichel <[email protected]>
power: supply: generic-adc-battery: fix unit scaling

Bob Pearson <[email protected]>
RDMA/rxe: Remove tasklet call from rxe_cq.c

Yong Wu <[email protected]>
iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN

Zeng Heng <[email protected]>
fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de()

ZhangPeng <[email protected]>
fs/ntfs3: Fix OOB read in indx_insert_into_buffer

ZhangPeng <[email protected]>

    fs/ntfs3: Fix null-ptr-deref on inode->i_op in ntfs_lookup()

Jiasheng Jiang <[email protected]>
fs/ntfs3: Add check for kmemdup

Chen Zhongjin <[email protected]>
fs/ntfs3: Fix memory leak if ntfs_read_mft failed

Cheng Xu <[email protected]>
RDMA/erdma: Use fixed hardware page size

Bob Pearson <[email protected]>
RDMA/rxe: Replace exists by rxe in rxe.c

Dhruva Gole <[email protected]>
rtc: k3: handle errors while enabling wake irq

Martin Blumenstingl <[email protected]>
rtc: meson-vrtc: Use ktime_get_real_ts64() to get the current time

Dan Carpenter <[email protected]>
RDMA/mlx4: Prevent shift wrapping in set_user_sq_size()

Krzysztof Kozlowski <[email protected]>
rtc: omap: include header for omap_rtc_power_off_program prototype

Petr Mladek <[email protected]>
workqueue: Fix hung time report of worker pools

Konrad Dybcio <[email protected]>
clk: qcom: gcc-qcm2290: Fix up gcc_sdcc2_apps_clk_src

Yang Yingliang <[email protected]>
clk: mediatek: clk-pllfh: fix missing of_node_put() in fhctl_parse_dt()

Natalia Petrova <[email protected]>
RDMA/rdmavt: Delete unnecessary NULL check

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: mt8135: Properly use CLK_IS_CRITICAL flag

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: mt7622: Properly use CLK_IS_CRITICAL flag

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: Consistently use GATE_MTK() macro

AngeloGioacchino Del Regno <[email protected]>
clk: mediatek: mt2712: Add error handling to clk_mt2712_apmixed_probe()

Daniil Dulov <[email protected]>
RDMA/siw: Fix potential page_array out of range access

Kang Chen <[email protected]>
IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init

Claudiu Beznea <[email protected]>
clk: at91: clk-sam9x60-pll: fix return value check

Beau Belgrave <[email protected]>
tracing/user_events: Ensure write index cannot be negative

Colin Ian King <[email protected]>
rv: Fix addition on an uninitialized variable 'run'

Schspa Shi <[email protected]>
sched/rt: Fix bad task migration for rt tasks

Alexandre Ghiti <[email protected]>
riscv: Fix ptdump when KASAN is enabled

Josh Poimboeuf <[email protected]>
Revert "objtool: Support addition to set CFA base"

Yang Jihong <[email protected]>
perf/core: Fix hardlockup failure caused by perf throttle

Libo Chen <[email protected]>
sched/fair: Fix inaccurate tally of ttwu_move_affine

Nathan Lynch <[email protected]>
powerpc/rtas: use memmove for potentially overlapping buffer copy

Randy Dunlap <[email protected]>
macintosh: via-pmu-led: requires ATA to be set

Randy Dunlap <[email protected]>
powerpc/sysdev/tsi108: fix resource printk format warnings

Randy Dunlap <[email protected]>
powerpc/wii: fix resource printk format warnings

Randy Dunlap <[email protected]>
powerpc/mpc512x: fix resource printk format warning

Christophe Leroy <[email protected]>
powerpc/perf: Properly detect mpc7450 family

Liang He <[email protected]>
macintosh/windfarm_smu_sat: Add missing of_node_put()

Kajol Jain <[email protected]>
selftests/powerpc/pmu: Fix sample field check in the mmcra_thresh_marked_sample_test

Christophe JAILLET <[email protected]>
fbdev: mmp: Fix deferred clk handling in mmphw_probe()

Dhruva Gole <[email protected]>
spi: bcm63xx: remove PM_SLEEP based conditional compilation

Albert Huang <[email protected]>
virtio_ring: don't update event idx on get_buf

Jishnu Prakash <[email protected]>
spmi: Add a check for remove callback when removing a SPMI driver

Philipp Hortmann <[email protected]>
staging: rtl8192e: Fix W_DISABLE# does not work after stop/start

Dhruva Gole <[email protected]>
spi: cadence-quadspi: use macro DEFINE_SIMPLE_DEV_PM_OPS

Florian Fainelli <[email protected]>
serial: 8250: Add missing wakeup event reporting

Shenwei Wang <[email protected]>
tty: serial: fsl_lpuart: adjust buffer length to the intended size

Dan Carpenter <[email protected]>
firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe

Chunfeng Yun <[email protected]>
usb: mtu3: fix kernel panic at qmu transfer done irq handler

Yinhao Hu <[email protected]>
usb: chipidea: fix missing goto in ci_hdrc_probe

Jon Hunter <[email protected]>
usb: gadget: tegra-xudc: Fix crash in vbus_draw

John Paul Adrian Glaubitz <[email protected]>
sh: sq: Fix incorrect element size for allocating bitmap buffer

Kevin Brodsky <[email protected]>
uapi/linux/const.h: prefer ISO-friendly __typeof__

Florian Fainelli <[email protected]>
scripts/gdb: raise error with reduced debugging information

Lars-Peter Clausen <[email protected]>
i2c: xiic: xiic_xfer(): Fix runtime PM leak on error path

Lars-Peter Clausen <[email protected]>
i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path

Dhruva Gole <[email protected]>
spi: cadence-quadspi: fix suspend-resume implementations

Konrad Dybcio <[email protected]>
drm/panel: novatek-nt35950: Only unregister DSI1 if it exists

Alex Williamson <[email protected]>
PCI/PM: Extend D3hot delay for NVIDIA HDA controllers

Liliang Ye <[email protected]>
ASoC: fsl_mqs: move of_node_put() to the correct location

Konrad Dybcio <[email protected]>
drm/panel: novatek-nt35950: Improve error handling

Suzuki K Poulose <[email protected]>
coresight: etm_pmu: Set the module field

Pierre Gondois <[email protected]>
cacheinfo: Check sib_leaf in cache_leaves_are_shared()

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Handle "no sensors" enabled for SFH1.1

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Increase sensor command timeout for SFH1.1

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Correct the stop all command

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Add support for shutdown operation

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Fix illuminance value

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Correct the sensor enable and disable command

Basavaraj Natikar <[email protected]>
HID: amd_sfh: Correct the structure fields

Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no generic PD

Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no clocks

Randy Dunlap <[email protected]>
ia64: salinfo: placate defined-but-not-used warning

Randy Dunlap <[email protected]>
ia64: mm/contig: fix section mismatch warning/error

Kuppuswamy Sathyanarayanan <[email protected]>
PCI/EDR: Clear Device Status after EDR error recovery

Miquel Raynal <[email protected]>
of: Fix modalias string generation

Dae R. Jeong <[email protected]>
vmci_host: fix a race condition in vmci_host_poll() causing GPF

Christophe Leroy <[email protected]>
spi: fsl-spi: Fix CPM/QE mode Litte Endian

Tharun Kumar P <[email protected]>
spi: mchp-pci1xxxx: Fix SPI transactions not working after suspend and resume

Tharun Kumar P <[email protected]>
spi: mchp-pci1xxxx: Fix length of SPI transactions not set properly in driver

Johan Hovold <[email protected]>
interconnect: qcom: rpm: drop bogus pm domain attach

Uwe Kleine-König <[email protected]>
spi: qup: Don't skip cleanup in remove's error path

Randy Dunlap <[email protected]>
linux/vt_buffer.h: allow either builtin or modular for macros

Cristian Ciocaltea <[email protected]>
ASoC: es8316: Handle optional IRQ assignment

H. Nikolaus Schaller <[email protected]>
PCI: imx6: Install the fault handler only on compatible match

Daniel Baluta <[email protected]>
ASoC: soc-compress: Inherit atomicity from DAI link for Compress FE

Zheng Wang <[email protected]>
usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition

Fabio M. De Francesco <[email protected]>
module/decompress: Never use kunmap() for local un-mappings

Kunihiko Hayashi <[email protected]>
spi: f_ospi: Add missing spi_mem_default_supports_op() helper

Dmitry Baryshkov <[email protected]>
interconnect: qcom: osm-l3: drop unuserd header inclusion

Dmitry Baryshkov <[email protected]>
interconnect: qcom: drop obsolete OSM_L3/EPSS defines

Uwe Kleine-König <[email protected]>
spi: imx: Don't skip cleanup in remove's error path

Uwe Kleine-König <[email protected]>
spi: atmel-quadspi: Free resources even if runtime resume failed in .remove()

Uwe Kleine-König <[email protected]>
spi: atmel-quadspi: Don't leak clk enable count in pm resume

Doug Berger <[email protected]>
serial: 8250_bcm7271: Fix arbitration handling

Krzysztof Kozlowski <[email protected]>
iio: light: max44009: add missing OF device matching

Jason Gunthorpe <[email protected]>
iommufd/selftest: Catch overflow of uptr and length

Marco Pagani <[email protected]>
fpga: bridge: fix kernel-doc parameter description

Marek Vasut <[email protected]>
serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted

Prashanth K <[email protected]>
usb: dwc3: gadget: Change condition for processing suspend event

Wolfram Sang <[email protected]>
usb: host: xhci-rcar: remove leftover quirk handling

John Stultz <[email protected]>
pstore: Revert pmsg_lock back to a normal mutex

Hans de Goede <[email protected]>
drivers: staging: rtl8723bs: Fix locking in rtw_scan_timeout_handler()

Hans de Goede <[email protected]>
drivers: staging: rtl8723bs: Fix locking in _rtw_join_timeout_handler()

Lucas Tanure <[email protected]>
ASoC: cs35l41: Only disable internal boost

Randy Dunlap <[email protected]>
ipmi: ASPEED_BT_IPMI_BMC: select REGMAP_MMIO instead of depending on it

Kuniyuki Iwashima <[email protected]>
tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.

Gencen Gan <[email protected]>
net: amd: Fix link leak when verifying config failed

Kuniyuki Iwashima <[email protected]>
netlink: Use copy_to_user() for optval in netlink_getsockopt().

Liu Jian <[email protected]>
Revert "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"

Marc Dionne <[email protected]>
rxrpc: Fix error when reading rxrpc tokens

Ziyang Xuan <[email protected]>
ipv4: Fix potential uninit variable access bug in __ip_make_skb()

Davide Caratti <[email protected]>
net/sched: sch_fq: fix integer overflow of "credit"

Dan Carpenter <[email protected]>
net: dpaa: Fix uninitialized variable in dpaa_stop()

Florian Westphal <[email protected]>
netfilter: nf_tables: don't write table validation state without mutex

Stanislav Fomichev <[email protected]>
bpf: Don't EFAULT for getsockopt with optval=NULL

Alexei Starovoitov <[email protected]>
bpf: Fix race between btf_put and btf_idr walk.

Yan Wang <[email protected]>
net: stmmac:fix system hang when setting up tag_8021q VLAN for DSA ports

Vlad Buslov <[email protected]>
Revert "net/mlx5e: Don't use termination table when redundant"

Aya Levin <[email protected]>
net/mlx5e: Nullify table pointer when failing to create

Moshe Shemesh <[email protected]>
net/mlx5: Use recovery timeout on sync reset flow

Moshe Shemesh <[email protected]>
Revert "net/mlx5: Remove "recovery" arg from mlx5_load_one() function"

Jiri Pirko <[email protected]>
net/mlx5: Suspend auxiliary devices only in case of PCI device suspend

Jiri Pirko <[email protected]>
net/mlx5: Remove "recovery" arg from mlx5_load_one() function

Roi Dayan <[email protected]>
net/mlx5e: Fix error flow in representor failing to add vport rx rule

Chris Mi <[email protected]>
net/mlx5: E-switch, Don't destroy indirect table in split rule

Chris Mi <[email protected]>
net/mlx5: E-switch, Create per vport table based on devlink encap mode

Vlad Buslov <[email protected]>
net/mlx5e: Don't clone flow post action attributes second time

Joe Damato <[email protected]>
ixgbe: Enable setting RSS table to default values

Joe Damato <[email protected]>
ixgbe: Allow flow hash to be set via ethtool

Johannes Berg <[email protected]>
wifi: iwlwifi: fw: fix memory leak in debugfs

Tzung-Bi Shih <[email protected]>

    netfilter: conntrack: fix wrong ct->timeout value

Ryder Lee <[email protected]>
wifi: mt76: mt7996: fill txd by host driver

Lorenzo Bianconi <[email protected]>
wifi: mt76: mt7996: rely on mt76_connac_txp_common structure

Pablo Neira Ayuso <[email protected]>
netfilter: conntrack: restore IPS_CONFIRMED out of nf_conntrack_hash_check_insert()

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: check firmware response size

Ryder Lee <[email protected]>
wifi: mt76: connac: fix txd multicast rate setting

Quan Zhou <[email protected]>
wifi: mt76: mt7921e: stop chip reset worker in unregister hook

Quan Zhou <[email protected]>
wifi: mt76: mt7921e: improve reliability of dma reset

Jiefeng Li <[email protected]>

    wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe`

Sean Wang <[email protected]>
mt76: mt7921: fix kernel panic by accessing unallocated eeprom.data

Ming Yen Hsieh <[email protected]>
wifi: mt76: fix 6GHz high channel not be scanned

Quan Zhou <[email protected]>
wifi: mt76: mt7921e: fix probe timeout after reboot

Deren Wu <[email protected]>
wifi: mt76: add flexible polling wait-interval support

StanleyYP Wang <[email protected]>
wifi: mt76: mt7996: fix eeprom tx path bitfields

Peter Chiu <[email protected]>
wifi: mt76: mt7996: fix pointer calculation in ie countdown event

Shayne Chen <[email protected]>
wifi: mt76: mt7996: let non-bufferable MMPDUs use correct hw queue

Kang Chen <[email protected]>
wifi: mt76: handle failure of vzalloc in mt7615_coredump_work

Howard Hsu <[email protected]>

    wifi: mt76: mt7915: rework init flow in mt7915_thermal_init()

Howard Hsu <[email protected]>
wifi: mt76: mt7915: add error message in mt7915_thermal_set_cur_throttle_state()

Lorenz Brun <[email protected]>
wifi: mt76: mt7915: expose device tree match table

Ryder Lee <[email protected]>
wifi: mt76: mt7996: fix radiotap bitfield

Dan Carpenter <[email protected]>

    wifi: mt76: mt7915: unlock on error in mt7915_thermal_temp_store()

Deren Wu <[email protected]>
wifi: mt76: mt7921: fix PCI DMA hang after reboot

Deren Wu <[email protected]>
wifi: mt76: mt7921: fix wrong command to set STA channel

Deren Wu <[email protected]>
wifi: mt76: remove redundent MCU_UNI_CMD_* definitions

Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: make the loop for card preparation effective

Pavel Begunkov <[email protected]>
io_uring/rsrc: use nospec'ed indexes

Jan Kara <[email protected]>
jdb2: Don't refuse invalidation of already invalidated buffers

Tom Rix <[email protected]>
wifi: iwlwifi: fw: move memset before early return

Tom Rix <[email protected]>
wifi: iwlwifi: mvm: initialize seq variable

Daniel Gabay <[email protected]>
wifi: iwlwifi: yoyo: Fix possible division by zero

Daniel Gabay <[email protected]>
wifi: iwlwifi: yoyo: skip dump correctly on hw error

Ayala Beker <[email protected]>
wifi: iwlwifi: mvm: don't drop unencrypted MCAST frames

Yu Kuai <[email protected]>
md/raid10: don't call bio_start_io_acct twice for bio which experienced read error

Yu Kuai <[email protected]>
md/raid10: fix memleak of md thread

Yu Kuai <[email protected]>

    md/raid10: fix memleak for 'conf->bio_split'

Yu Kuai <[email protected]>

    md/raid10: fix leak of 'r10bio->remaining' for recovery

Li Nan <[email protected]>
md/raid10: fix task hung in raid10d

Chao Yu <[email protected]>
f2fs: fix to check return value of inc_valid_block_count()

Chao Yu <[email protected]>
f2fs: fix to check return value of f2fs_do_truncate_blocks()

Daniel Borkmann <[email protected]>
bpf, sockmap: Revert buggy deadlock fix in the sockhash and sockmap

Avraham Stern <[email protected]>
wifi: iwlwifi: mvm: don't set CHECKSUM_COMPLETE for unsupported protocols

Avraham Stern <[email protected]>
wifi: iwlwifi: trans: don't trigger d3 interrupt twice

Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: fix A-MSDU checks

Johannes Berg <[email protected]>
wifi: iwlwifi: debug: fix crash in __iwl_err()

Christoph Hellwig <[email protected]>
blk-mq: don't plug for head insertions in blk_execute_rq_nowait

Song Liu <[email protected]>
selftests/bpf: Fix leaked bpf_link in get_stackid_cannot_attach

Song Liu <[email protected]>
selftests/bpf: Use read_perf_max_sample_freq() in perf_event_stackmap

Ming Lei <[email protected]>

    nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage"

Keith Busch <[email protected]>
nvme: fix async event trace event

Damien Le Moal <[email protected]>
nvmet: fix I/O Command Set specific Identify Controller

Damien Le Moal <[email protected]>
nvmet: fix Identify Active Namespace ID list handling

Damien Le Moal <[email protected]>
nvmet: fix Identify Controller handling

Damien Le Moal <[email protected]>
nvmet: fix Identify Namespace handling

Damien Le Moal <[email protected]>
nvmet: fix error handling in nvmet_execute_identify_cns_cs_ns()

Xin Liu <[email protected]>
bpf, sockmap: fix deadlocks in the sockhash and sockmap

P Praneesh <[email protected]>
wifi: ath11k: fix writing to unintended memory region

Sebastian Reichel <[email protected]>
net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling

Sebastian Reichel <[email protected]>
net: ethernet: stmmac: dwmac-rk: rework optional clock handling

Shuchang Li <[email protected]>
scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()

Feng Zhou <[email protected]>
bpf/btf: Fix is_int_ptr()

Gregory Greenman <[email protected]>
wifi: iwlwifi: fix duplicate entry in iwl_dev_info_table

Chao Yu <[email protected]>
f2fs: fix to avoid use-after-free for cached IPU bio

Kal Conley <[email protected]>
xsk: Fix unaligned descriptor validation

Herbert Xu <[email protected]>
crypto: drbg - Only fail when jent is unavailable in FIPS mode

Quentin Monnet <[email protected]>
bpftool: Fix bug for long instructions in program CFG dumps

YiFei Zhu <[email protected]>
selftests/bpf: Wait for receive in cg_storage_multi test

Kal Conley <[email protected]>
selftests: xsk: Deflakify STATS_RX_DROPPED test

Kal Conley <[email protected]>
selftests: xsk: Disable IPv6 on VETH1

Kal Conley <[email protected]>
selftests: xsk: Use correct UMEM size in testapp_invalid_desc

Simon Horman <[email protected]>
net: qrtr: correct types of trace event parameters

Qilin Tan <[email protected]>
f2fs: fix iostat lock protection

Dave Marchevsky <[email protected]>
bpf: Fix struct_meta lookup for bpf_obj_free_fields kfunc call

Andrii Nakryiko <[email protected]>
bpf: factor out fetching basic kfunc metadata

Dave Marchevsky <[email protected]>
bpf: Add callback validation to kfunc verifier logic

Dave Marchevsky <[email protected]>
bpf: Add support for bpf_rb_root and bpf_rb_node in kfunc args

Dave Marchevsky <[email protected]>
bpf: Add bpf_rbtree_{add,remove,first} kfuncs

Dave Marchevsky <[email protected]>
bpf: Add basic bpf_rb_{root,node} support

Dave Marchevsky <[email protected]>
bpf: Migrate release_on_unlock logic to non-owning ref semantics

David Vernet <[email protected]>
bpf: Add __bpf_kfunc tag for marking kernel functions as kfuncs

Dave Marchevsky <[email protected]>

    bpf: rename list_head -> graph_root in field info types

Armin Wolf <[email protected]>
wifi: rt2x00: Fix memory leak when handling surveys

Xingui Yang <[email protected]>
scsi: hisi_sas: Handle NCQ error when IPTT is valid

Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()

Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()

Suman Anna <[email protected]>
crypto: sa2ul - Select CRYPTO_DES

Christophe JAILLET <[email protected]>
crypto: caam - Clear some memory in instantiate_rng

Jaegeuk Kim <[email protected]>
f2fs: fix scheduling while atomic in decompression path

Yangtao Li <[email protected]>
f2fs: compress: fix to call f2fs_wait_on_page_writeback() in f2fs_write_raw_pages()

Jaegeuk Kim <[email protected]>
f2fs: apply zone capacity to all zone type

Yonggil Song <[email protected]>
f2fs: fix uninitialized skipped_gc_rwsem

Yangtao Li <[email protected]>
f2fs: handle dqget error in f2fs_transfer_project_quota()

Sean Anderson <[email protected]>
net: sunhme: Fix uninitialized return code

Danila Chernetsov <[email protected]>
scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS

Mike Christie <[email protected]>
scsi: target: iscsit: Fix TAS handling during conn cleanup

Mike Christie <[email protected]>
scsi: target: Fix multiple LUN_RESET handling

Mike Christie <[email protected]>
scsi: target: iscsit: Stop/wait on cmds during conn close

Mike Christie <[email protected]>
scsi: target: iscsit: isert: Alloc per conn cmd counter

Mike Christie <[email protected]>
scsi: target: Pass in cmd counter to use during cmd setup

Mike Christie <[email protected]>
scsi: target: Move cmd counter allocation

Mike Christie <[email protected]>
scsi: target: Move sess cmd counter to new struct

Daniel Borkmann <[email protected]>

    bpf: Fix __reg_bound_offset 64->32 var_off subreg propagation

JP Kobryn <[email protected]>
bpf: return long from bpf_map_ops funcs

Madhu Koriginja <[email protected]>
netfilter: keep conntrack reference until IPsecv6 policy checks are done

Russell King (Oracle) <[email protected]>
net: dsa: qca8k: remove assignment of an_enabled in pcs_get_state()

Alexei Starovoitov <[email protected]>
libbpf: Fix ld_imm64 copy logic for ksym in light skeleton.

Eric Dumazet <[email protected]>

    net/packet: convert po->auxdata to an atomic flag

Eric Dumazet <[email protected]>

    net/packet: convert po->origdev to an atomic flag

Eric Dumazet <[email protected]>

    net/packet: annotate accesses to po->xmit

Vadim Fedorenko <[email protected]>
vlan: partially enable SIOCSHWTSTAMP in container

Russell King (Oracle) <[email protected]>
net: pcs: xpcs: remove double-read of link state when using AN

Luis Gerhorst <[email protected]>
bpf: Remove misleading spec_v1 check on var-offset stack read

Martin KaFai Lau <[email protected]>
selftests/bpf: Fix a fd leak in an error path in network_helpers.c

Aditya Kumar Singh <[email protected]>
wifi: ath11k: fix deinitialization of firmware resources

Alexander Mikhalitsyn <[email protected]>
scm: fix MSG_CTRUNC setting condition for SO_PASSSEC

Shashank Gupta <[email protected]>
crypto: qat - fix concurrency issue when device state changes

Andrii Nakryiko <[email protected]>
bpf: fix precision propagation verbose logging

Andrii Nakryiko <[email protected]>
bpf: take into account liveness when propagating precision

Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()

Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()

Luis Gerhorst <[email protected]>
tools: bpftool: Remove invalid \' json escape

Fedor Pchelkin <[email protected]>
wifi: ath6kl: reduce WARN to dev_dbg() in callback

John Keeping <[email protected]>
wifi: brcmfmac: support CQM RSSI notification with older firmware

Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo

Christian Marangi <[email protected]>
wifi: ath11k: fix SAC bug on peer addition with sta band migration

Dan Carpenter <[email protected]>
wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()

Douglas Anderson <[email protected]>
wifi: ath5k: Use platform_get_irq() to get the interrupt

Douglas Anderson <[email protected]>
wifi: ath11k: Use platform_get_irq() to get the interrupt

Fedor Pchelkin <[email protected]>
wifi: ath9k: hif_usb: fix memory leak of remain_skbs

Alexey V. Vissarionov <[email protected]>
wifi: ath6kl: minor fix for allocation size

Liang He <[email protected]>
platform/chrome: cros_typec_switch: Add missing fwnode_handle_put()

Tomáš Pecka <[email protected]>
hwmon: (pmbus/fsp-3y) Fix functionality bitmask in FSP-3Y YM-2151E

Bjorn Andersson <[email protected]>
rpmsg: glink: Propagate TX failures in intentless mode as well

Sanjay Chandrashekara <[email protected]>
cpufreq: use correct unit when verify cur freq

Rafael J. Wysocki <[email protected]>
ACPI: bus: Ensure that notify handlers are not running after removal

Sebastian Andrzej Siewior <[email protected]>
tick/common: Align tick period with the HZ tick.

Ville Syrjälä <[email protected]>
drm/i915: Make intel_get_crtc_new_encoder() less oopsy

Thomas Gleixner <[email protected]>
debugobject: Prevent init race with static objects

Yunfei Dong <[email protected]>
media: mediatek: vcodec: add remove function for decoder platform driver

Yunfei Dong <[email protected]>
media: mediatek: vcodec: fix decoder disable pm crash

Robin Murphy <[email protected]>
perf/arm-cmn: Fix port detection for CMN-700

Sumit Garg <[email protected]>
arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step

Saurabh Sengar <[email protected]>
x86/ioapic: Don't return 0 from arch_dynirq_lower_bound()

YAN SHI <[email protected]>
regulator: stm32-pwr: fix of_iomap leak

Javier Martinez Canillas <[email protected]>
media: venus: dec: Fix capture formats enumeration order

Michał Krawczyk <[email protected]>
media: venus: dec: Fix handling of the start cmd

Florian Fainelli <[email protected]>
media: rc: gpio-ir-recv: Fix support for wake-up

Igor Artemiev <[email protected]>
drm/amd/display: Fix potential null dereference

Wei Chen <[email protected]>
media: hi846: Fix memleak in hi846_init_controls()

Sakari Ailus <[email protected]>
media: v4l: async: Return async sub-devices to subnotifier list

Miaoqian Lin <[email protected]>
media: rcar_fdp1: Fix refcount leak in probe and remove function

Uwe Kleine-König <[email protected]>
media: rcar_fdp1: Convert to platform remove callback returning void

Uwe Kleine-König <[email protected]>
platform: Provide a remove callback that returns no value

Laurent Pinchart <[email protected]>
media: vsp1: Replace vb2_is_streaming() with vb2_start_streaming_called()

Moudy Ho <[email protected]>
media: platform: mtk-mdp3: fix potential frame size overflow in mdp_try_fmt_mplane()

Zheng Wang <[email protected]>
media: saa7134: fix use after free bug in saa7134_finidev due to race condition

Zheng Wang <[email protected]>
media: dm1105: Fix use after free bug in dm1105_remove due to race condition

Shyam Sundar S K <[email protected]>
platform/x86/amd: pmc: Move out of BIOS SMN pair for STB init

Shyam Sundar S K <[email protected]>
platform/x86/amd: pmc: Utilize SMN index 0 for driver probe

Mario Limonciello <[email protected]>
platform/x86/amd: pmc: Move idlemask check into amd_pmc_idlemask_read

Mario Limonciello <[email protected]>
platform/x86/amd: pmc: Don't dump data after resume from s0i3 on picasso

Mario Limonciello <[email protected]>
platform/x86/amd: pmc: Hide SMU version and program attributes for Picasso

Mario Limonciello <[email protected]>
platform/x86/amd: pmc: Don't try to read SMU version on Picasso

Shyam Sundar S K <[email protected]>
platform/x86/amd/pmf: Move out of BIOS SMN pair for driver probe

Zheng Wang <[email protected]>
media: rkvdec: fix use after free bug in rkvdec_remove

Zheng Wang <[email protected]>
media: cedrus: fix use after free bug in cedrus_remove due to race condition

Yunfei Dong <[email protected]>
media: mediatek: vcodec: change lat thread decode error condition

Yunfei Dong <[email protected]>
media: mediatek: vcodec: making sure queue_work successfully

Yunfei Dong <[email protected]>
media: mediatek: vcodec: remove unused lat_buf

Yunfei Dong <[email protected]>
media: mediatek: vcodec: add core decode done event

Yunfei Dong <[email protected]>
media: mediatek: vcodec: move lat_buf to the top of core list

Yunfei Dong <[email protected]>
media: mediatek: vcodec: using each instance lat_buf count replace core ready list

Yunfei Dong <[email protected]>
media: mediatek: vcodec: add params to record lat and core lat_buf count

Yunfei Dong <[email protected]>
media: mediatek: vcodec: Force capture queue format to MM21

Yunfei Dong <[email protected]>
media: mediatek: vcodec: Make MM21 the default capture format

Pin-yen Lin <[email protected]>
media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder

kyrie wu <[email protected]>
media: mtk-jpeg: Fixes jpeg enc&dec worker sw flow

kyrie wu <[email protected]>
media: mtk-jpeg: Fixes jpeghw multi-core judgement

Douglas Anderson <[email protected]>
arm64: dts: sdm845: Rename qspi data12 as data23

Douglas Anderson <[email protected]>

    arm64: dts: sc7280: Rename qspi data12 as data23

Douglas Anderson <[email protected]>

    arm64: dts: sc7180: Rename qspi data12 as data23

Petr Vorel <[email protected]>
arm64: dts: qcom: msm8994-angler: removed clash with smem_region

Petr Vorel <[email protected]>
arm64: dts: qcom: msm8994-angler: Fix cont_splash_mem mapping

Tushar Nimkar <[email protected]>
soc: qcom: rpmh-rsc: Support RSC v3 minor versions

Uros Bizjak <[email protected]>
x86/apic: Fix atomic update of offset in reserve_eilvt_offset()

Douglas Anderson <[email protected]>
regulator: core: Avoid lockdep reports when resolving supplies

Douglas Anderson <[email protected]>
regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()

Thomas Hellström <[email protected]>
drm/ttm/pool: Fix ttm_pool_alloc error path

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: apq8096-db820c: drop unit address from PMI8994 regulator

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8994-msft-lumia-octagon: drop unit address from PMI8994 regulator

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8994-kitakami: drop unit address from PMI8994 regulator

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: msm8998-oneplus-cheeseburger: revert "fix backlight pin function"

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sc7180-trogdor-pazquel: correct trackpad supply

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sc7180-trogdor-lazor: correct trackpad supply

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sc7280-herobrine-villager: correct trackpad supply

Yang Yingliang <[email protected]>
gpu: host1x: Fix memory leak of device names

Yang Yingliang <[email protected]>
gpu: host1x: Fix potential double free if IOMMU is disabled

Li Yang <[email protected]>
soc: renesas: renesas-soc: Release 'chipid' from ioremap()

Zhaoyang Li <[email protected]>
soc: bcm: brcmstb: biuctrl: fix of_iomap leak

Conor Dooley <[email protected]>
mailbox: mpfs: switch to txdone_poll

Xinlei Lee <[email protected]>
drm/mediatek: dp: Change the aux retries times when receiving AUX_DEFER

Harshit Mogalapalli <[email protected]>
drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()

Jean-Philippe Brucker <[email protected]>
ACPI: VIOT: Initialize the correct IOMMU fwspec

AngeloGioacchino Del Regno <[email protected]>
arm64: dts: mediatek: mt8192-asurada: Fix voltage constraint for Vgpu

Bjorn Andersson <[email protected]>
cpufreq: qcom-cpufreq-hw: Revert adding cpufreq qos

AngeloGioacchino Del Regno <[email protected]>
cpufreq: mediatek: Raise proc and sram max voltage for MT7622/7623

Jia-Wei Chang <[email protected]>
cpufreq: mediatek: raise proc/sram max voltage for MT8516

Jia-Wei Chang <[email protected]>
cpufreq: mediatek: fix KP caused by handler usage after regulator_put/clk_put

Jia-Wei Chang <[email protected]>
cpufreq: mediatek: fix passing zero to 'PTR_ERR'

Janne Grunau <[email protected]>
arm64: dts: apple: t8103: Disable unused PCIe ports

Alexandre Torgue <[email protected]>
ARM: dts: stm32: fix spi1 pin assignment on stm32mp15

Jiucheng Xu <[email protected]>
perf/amlogic: Fix config1/config2 parsing issue

Ilkka Koskinen <[email protected]>
perf/arm-cmn: Move overlapping wp_combine field

Cristian Marussi <[email protected]>
firmware: arm_scmi: Fix xfers allocation on Rx channel

H. Nikolaus Schaller <[email protected]>
ARM: dts: gta04: fix excess dma channel usage

Dan Carpenter <[email protected]>
drm: rcar-du: Fix a NULL vs IS_ERR() bug

Neil Armstrong <[email protected]>
arm64: dts: qcom: sm8450: fix pcie1 gpios properties name

Georgii Kruglov <[email protected]>
mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data

Roger Pau Monne <[email protected]>
ACPI: processor: Fix evaluating _PDC method when running as Xen dom0

Lee Jones <[email protected]>
drm/amd/display/dc/dce60/Makefile: Fix previous attempt to silence known override-init warnings

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8350-microsoft-surface: fix USB dual-role mode property

Dionna Glaze <[email protected]>
virt/coco/sev-guest: Double-buffer messages

Adam Skladowski <[email protected]>
drm: msm: adreno: Disable preemption on Adreno 510

Johan Hovold <[email protected]>
drm/msm/adreno: drop bogus pm_runtime_set_active()

Vignesh Raghavendra <[email protected]>

    arm64: dts: ti: k3-am62a7: Correct L2 cache size to 512KB

Vignesh Raghavendra <[email protected]>

    arm64: dts: ti: k3-am625: Correct L2 cache size to 512KB

Bagas Sanjaya <[email protected]>
accel: Link to compute accelerator subsystem intro

Laurent Pinchart <[email protected]>
media: max9286: Free control handler

Adam Ford <[email protected]>

    drm/bridge: adv7533: Fix adv7533_mode_valid for adv7533 and adv7535

Mukesh Ojha <[email protected]>
firmware: qcom_scm: Clear download bit during reboot

Dan Carpenter <[email protected]>
media: av7110: prevent underflow in write_ts_to_decoder()

Ming Qian <[email protected]>
media: amphion: decoder implement display delay enable

Jiasheng Jiang <[email protected]>
media: platform: mtk-mdp3: Add missing check and free for ida_alloc

Jiasheng Jiang <[email protected]>
media: bdisp: Add missing check for create_workqueue

Muralidhara M K <[email protected]>
x86/MCE/AMD: Use an u64 for bank_map

Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: sdx55: Fix the unit address of PCIe EP node

Adam Skladowski <[email protected]>
arm64: dts: qcom: msm8976: Add and provide xo clk to rpmcc

Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq8064: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq4019: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sm8450: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sm8150: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>

    arm64: dts: qcom: sc8280xp: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sm8250: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: msm8996: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: ipq6018: Fix the PCI I/O port range

Konrad Dybcio <[email protected]>
arm64: dts: qcom: ipq6018: Add/remove some newlines

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: ipq8074: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sc7280: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: msm8998: Fix the PCI I/O port range

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sdm845: Fix the PCI I/O port range

Vincent Guittot <[email protected]>
arm64: dts: qcom: sdm845: correct dynamic power coefficients

Krzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sc7280: fix EUD port properties

Konrad Dybcio <[email protected]>
arm64: dts: qcom: msm8998: Fix stm-stimulus-base reg name

Rafał Miłecki <[email protected]>
arm64: dts: broadcom: bcmbca: bcm4908: fix procmon nodename

Rafał Miłecki <[email protected]>
arm64: dts: broadcom: bcmbca: bcm4908: fix LED nodenames

Rafał Miłecki <[email protected]>
arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name

Bhavya Kapoor <[email protected]>
arm64: dts: ti: k3-j721e-main: Remove ti,strobe-sel property

Devarsh Thakkar <[email protected]>
arm64: dts: ti: k3-am62a7-sk: Fix DDR size to full 4GB

Nitin Yadav <[email protected]>
arm64: dts: ti: k3-am62-main: Fix GPIO numbers in DT

Douglas Anderson <[email protected]>
regulator: core: Shorten off-on-delay-us for always-on/boot-on by time since booted

Konrad Dybcio <[email protected]>
ARM: dts: qcom-apq8064: Fix opp table child name

Qiuxu Zhuo <[email protected]>
EDAC/skx: Fix overflows on the DRAM row address mapping arrays

Vinod Polimera <[email protected]>
drm/msm/disp/dpu: check for crtc enable rather than crtc active to release shared resources

Chen-Yu Tsai <[email protected]>
drm/mediatek: dp: Only trigger DRM HPD events if bridge is attached

Lad Prabhakar <[email protected]>
arm64: dts: renesas: r9a07g043: Update IRQ numbers for SSI channels

Lad Prabhakar <[email protected]>
arm64: dts: renesas: r9a07g054: Update IRQ numbers for SSI channels

Lad Prabhakar <[email protected]>
arm64: dts: renesas: r9a07g044: Update IRQ numbers for SSI channels

Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table

Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table

Miaoqian Lin <[email protected]>
soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe

Nicolas Frayer <[email protected]>
soc: ti: k3-ringacc: Add try_module_get() to k3_dmaring_request_dual_ring()

Terry Bowman <[email protected]>

    tools/x86/kcpuid: Fix avx512bw and avx512lvl fields in Fn00000007

Orlando Chamberlain <[email protected]>
drm/amdgpu: register a vga_switcheroo client for MacBooks with apple-gmux

Dom Cobley <[email protected]>
drm/probe-helper: Cancel previous job before starting new one

Maíra Canal <[email protected]>
drm/vgem: add missing mutex_destroy

Matt Roper <[email protected]>
drm/i915/dg2: Drop one PCI ID

Rob Clark <[email protected]>
drm/rockchip: Drop unbalanced obj unref

Jingbo Xu <[email protected]>
erofs: fix potential overflow calculating xattr_isize

Jingbo Xu <[email protected]>
erofs: initialize packed inode after root inode is assigned

Gao Xiang <[email protected]>
erofs: stop parsing non-compact HEAD index if clusterofs is invalid

Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality when interrupts are reenabled on resume

Lino Sanfilippo <[email protected]>
tpm, tpm: Implement usage counter for locality

Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality before writing interrupt registers

Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed

Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register

Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Do not skip reset of original interrupt vector

Paul Moore <[email protected]>
selinux: ensure av_permissions.h is built when needed

Ondrej Mosnacek <[email protected]>
selinux: fix Makefile dependencies of flask.h

Ilpo Järvinen <[email protected]>
selftests/resctrl: Check for return value after write_schemata()

Ilpo Järvinen <[email protected]>

    selftests/resctrl: Allow ->setup() to return errors

Ilpo Järvinen <[email protected]>

    selftests/resctrl: Move ->setup() call outside of test specific branches

Ilpo Järvinen <[email protected]>
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem

Zqiang <[email protected]>
rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check

Rae Moar <[email protected]>
kunit: fix bug in the order of lines in debugfs logs

Krzysztof Kozlowski <[email protected]>
ASoC: dt-bindings: qcom,lpass-rx-macro: correct minItems for clocks

Jeffrey Hugo <[email protected]>
bus: mhi: host: Range check CHDBOFF and ERDBOFF

Jeffrey Hugo <[email protected]>
bus: mhi: host: Use mhi_tryset_pm_state() for setting fw error state

Jeffrey Hugo <[email protected]>
bus: mhi: host: Remove duplicate ee check for syserr

Dan Williams <[email protected]>
cxl/hdm: Fail upon detecting 0-sized decoders

Dave Chinner <[email protected]>
xfs: don't consider future format versions valid

Alexander Aring <[email protected]>
fs: dlm: fix DLM_IFL_CB_PENDING gets overwritten

Xiubo Li <[email protected]>
ceph: fix potential use-after-free bug when trimming caps

Mårten Lindahl <[email protected]>
ubifs: Fix memory leak in do_rename

Mårten Lindahl <[email protected]>
ubifs: Free memory for tmpfile name

Wang YanQing <[email protected]>
ubi: Fix return value overwrite issue in try_write_vid_and_data()

Zhihao Cheng <[email protected]>
ubifs: Fix memleak when insert_old_idx() failed

Zhihao Cheng <[email protected]>
Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"

Andrew Jones <[email protected]>
RISC-V: Align SBI probe implementation with spec

Kishon Vijay Abraham I <[email protected]>
iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE

Tim Huang <[email protected]>
drm/amd/pm: re-enable the gfx imu when smu resume

Ondrej Mosnacek <[email protected]>
tracing: Fix permissions for the buffer_percent file

Song Shuai <[email protected]>
riscv: mm: remove redundant parameter of create_fdt_early_page_table

Reid Tonking <[email protected]>
i2c: omap: Fix standard mode false ACK readings

Hans de Goede <[email protected]>
ACPI: video: Remove acpi_backlight=video quirk for Lenovo ThinkPad W530

Namjae Jeon <[email protected]>
ksmbd: fix deadlock in ksmbd_find_crypto_ctx()

Namjae Jeon <[email protected]>
ksmbd: not allow guest user on multichannel

Namjae Jeon <[email protected]>
ksmbd: fix memleak in session setup

Namjae Jeon <[email protected]>
ksmbd: fix NULL pointer dereference in smb2_get_info_filesystem()

Namjae Jeon <[email protected]>
ksmbd: call rcu_barrier() in ksmbd_server_exit()

Namjae Jeon <[email protected]>
ksmbd: fix racy issue under cocurrent smb2 tree disconnect

David Matlack <[email protected]>
KVM: RISC-V: Retry fault if vma_lookup() results become invalid

Alex Hung <[email protected]>
drm/amd/display: fix a divided-by-zero error

Hamza Mahfooz <[email protected]>
drm/amd/display: fix PSR-SU/DSC interoperability support

Daniel Miess <[email protected]>
drm/amd/display: limit timing for single dimm memory

Nasir Osman <[email protected]>
drm/amd/display: Remove stutter only configurations

Zhang Zhengming <[email protected]>
relayfs: fix out-of-bounds access in relay_file_read

Oliver Upton <[email protected]>
KVM: arm64: vgic: Don't acquire its_lock before config_lock

Oliver Upton <[email protected]>
KVM: arm64: Use config_lock to protect vgic state

Oliver Upton <[email protected]>
KVM: arm64: Use config_lock to protect data ordered against KVM_RUN

Oliver Upton <[email protected]>
KVM: arm64: Avoid lock inversion when setting the VM register width

Oliver Upton <[email protected]>

    KVM: arm64: Avoid vcpu->mutex v. kvm->lock inversion in CPU_ON

Sean Christopherson <[email protected]>
KVM: nVMX: Emulate NOPs in L2, and PAUSE if it's not intercepted

Sean Christopherson <[email protected]>
KVM: x86/pmu: Disallow legacy LBRs if architectural LBRs are available

Krzysztof Kozlowski <[email protected]>
cpufreq: qcom-cpufreq-hw: fix double IO unmap and resource release on exit

Roberto Sassu <[email protected]>
reiserfs: Add security prefix to xattr name in reiserfs_security_write()

Zheng Yejian <[email protected]>
rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed

Mario Limonciello <[email protected]>

    crypto: ccp - Don't initialize CCP for PSP 0x1649

Eric Biggers <[email protected]>
crypto: testmgr - fix RNG performance in fuzz tests

Eric Biggers <[email protected]>
crypto: arm64/aes-neonbs - fix crash with CFI enabled

Jonathan McDowell <[email protected]>
crypto: safexcel - Cleanup ring IRQ workqueues on load failure

Toke Høiland-Jørgensen <[email protected]>
crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()

Johannes Berg <[email protected]>
ring-buffer: Sync IRQ works before buffer destruction

Tze-nan Wu <[email protected]>
ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset_online_cpus

Krzysztof Kozlowski <[email protected]>
pinctrl: qcom: lpass-lpi: set output value before enabling output

Krzysztof Kozlowski <[email protected]>
soundwire: qcom: correct setting ignore bit on v1.5.1

Heiner Kallweit <[email protected]>
pwm: meson: Fix g12a ao clk81 name

Heiner Kallweit <[email protected]>
pwm: meson: Fix axg ao mux parents

Eric Huang <[email protected]>
wifi: rtw89: correct 5 MHz mask setting

Felix Fietkau <[email protected]>
wifi: mt76: add missing locking to protect against concurrent rx/status calls

Kees Cook <[email protected]>
kheaders: Use array declaration instead of char

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition for stx104_write_raw()

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition when converting analog-to-digital

Zhang Yuchen <[email protected]>
ipmi: fix SSIF not responding under certain cond.

Corey Minyard <[email protected]>
ipmi:ssif: Add send_retries increment

Jiaxun Yang <[email protected]>
MIPS: fw: Allow firmware to pass a empty env

Kefeng Wang <[email protected]>
fs: fix sysctls.c built

Joel Fernandes (Google) <[email protected]>
tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem

Jan Kundrát <[email protected]>

    serial: max310x: fix IO data corruption in batched operations

Ilpo Järvinen <[email protected]>
serial: 8250: Fix serial8250_tx_empty() race with DMA Tx

Johan Hovold <[email protected]>
serial: fix TIOCSRS485 locking

Johan Hovold <[email protected]>
xhci: fix debugfs register accesses while suspended

Ilpo Järvinen <[email protected]>
tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH

Nuno Sá <[email protected]>
staging: iio: resolver: ads1210: fix config mode

Eric Biggers <[email protected]>
blk-crypto: make blk_crypto_evict_key() more robust

Eric Biggers <[email protected]>
blk-crypto: make blk_crypto_evict_key() return void

Eric Biggers <[email protected]>
blk-mq: release crypto keyslot before reporting I/O complete

Chengming Zhou <[email protected]>
blk-stat: fix QUEUE_FLAG_STATS clear

Martin Krastev <[email protected]>
drm/vmwgfx: Fix Legacy Display Unit atomic drm support

Ricardo Ribalda <[email protected]>
media: ov8856: Do not check for for module version

Thomas Gleixner <[email protected]>
posix-cpu-timers: Implement the missing timer_wait_running callback

Jarkko Sakkinen <[email protected]>
tpm: Add !tpm_amd_is_rng_defective() to the hwrng_unregister() call site

Chris Packham <[email protected]>
hwmon: (adt7475) Use device_property APIs when configuring polarity

Babu Moger <[email protected]>
hwmon: (k10temp) Check range scale when CUR_TEMP register is read-write

Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on unbind

Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on probe errors

Wesley Cheng <[email protected]>
usb: dwc3: gadget: Stall and restart EP0 if host is unresponsive

Badhri Jagan Sridharan <[email protected]>
usb: gadget: udc: core: Prevent redundant calls to pullup

Badhri Jagan Sridharan <[email protected]>
usb: gadget: udc: core: Invoke usb_gadget_connect only when started

Sascha Hauer <[email protected]>
wifi: rtw88: usb: fix priority queue to endpoint mapping

Randy Dunlap <[email protected]>
IMA: allow/fix UML builds

Dmitry Baryshkov <[email protected]>

    phy: qcom-qmp-pcie: sc8180x PCIe PHY has 2 lanes

Slark Xiao <[email protected]>
bus: mhi: host: pci_generic: Revert "Add a secondary AT port to Telit FN990"

Manivannan Sadhasivam <[email protected]>
PCI: qcom: Fix the incorrect register usage in v2.7.0 config

Lukas Wunner <[email protected]>
PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock

Josh Triplett <[email protected]>
PCI: kirin: Select REGMAP_MMIO

Nicholas Piggin <[email protected]>
powerpc/boot: Fix boot wrapper code generation with CONFIG_POWER10_CPU

Ard Biesheuvel <[email protected]>
arm64: Stash shadow stack pointer in the task struct on interrupt

Ard Biesheuvel <[email protected]>
arm64: Always load shadow stack pointer directly from the task struct

Syed Saba Kareem <[email protected]>
ASoC: amd: ps: update the acp clock source.

Mario Limonciello <[email protected]>
wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset

Tony Luck <[email protected]>
x86/cpu: Add model number for Intel Arrow Lake processor

Vladimir Oltean <[email protected]>
asm-generic/io.h: suppress endianness warnings for relaxed accessors

Vladimir Oltean <[email protected]>
asm-generic/io.h: suppress endianness warnings for readq() and writeq()

Steven Rostedt (Google) <[email protected]>
tracing: Error if a trace event has an array for a __field()

Kalle Valo <[email protected]>
wifi: ath11k: reduce the MHI timeout to 20s

Benjamin Asbach <[email protected]>
platform/x86: thinkpad_acpi: Add missing T14s Gen1 type to s2idle quirk list

Daniel Golle <[email protected]>
net: sfp: add quirk enabling 2500Base-x for HG MXPD-483II

Ranjan Kumar <[email protected]>

    scsi: mpi3mr: Handle soft reset in progress fault code (0xF002)

Anh Tuan Phan <[email protected]>
selftests mount: Fix mount_setattr_test builds failed

Ben Greear <[email protected]>
wifi: mt76: mt7921: Fix use-after-free in fw features query.

Jiri Slaby (SUSE) <[email protected]>
net: wwan: t7xx: do not compile with -Werror

Duy Nguyen <[email protected]>
ASoC: da7213.c: add missing pm_runtime_disable()

Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750

Patrik Dahlström <[email protected]>
iio: adc: palmas_gpadc: fix NULL dereference on rmmod

Ge-org Brohammer <[email protected]>
ASoC: amd: yc: Add DMI entries to support Victus by HP Laptop 16-e1xxx (8A22)

Michael Kelley <[email protected]>
x86/hyperv: Block root partition functionality in a Confidential VM

Shengjiu Wang <[email protected]>

    ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm

Eugene Huang <[email protected]>
ASoC: Intel: soc-acpi: add table for Intel 'Rooks County' NUC M15

Eugene Huang <[email protected]>
ASOC: Intel: sof_sdw: add quirk for Intel 'Rooks County' NUC M15

-------------

Diffstat:

 .../bindings/sound/qcom,lpass-rx-macro.yaml        |    1 +
 Makefile                                           |    4 +-
 arch/arm/boot/dts/omap3-gta04.dtsi                 |   16 +
 arch/arm/boot/dts/qcom-apq8064.dtsi                |    2 +-
 arch/arm/boot/dts/qcom-ipq4019.dtsi                |    4 +-
 arch/arm/boot/dts/qcom-ipq8064.dtsi                |   12 +-
 arch/arm/boot/dts/qcom-sdx55.dtsi                  |   78 +-
 arch/arm/boot/dts/stm32mp15-pinctrl.dtsi           |   30 +-
 arch/arm64/boot/dts/apple/t8103-j274.dts           |   10 +
 arch/arm64/boot/dts/apple/t8103-j293.dts           |   15 -
 arch/arm64/boot/dts/apple/t8103-j313.dts           |   15 -
 arch/arm64/boot/dts/apple/t8103-j456.dts           |   10 +
 arch/arm64/boot/dts/apple/t8103-j457.dts           |   11 +-
 arch/arm64/boot/dts/apple/t8103.dtsi               |    4 +
 .../dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts |   10 +-
 arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi   |    4 +-
 arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi   |    2 +-
 arch/arm64/boot/dts/qcom/apq8096-db820c.dts        |    3 +-
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |   26 +-
 arch/arm64/boot/dts/qcom/ipq8074.dtsi              |   12 +-
 .../boot/dts/qcom/msm8956-sony-xperia-loire.dtsi   |    4 +
 arch/arm64/boot/dts/qcom/msm8976.dtsi              |    9 +
 arch/arm64/boot/dts/qcom/msm8992-lg-bullhead.dtsi  |    5 -
 .../dts/qcom/msm8994-huawei-angler-rev-101.dts     |   11 +-
 .../boot/dts/qcom/msm8994-msft-lumia-octagon.dtsi  |    3 +-
 .../dts/qcom/msm8994-sony-xperia-kitakami.dtsi     |    3 +-
 arch/arm64/boot/dts/qcom/msm8994.dtsi              |    5 +
 arch/arm64/boot/dts/qcom/msm8996.dtsi              |   12 +-
 .../boot/dts/qcom/msm8998-oneplus-cheeseburger.dts |    2 +-
 arch/arm64/boot/dts/qcom/msm8998.dtsi              |    4 +-
 arch/arm64/boot/dts/qcom/pmi8994.dtsi              |    2 -
 .../qcom/sc7180-trogdor-lazor-limozeen-nots-r4.dts |    2 +-
 .../boot/dts/qcom/sc7180-trogdor-pazquel.dtsi      |    2 +-
 arch/arm64/boot/dts/qcom/sc7180.dtsi               |    2 +-
 .../boot/dts/qcom/sc7280-herobrine-villager.dtsi   |    2 +-
 arch/arm64/boot/dts/qcom/sc7280.dtsi               |   13 +-
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi             |   10 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi               |   16 +-
 arch/arm64/boot/dts/qcom/sm8150.dtsi               |    6 +-
 arch/arm64/boot/dts/qcom/sm8250.dtsi               |    8 +-
 .../dts/qcom/sm8350-microsoft-surface-duo2.dts     |    3 +
 arch/arm64/boot/dts/qcom/sm8450.dtsi               |   12 +-
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi          |    3 -
 arch/arm64/boot/dts/renesas/r8a77990.dtsi          |    3 -
 arch/arm64/boot/dts/renesas/r9a07g043.dtsi         |   19 +-
 arch/arm64/boot/dts/renesas/r9a07g044.dtsi         |   19 +-
 arch/arm64/boot/dts/renesas/r9a07g054.dtsi         |   19 +-
 arch/arm64/boot/dts/ti/k3-am62-main.dtsi           |    4 +-
 arch/arm64/boot/dts/ti/k3-am625.dtsi               |    2 +-
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts            |    5 +-
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi              |    2 +-
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi          |    1 -
 arch/arm64/crypto/aes-neonbs-core.S                |    9 +-
 arch/arm64/include/asm/debug-monitors.h            |    1 +
 arch/arm64/include/asm/kvm_host.h                  |    4 +
 arch/arm64/include/asm/scs.h                       |    7 +-
 arch/arm64/kernel/debug-monitors.c                 |    5 +
 arch/arm64/kernel/entry.S                          |   16 +-
 arch/arm64/kernel/head.S                           |    2 +-
 arch/arm64/kernel/kgdb.c                           |    2 +
 arch/arm64/kvm/arm.c                               |   53 +-
 arch/arm64/kvm/guest.c                             |    2 +
 arch/arm64/kvm/hypercalls.c                        |    4 +-
 arch/arm64/kvm/pmu-emul.c                          |   23 +-
 arch/arm64/kvm/psci.c                              |   28 +-
 arch/arm64/kvm/reset.c                             |   15 +-
 arch/arm64/kvm/vgic/vgic-debug.c                   |    8 +-
 arch/arm64/kvm/vgic/vgic-init.c                    |   36 +-
 arch/arm64/kvm/vgic/vgic-its.c                     |   33 +-
 arch/arm64/kvm/vgic/vgic-kvm-device.c              |   47 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                 |    4 +-
 arch/arm64/kvm/vgic/vgic-mmio.c                    |   12 +-
 arch/arm64/kvm/vgic/vgic-v4.c                      |   11 +-
 arch/arm64/kvm/vgic/vgic.c                         |   12 +-
 arch/ia64/kernel/salinfo.c                         |    2 +-
 arch/ia64/mm/contig.c                              |    2 +-
 arch/ia64/mm/hugetlbpage.c                         |    2 +-
 arch/mips/fw/lib/cmdline.c                         |    2 +-
 arch/openrisc/kernel/entry.S                       |    6 +-
 arch/parisc/kernel/pacache.S                       |    2 +
 arch/parisc/kernel/real2.S                         |    5 +-
 arch/powerpc/boot/Makefile                         |    2 +
 arch/powerpc/include/asm/reg.h                     |    5 +
 arch/powerpc/kernel/rtas.c                         |    2 +-
 arch/powerpc/perf/mpc7450-pmu.c                    |    6 +-
 arch/powerpc/platforms/512x/clock-commonclk.c      |    2 +-
 arch/powerpc/platforms/embedded6xx/flipper-pic.c   |    2 +-
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c      |    2 +-
 arch/powerpc/platforms/embedded6xx/wii.c           |    4 +-
 arch/powerpc/sysdev/tsi108_pci.c                   |    5 +-
 arch/riscv/include/asm/sbi.h                       |    2 +-
 arch/riscv/kernel/cpu_ops.c                        |    2 +-
 arch/riscv/kernel/sbi.c                            |   17 +-
 arch/riscv/kvm/main.c                              |    2 +-
 arch/riscv/kvm/mmu.c                               |   25 +-
 arch/riscv/mm/init.c                               |    6 +-
 arch/riscv/mm/ptdump.c                             |   24 +-
 arch/s390/Kconfig                                  |    4 -
 arch/s390/include/asm/checksum.h                   |    9 +-
 arch/sh/kernel/cpu/sh4/sq.c                        |    2 +-
 arch/x86/include/asm/intel-family.h                |    2 +
 arch/x86/kernel/apic/apic.c                        |    5 +-
 arch/x86/kernel/apic/io_apic.c                     |   14 +-
 arch/x86/kernel/cpu/mce/amd.c                      |   14 +-
 arch/x86/kernel/cpu/mshyperv.c                     |   12 +-
 arch/x86/kvm/vmx/vmx.c                             |   23 +-
 block/blk-crypto-internal.h                        |   25 +-
 block/blk-crypto-profile.c                         |   46 +-
 block/blk-crypto.c                                 |   66 +-
 block/blk-iocost.c                                 |    8 +-
 block/blk-merge.c                                  |    2 +
 block/blk-mq.c                                     |   17 +-
 block/blk-stat.c                                   |    4 +-
 crypto/algapi.c                                    |    4 +-
 crypto/drbg.c                                      |    2 +-
 crypto/testmgr.c                                   |  266 +++--
 drivers/acpi/bus.c                                 |    1 +
 drivers/acpi/power.c                               |   19 +
 drivers/acpi/processor_pdc.c                       |   11 +
 drivers/acpi/video_detect.c                        |   14 -
 drivers/acpi/viot.c                                |    5 +-
 drivers/base/cacheinfo.c                           |    5 +-
 drivers/base/cpu.c                                 |    3 +-
 drivers/base/platform.c                            |    4 +-
 drivers/block/drbd/drbd_receiver.c                 |    2 +-
 drivers/bluetooth/btsdio.c                         |    1 -
 drivers/bus/mhi/host/boot.c                        |   16 +-
 drivers/bus/mhi/host/init.c                        |   12 +
 drivers/bus/mhi/host/main.c                        |    2 +-
 drivers/bus/mhi/host/pci_generic.c                 |    2 -
 drivers/char/ipmi/Kconfig                          |    3 +-
 drivers/char/ipmi/ipmi_ssif.c                      |    8 +-
 drivers/char/tpm/tpm-chip.c                        |    3 +-
 drivers/char/tpm/tpm_tis_core.c                    |  131 ++-
 drivers/char/tpm/tpm_tis_core.h                    |    2 +
 drivers/clk/at91/clk-sam9x60-pll.c                 |    2 +-
 drivers/clk/clk-conf.c                             |   12 +-
 drivers/clk/imx/clk-fracn-gppll.c                  |   22 +-
 drivers/clk/imx/clk-imx8ulp.c                      |    4 +-
 drivers/clk/mediatek/clk-mt2701-aud.c              |   40 +-
 drivers/clk/mediatek/clk-mt2701-bdp.c              |   20 +-
 drivers/clk/mediatek/clk-mt2701-eth.c              |   10 +-
 drivers/clk/mediatek/clk-mt2701-g3d.c              |   10 +-
 drivers/clk/mediatek/clk-mt2701-hif.c              |   10 +-
 drivers/clk/mediatek/clk-mt2701-img.c              |   10 +-
 drivers/clk/mediatek/clk-mt2701-mm.c               |   20 +-
 drivers/clk/mediatek/clk-mt2701-vdec.c             |   20 +-
 drivers/clk/mediatek/clk-mt2701.c                  |   40 +-
 drivers/clk/mediatek/clk-mt2712-bdp.c              |   10 +-
 drivers/clk/mediatek/clk-mt2712-img.c              |   10 +-
 drivers/clk/mediatek/clk-mt2712-jpgdec.c           |   10 +-
 drivers/clk/mediatek/clk-mt2712-mfg.c              |   10 +-
 drivers/clk/mediatek/clk-mt2712-mm.c               |   34 +-
 drivers/clk/mediatek/clk-mt2712-vdec.c             |   20 +-
 drivers/clk/mediatek/clk-mt2712-venc.c             |   10 +-
 drivers/clk/mediatek/clk-mt2712.c                  |   78 +-
 drivers/clk/mediatek/clk-mt6765-audio.c            |   20 +-
 drivers/clk/mediatek/clk-mt6765-cam.c              |   10 +-
 drivers/clk/mediatek/clk-mt6765-img.c              |   10 +-
 drivers/clk/mediatek/clk-mt6765-mipi0a.c           |   10 +-
 drivers/clk/mediatek/clk-mt6765-mm.c               |   10 +-
 drivers/clk/mediatek/clk-mt6765-vcodec.c           |   10 +-
 drivers/clk/mediatek/clk-mt6765.c                  |   80 +-
 drivers/clk/mediatek/clk-mt6797-img.c              |   10 +-
 drivers/clk/mediatek/clk-mt6797-mm.c               |   20 +-
 drivers/clk/mediatek/clk-mt6797-vdec.c             |   20 +-
 drivers/clk/mediatek/clk-mt6797-venc.c             |   10 +-
 drivers/clk/mediatek/clk-mt6797.c                  |   42 +-
 drivers/clk/mediatek/clk-mt7622-aud.c              |   40 +-
 drivers/clk/mediatek/clk-mt7622-eth.c              |   20 +-
 drivers/clk/mediatek/clk-mt7622-hif.c              |   20 +-
 drivers/clk/mediatek/clk-mt7622.c                  |   90 +-
 drivers/clk/mediatek/clk-mt7629-eth.c              |   20 +-
 drivers/clk/mediatek/clk-mt7629-hif.c              |   20 +-
 drivers/clk/mediatek/clk-mt7629.c                  |   40 +-
 drivers/clk/mediatek/clk-mt7986-eth.c              |   24 +-
 drivers/clk/mediatek/clk-mt7986-infracfg.c         |   24 +-
 drivers/clk/mediatek/clk-mt8135.c                  |   44 +-
 drivers/clk/mediatek/clk-mt8167-aud.c              |   11 +-
 drivers/clk/mediatek/clk-mt8167-img.c              |   10 +-
 drivers/clk/mediatek/clk-mt8167-mfgcfg.c           |   10 +-
 drivers/clk/mediatek/clk-mt8167-mm.c               |   22 +-
 drivers/clk/mediatek/clk-mt8167-vdec.c             |   20 +-
 drivers/clk/mediatek/clk-mt8173-mm.c               |   22 +-
 drivers/clk/mediatek/clk-mt8516-aud.c              |   10 +-
 drivers/clk/mediatek/clk-mt8516.c                  |   60 +-
 drivers/clk/mediatek/clk-pllfh.c                   |   11 +-
 drivers/clk/microchip/clk-mpfs.c                   |    3 +-
 drivers/clk/qcom/dispcc-qcm2290.c                  |    9 -
 drivers/clk/qcom/gcc-qcm2290.c                     |    3 +-
 drivers/clk/qcom/gcc-sm6115.c                      |   50 +-
 drivers/clk/qcom/gcc-sm8350.c                      |   47 +-
 drivers/clk/qcom/lpassaudiocc-sc7280.c             |    2 +
 drivers/clk/qcom/lpasscc-sc7280.c                  |   16 +-
 drivers/clk/rockchip/clk-rk3399.c                  |    2 +-
 drivers/clocksource/timer-davinci.c                |   30 +-
 drivers/cpufreq/cpufreq.c                          |    2 +-
 drivers/cpufreq/mediatek-cpufreq.c                 |   98 +-
 drivers/cpufreq/qcom-cpufreq-hw.c                  |   25 +-
 drivers/cpuidle/cpuidle-riscv-sbi.c                |    2 +-
 drivers/crypto/Kconfig                             |    1 +
 drivers/crypto/caam/ctrl.c                         |    6 +-
 drivers/crypto/ccp/sp-pci.c                        |    2 +-
 drivers/crypto/inside-secure/safexcel.c            |   37 +-
 drivers/crypto/qat/qat_common/adf_accel_devices.h  |    1 +
 drivers/crypto/qat/qat_common/adf_common_drv.h     |    3 +
 drivers/crypto/qat/qat_common/adf_dev_mgr.c        |    2 +
 drivers/crypto/qat/qat_common/adf_init.c           |   64 ++
 drivers/crypto/qat/qat_common/adf_sysfs.c          |   23 +-
 drivers/cxl/core/hdm.c                             |   15 +-
 drivers/dma/at_xdmac.c                             |    5 +-
 drivers/dma/dw-edma/dw-edma-core.c                 |   27 +-
 drivers/dma/mv_xor_v2.c                            |    2 +-
 drivers/dma/qcom/gpi.c                             |    1 -
 drivers/edac/skx_base.c                            |    4 +-
 drivers/firmware/arm_scmi/driver.c                 |    2 +-
 drivers/firmware/qcom_scm.c                        |    3 +-
 drivers/firmware/stratix10-svc.c                   |    4 +-
 drivers/fpga/fpga-bridge.c                         |    2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c         |   21 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |    3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c  |    3 +
 drivers/gpu/drm/amd/display/dc/dce60/Makefile      |    2 +-
 .../gpu/drm/amd/display/dc/dcn30/dcn30_resource.c  |   16 +-
 .../gpu/drm/amd/display/dc/dcn30/dcn30_resource.h  |    3 +-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_resource.c  |    2 +-
 .../drm/amd/display/dc/dcn314/dcn314_resource.c    |   77 +-
 .../drm/amd/display/dc/dcn314/dcn314_resource.h    |    4 +
 .../gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c   |    2 +-
 .../drm/amd/display/modules/power/power_helpers.c  |   35 +
 .../drm/amd/display/modules/power/power_helpers.h  |    3 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c          |   40 +-
 drivers/gpu/drm/bridge/adv7511/adv7533.c           |   25 +-
 drivers/gpu/drm/drm_probe_helper.c                 |    5 +-
 drivers/gpu/drm/i915/display/intel_display.c       |    2 +-
 drivers/gpu/drm/lima/lima_drv.c                    |    6 +-
 drivers/gpu/drm/mediatek/mtk_dp.c                  |   15 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c              |    8 +-
 drivers/gpu/drm/msm/adreno/adreno_device.c         |    3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c        |    2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c      |   10 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c          |    4 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c        |    3 -
 drivers/gpu/drm/ttm/ttm_pool.c                     |   81 +-
 drivers/gpu/drm/vgem/vgem_fence.c                  |    1 +
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c                |   62 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h                |    5 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c                |   45 +-
 drivers/gpu/host1x/context.c                       |   24 +-
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c             |    9 +
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c      |    2 +-
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c      |   11 +
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c |   10 +-
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h |    8 +-
 drivers/hte/hte-tegra194-test.c                    |    1 +
 drivers/hte/hte-tegra194.c                         |    2 +-
 drivers/hwmon/adt7475.c                            |    6 +-
 drivers/hwmon/k10temp.c                            |    4 +-
 drivers/hwmon/pmbus/fsp-3y.c                       |    1 -
 drivers/hwtracing/coresight/coresight-etm-perf.c   |    1 +
 drivers/i2c/busses/i2c-cadence.c                   |    6 +-
 drivers/i2c/busses/i2c-omap.c                      |    2 +-
 drivers/i2c/busses/i2c-xiic.c                      |    4 +-
 drivers/iio/adc/palmas_gpadc.c                     |    2 +-
 drivers/iio/addac/stx104.c                         |   12 +
 drivers/iio/light/max44009.c                       |   13 +-
 drivers/infiniband/core/cm.c                       |    3 +-
 drivers/infiniband/hw/erdma/erdma_hw.h             |    4 +
 drivers/infiniband/hw/erdma/erdma_verbs.c          |   17 +-
 drivers/infiniband/hw/hfi1/ipoib_tx.c              |    6 +-
 drivers/infiniband/hw/hfi1/mmu_rb.c                |   73 +-
 drivers/infiniband/hw/hfi1/mmu_rb.h                |    8 +-
 drivers/infiniband/hw/hfi1/sdma.c                  |   21 +-
 drivers/infiniband/hw/hfi1/sdma.h                  |   16 +-
 drivers/infiniband/hw/hfi1/sdma_txreq.h            |    1 +
 drivers/infiniband/hw/hfi1/trace_mmu.h             |    4 -
 drivers/infiniband/hw/hfi1/user_sdma.c             |  600 +++++++----
 drivers/infiniband/hw/hfi1/user_sdma.h             |    5 -
 drivers/infiniband/hw/hfi1/verbs.c                 |    4 +-
 drivers/infiniband/hw/hfi1/vnic_sdma.c             |    1 +
 drivers/infiniband/hw/mlx4/qp.c                    |    8 +-
 drivers/infiniband/hw/mlx5/devx.c                  |   31 +-
 drivers/infiniband/hw/mlx5/qp.c                    |    2 +-
 drivers/infiniband/hw/mlx5/umr.c                   |    6 +-
 drivers/infiniband/sw/rdmavt/qp.c                  |    2 -
 drivers/infiniband/sw/rxe/rxe.c                    |   12 +-
 drivers/infiniband/sw/rxe/rxe_comp.c               |    3 +-
 drivers/infiniband/sw/rxe/rxe_cq.c                 |   32 +-
 drivers/infiniband/sw/rxe/rxe_loc.h                |    6 +-
 drivers/infiniband/sw/rxe/rxe_qp.c                 |   63 +-
 drivers/infiniband/sw/rxe/rxe_req.c                |    3 +-
 drivers/infiniband/sw/rxe/rxe_resp.c               |    3 +-
 drivers/infiniband/sw/rxe/rxe_task.c               |   22 +-
 drivers/infiniband/sw/rxe/rxe_task.h               |   15 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c              |    2 -
 drivers/infiniband/sw/rxe/rxe_verbs.h              |    2 -
 drivers/infiniband/sw/siw/siw_main.c               |    3 -
 drivers/infiniband/sw/siw/siw_qp_tx.c              |    2 +-
 drivers/infiniband/ulp/isert/ib_isert.c            |    4 +-
 drivers/infiniband/ulp/srpt/ib_srpt.c              |   23 +-
 drivers/input/touchscreen/raspberrypi-ts.c         |    3 +-
 drivers/interconnect/qcom/icc-rpm.c                |    7 -
 drivers/interconnect/qcom/icc-rpm.h                |    1 -
 drivers/interconnect/qcom/msm8996.c                |    1 -
 drivers/interconnect/qcom/osm-l3.c                 |    7 -
 drivers/interconnect/qcom/sc7180.h                 |    2 -
 drivers/interconnect/qcom/sc7280.h                 |    2 -
 drivers/interconnect/qcom/sc8180x.h                |    2 -
 drivers/interconnect/qcom/sdm845.h                 |    2 -
 drivers/interconnect/qcom/sm8150.h                 |    2 -
 drivers/interconnect/qcom/sm8250.h                 |    2 -
 drivers/iommu/amd/amd_iommu_types.h                |    4 +-
 drivers/iommu/amd/iommu.c                          |    6 +-
 drivers/iommu/iommu.c                              |    9 +-
 drivers/iommu/iommufd/selftest.c                   |    9 +-
 drivers/iommu/mtk_iommu.c                          |    8 +
 drivers/leds/Kconfig                               |    2 +-
 drivers/leds/leds-tca6507.c                        |    5 +-
 drivers/macintosh/Kconfig                          |    1 +
 drivers/macintosh/windfarm_smu_sat.c               |    1 +
 drivers/mailbox/mailbox-mpfs.c                     |   12 +-
 drivers/mailbox/zynqmp-ipi-mailbox.c               |    6 +-
 drivers/md/dm-clone-target.c                       |    1 +
 drivers/md/dm-flakey.c                             |    4 +-
 drivers/md/dm-integrity.c                          |    8 +-
 drivers/md/dm-ioctl.c                              |   12 +-
 drivers/md/dm-table.c                              |   19 +-
 drivers/md/dm-verity-target.c                      |    2 +-
 drivers/md/raid10.c                                |   96 +-
 drivers/md/raid5.c                                 |   45 +-
 drivers/media/i2c/hi846.c                          |   11 +-
 drivers/media/i2c/max9286.c                        |    1 +
 drivers/media/i2c/ov8856.c                         |   40 -
 drivers/media/pci/dm1105/dm1105.c                  |    1 +
 drivers/media/pci/saa7134/saa7134-ts.c             |    1 +
 drivers/media/pci/saa7134/saa7134-vbi.c            |    1 +
 drivers/media/pci/saa7134/saa7134-video.c          |    1 +
 drivers/media/platform/amphion/vdec.c              |   32 +
 drivers/media/platform/amphion/vpu_codec.h         |    3 +-
 drivers/media/platform/amphion/vpu_malone.c        |    4 +-
 .../media/platform/mediatek/jpeg/mtk_jpeg_core.c   |   19 +-
 .../media/platform/mediatek/jpeg/mtk_jpeg_core.h   |    2 +
 .../media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c |    4 -
 .../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c    |    8 +-
 .../media/platform/mediatek/mdp3/mtk-mdp3-regs.c   |   10 +-
 .../platform/mediatek/vcodec/mtk_vcodec_dec.c      |   24 +-
 .../platform/mediatek/vcodec/mtk_vcodec_dec_drv.c  |    3 +-
 .../platform/mediatek/vcodec/mtk_vcodec_dec_hw.c   |    8 +
 .../mediatek/vcodec/mtk_vcodec_dec_stateful.c      |   12 +-
 .../mediatek/vcodec/mtk_vcodec_dec_stateless.c     |   14 +-
 .../mediatek/vcodec/vdec/vdec_h264_req_multi_if.c  |    2 +-
 .../mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c     |    2 +-
 .../platform/mediatek/vcodec/vdec_msg_queue.c      |   95 +-
 .../platform/mediatek/vcodec/vdec_msg_queue.h      |   12 +
 drivers/media/platform/qcom/venus/vdec.c           |   16 +-
 drivers/media/platform/renesas/rcar_fdp1.c         |   17 +-
 drivers/media/platform/renesas/vsp1/vsp1_video.c   |    2 +-
 drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c   |    2 +
 drivers/media/rc/gpio-ir-recv.c                    |    2 +
 drivers/media/v4l2-core/v4l2-async.c               |   13 +-
 drivers/mfd/arizona-spi.c                          |    1 +
 drivers/mfd/ocelot-spi.c                           |    1 +
 drivers/mfd/tqmx86.c                               |   52 +-
 drivers/misc/vmw_vmci/vmci_host.c                  |    8 +-
 drivers/mmc/host/sdhci-of-esdhc.c                  |   24 +-
 drivers/mtd/mtdcore.c                              |   23 +-
 drivers/mtd/spi-nor/core.c                         |    4 +-
 drivers/mtd/ubi/eba.c                              |   19 +-
 drivers/net/dsa/qca/qca8k-8xxx.c                   |    1 -
 drivers/net/ethernet/amd/nmclan_cs.c               |    2 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c     |    3 +-
 drivers/net/ethernet/intel/i40e/i40e.h             |    6 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |   68 +-
 drivers/net/ethernet/intel/i40e/i40e_alloc.h       |   22 +-
 drivers/net/ethernet/intel/i40e/i40e_client.c      |   12 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      | 1038 +++++++++-----------
 drivers/net/ethernet/intel/i40e/i40e_dcb.c         |   60 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb.h         |   28 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c      |   16 +-
 drivers/net/ethernet/intel/i40e/i40e_ddp.c         |   14 +-
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     |    8 +-
 drivers/net/ethernet/intel/i40e/i40e_diag.c        |   12 +-
 drivers/net/ethernet/intel/i40e/i40e_diag.h        |    4 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   65 +-
 drivers/net/ethernet/intel/i40e/i40e_hmc.c         |   56 +-
 drivers/net/ethernet/intel/i40e/i40e_hmc.h         |   46 +-
 drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c     |   94 +-
 drivers/net/ethernet/intel/i40e/i40e_lan_hmc.h     |   34 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  404 ++++----
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         |  252 ++---
 drivers/net/ethernet/intel/i40e/i40e_osdep.h       |    1 -
 drivers/net/ethernet/intel/i40e/i40e_prototype.h   |  643 ++++++------
 drivers/net/ethernet/intel/i40e/i40e_status.h      |   35 -
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |   94 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c   |   23 +-
 drivers/net/ethernet/mellanox/mlx5/core/dev.c      |    4 +-
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c  |    6 +-
 .../ethernet/mellanox/mlx5/core/en/tc/post_act.c   |   11 +-
 .../ethernet/mellanox/mlx5/core/en/tc/post_act.h   |    2 +-
 .../net/ethernet/mellanox/mlx5/core/en/tc/sample.c |    4 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_fs.c    |    5 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |    1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |    2 +
 .../net/ethernet/mellanox/mlx5/core/esw/vporttbl.c |   12 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h  |    2 +-
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |    4 +-
 .../mellanox/mlx5/core/eswitch_offloads_termtbl.c  |   32 +-
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c |    8 +-
 drivers/net/ethernet/mellanox/mlx5/core/health.c   |    2 +-
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |   16 +-
 .../net/ethernet/mellanox/mlx5/core/mlx5_core.h    |    6 +-
 .../ethernet/mellanox/mlx5/core/sf/dev/driver.c    |    2 +-
 drivers/net/ethernet/netronome/nfp/crypto/ipsec.c  |    4 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     |  197 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   12 +-
 drivers/net/ethernet/sun/sunhme.c                  |    2 +-
 drivers/net/pcs/pcs-xpcs.c                         |   13 +-
 drivers/net/phy/sfp.c                              |    4 +
 drivers/net/wireless/ath/ath11k/ahb.c              |   14 +-
 drivers/net/wireless/ath/ath11k/dbring.c           |   12 +-
 drivers/net/wireless/ath/ath11k/mhi.c              |    2 +-
 drivers/net/wireless/ath/ath11k/peer.c             |    5 +-
 drivers/net/wireless/ath/ath5k/ahb.c               |   10 +-
 drivers/net/wireless/ath/ath5k/eeprom.c            |    2 +-
 drivers/net/wireless/ath/ath6kl/bmi.c              |    2 +-
 drivers/net/wireless/ath/ath6kl/htc_pipe.c         |    4 +-
 drivers/net/wireless/ath/ath9k/hif_usb.c           |   19 +
 .../broadcom/brcm80211/brcmfmac/cfg80211.c         |   14 +-
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c        |    8 +-
 drivers/net/wireless/intel/iwlwifi/fw/debugfs.c    |    4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c   |    6 +
 drivers/net/wireless/intel/iwlwifi/iwl-debug.c     |    3 +-
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c        |    1 +
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |   10 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |    5 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c        |    5 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c      |    5 +-
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c      |    1 -
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c    |   12 +-
 drivers/net/wireless/mediatek/mt76/dma.c           |    2 +
 drivers/net/wireless/mediatek/mt76/mt76.h          |    9 +-
 drivers/net/wireless/mediatek/mt76/mt7603/mac.c    |    5 +-
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c    |   13 +-
 .../net/wireless/mediatek/mt76/mt76_connac_mac.c   |    3 +-
 .../net/wireless/mediatek/mt76/mt76_connac_mcu.c   |   13 +-
 .../net/wireless/mediatek/mt76/mt76_connac_mcu.h   |    3 -
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c   |    5 +-
 drivers/net/wireless/mediatek/mt76/mt7915/init.c   |   17 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h |    2 +
 drivers/net/wireless/mediatek/mt76/mt7915/soc.c    |    2 +
 drivers/net/wireless/mediatek/mt76/mt7921/dma.c    |   40 +-
 drivers/net/wireless/mediatek/mt76/mt7921/init.c   |    7 +-
 drivers/net/wireless/mediatek/mt76/mt7921/main.c   |    2 +-
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c    |   20 -
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c    |   21 +-
 drivers/net/wireless/mediatek/mt76/mt7921/usb.c    |    2 +-
 drivers/net/wireless/mediatek/mt76/mt7996/eeprom.h |    8 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mac.c    |  108 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mac.h    |   56 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c    |    9 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mmio.c   |    2 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h |    5 +-
 drivers/net/wireless/mediatek/mt76/tx.c            |    4 +
 drivers/net/wireless/mediatek/mt76/util.c          |   10 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c     |    1 +
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c |    1 +
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c  |    6 +-
 drivers/net/wireless/realtek/rtlwifi/debug.c       |   12 +-
 drivers/net/wireless/realtek/rtw88/mac.c           |    8 +-
 drivers/net/wireless/realtek/rtw88/rtw8821c.c      |    3 +-
 drivers/net/wireless/realtek/rtw88/usb.c           |   70 +-
 drivers/net/wireless/realtek/rtw89/core.c          |   10 +-
 drivers/net/wireless/realtek/rtw89/pci.c           |   19 +-
 drivers/net/wireless/realtek/rtw89/rtw8852b.c      |    9 +-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c      |    9 +-
 drivers/net/wwan/t7xx/Makefile                     |    2 -
 drivers/nvme/host/core.c                           |    5 +-
 drivers/nvme/host/trace.h                          |   15 +-
 drivers/nvme/target/admin-cmd.c                    |   45 +-
 drivers/nvme/target/fcloop.c                       |   48 +-
 drivers/nvme/target/nvmet.h                        |    2 +-
 drivers/nvme/target/zns.c                          |   18 +-
 drivers/of/device.c                                |    7 +-
 drivers/pci/controller/dwc/Kconfig                 |    1 +
 drivers/pci/controller/dwc/pci-imx6.c              |    7 +
 drivers/pci/controller/dwc/pcie-qcom.c             |    8 +-
 drivers/pci/hotplug/pciehp_pci.c                   |   15 +
 drivers/pci/pcie/edr.c                             |    1 +
 drivers/pci/quirks.c                               |   13 +
 drivers/perf/amlogic/meson_ddr_pmu_core.c          |    8 +-
 drivers/perf/arm-cmn.c                             |   59 +-
 drivers/perf/riscv_pmu_sbi.c                       |    2 +-
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c           |    2 +-
 drivers/phy/tegra/xusb.c                           |    2 +
 drivers/phy/ti/phy-j721e-wiz.c                     |   11 +-
 drivers/pinctrl/bcm/pinctrl-bcm2835.c              |   19 +-
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c           |   14 +-
 drivers/pinctrl/ralink/pinctrl-mt7620.c            |    1 +
 drivers/pinctrl/ralink/pinctrl-mt7621.c            |    1 +
 drivers/pinctrl/ralink/pinctrl-rt2880.c            |    1 +
 drivers/pinctrl/ralink/pinctrl-rt305x.c            |    1 +
 drivers/pinctrl/ralink/pinctrl-rt3883.c            |    1 +
 drivers/pinctrl/renesas/pfc-r8a779a0.c             |    8 -
 drivers/pinctrl/renesas/pfc-r8a779f0.c             |    2 +-
 drivers/pinctrl/renesas/pfc-r8a779g0.c             |  990 ++++++++++---------
 drivers/platform/chrome/cros_typec_switch.c        |    1 +
 drivers/platform/x86/amd/Kconfig                   |    2 +-
 drivers/platform/x86/amd/pmc.c                     |  157 ++-
 drivers/platform/x86/amd/pmf/Kconfig               |    1 +
 drivers/platform/x86/amd/pmf/core.c                |   22 +-
 drivers/platform/x86/thinkpad_acpi.c               |    8 +
 drivers/power/supply/generic-adc-battery.c         |    3 +
 drivers/power/supply/rk817_charger.c               |   33 +-
 drivers/pwm/pwm-meson.c                            |    6 +-
 drivers/pwm/pwm-mtk-disp.c                         |   34 +-
 drivers/regulator/core.c                           |  100 +-
 drivers/regulator/stm32-pwr.c                      |    7 +-
 drivers/remoteproc/xlnx_r5_remoteproc.c            |   90 +-
 drivers/rpmsg/qcom_glink_native.c                  |   10 +-
 drivers/rtc/rtc-meson-vrtc.c                       |    4 +-
 drivers/rtc/rtc-omap.c                             |    1 +
 drivers/rtc/rtc-ti-k3.c                            |    3 +-
 drivers/s390/block/dasd.c                          |    2 +-
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c             |    6 +-
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c             |    6 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c             |    6 +-
 drivers/scsi/lpfc/lpfc_init.c                      |   10 +-
 drivers/scsi/megaraid.c                            |    1 +
 drivers/scsi/mpi3mr/mpi3mr_fw.c                    |    2 +-
 drivers/soc/bcm/brcmstb/biuctrl.c                  |    4 +
 drivers/soc/qcom/rpmh-rsc.c                        |    2 +-
 drivers/soc/renesas/renesas-soc.c                  |    5 +-
 drivers/soc/ti/k3-ringacc.c                        |    7 +
 drivers/soc/ti/pm33xx.c                            |    5 +-
 drivers/soundwire/cadence_master.h                 |    2 -
 drivers/soundwire/intel.c                          |   11 +-
 drivers/soundwire/qcom.c                           |    2 +-
 drivers/spi/atmel-quadspi.c                        |   30 +-
 drivers/spi/spi-bcm63xx.c                          |    2 -
 drivers/spi/spi-cadence-quadspi.c                  |   32 +-
 drivers/spi/spi-fsl-spi.c                          |   12 +-
 drivers/spi/spi-imx.c                              |   12 +-
 drivers/spi/spi-pci1xxxx.c                         |    5 +-
 drivers/spi/spi-qup.c                              |   22 +-
 drivers/spi/spi-sn-f-ospi.c                        |    2 +-
 drivers/spmi/spmi.c                                |    3 +-
 drivers/staging/iio/resolver/ad2s1210.c            |    2 +-
 .../media/deprecated/saa7146/av7110/av7110_av.c    |    4 +-
 drivers/staging/media/rkvdec/rkvdec.c              |    2 +
 drivers/staging/media/sunxi/cedrus/cedrus.c        |    1 +
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |    1 +
 drivers/staging/rtl8723bs/core/rtw_mlme.c          |    8 +-
 drivers/target/iscsi/iscsi_target.c                |   36 +-
 drivers/target/iscsi/iscsi_target_login.c          |    7 +
 drivers/target/target_core_device.c                |    1 +
 drivers/target/target_core_internal.h              |    1 -
 drivers/target/target_core_tmr.c                   |   26 +-
 drivers/target/target_core_tpg.c                   |    2 +-
 drivers/target/target_core_transport.c             |  199 ++--
 drivers/target/target_core_xcopy.c                 |   23 +-
 drivers/thermal/mtk_thermal.c                      |   14 +-
 drivers/thunderbolt/tb.h                           |    2 +-
 drivers/tty/serial/8250/8250.h                     |   12 +
 drivers/tty/serial/8250/8250_bcm7271.c             |   18 +-
 drivers/tty/serial/8250/8250_port.c                |   11 +-
 drivers/tty/serial/fsl_lpuart.c                    |    2 +-
 drivers/tty/serial/max310x.c                       |   17 +-
 drivers/tty/serial/serial_core.c                   |    4 +-
 drivers/tty/serial/stm32-usart.c                   |    5 +-
 drivers/tty/tty.h                                  |    2 +
 drivers/tty/tty_io.c                               |    4 +-
 drivers/tty/tty_ioctl.c                            |   45 +-
 drivers/usb/chipidea/core.c                        |    2 +-
 drivers/usb/dwc3/core.c                            |   15 +-
 drivers/usb/dwc3/gadget.c                          |   60 +-
 drivers/usb/gadget/function/f_tcm.c                |    4 +-
 drivers/usb/gadget/udc/core.c                      |  151 ++-
 drivers/usb/gadget/udc/renesas_usb3.c              |    1 +
 drivers/usb/gadget/udc/tegra-xudc.c                |    2 +-
 drivers/usb/host/xhci-debugfs.c                    |    1 +
 drivers/usb/host/xhci-rcar.c                       |    3 -
 drivers/usb/mtu3/mtu3_qmu.c                        |    5 +-
 drivers/vhost/vdpa.c                               |    8 +-
 drivers/video/fbdev/mmp/hw/mmp_ctrl.c              |    2 +-
 drivers/virt/coco/sev-guest/sev-guest.c            |   27 +-
 drivers/virtio/virtio_ring.c                       |   22 +-
 drivers/xen/pcpu.c                                 |   20 +
 fs/Makefile                                        |    3 +-
 fs/afs/dir.c                                       |    4 +
 fs/afs/inode.c                                     |   10 +-
 fs/btrfs/ioctl.c                                   |    5 +
 fs/ceph/caps.c                                     |    2 +-
 fs/ceph/debugfs.c                                  |   18 +-
 fs/ceph/mds_client.c                               |   72 +-
 fs/ceph/mds_client.h                               |    3 +-
 fs/ceph/super.h                                    |    2 +
 fs/cifs/cifs_debug.c                               |    7 +-
 fs/cifs/cifs_debug.h                               |   12 +-
 fs/cifs/cifsglob.h                                 |   21 +-
 fs/cifs/cifsproto.h                                |   44 +-
 fs/cifs/connect.c                                  |  134 +--
 fs/cifs/dfs.c                                      |  133 ++-
 fs/cifs/dfs.h                                      |   13 +-
 fs/cifs/dfs_cache.c                                |    6 +-
 fs/cifs/file.c                                     |   16 +
 fs/cifs/ioctl.c                                    |    2 +-
 fs/cifs/misc.c                                     |    8 +-
 fs/cifs/sess.c                                     |    7 +-
 fs/cifs/smb2pdu.c                                  |   19 +-
 fs/dlm/ast.c                                       |    9 +-
 fs/dlm/dlm_internal.h                              |    5 +-
 fs/dlm/user.c                                      |    2 +-
 fs/erofs/internal.h                                |    3 +-
 fs/erofs/super.c                                   |   22 +-
 fs/erofs/zmap.c                                    |    4 +
 fs/ext4/extents.c                                  |    3 +-
 fs/ext4/inode.c                                    |    3 +
 fs/f2fs/compress.c                                 |   13 +-
 fs/f2fs/data.c                                     |    5 +-
 fs/f2fs/f2fs.h                                     |    1 +
 fs/f2fs/file.c                                     |   21 +-
 fs/f2fs/gc.c                                       |    2 +-
 fs/f2fs/segment.c                                  |   73 +-
 fs/f2fs/segment.h                                  |    3 +
 fs/f2fs/super.c                                    |    2 +-
 fs/f2fs/sysfs.c                                    |    4 +-
 fs/jbd2/transaction.c                              |    3 +
 fs/ksmbd/auth.c                                    |   19 +-
 fs/ksmbd/mgmt/tree_connect.c                       |   10 +-
 fs/ksmbd/mgmt/tree_connect.h                       |    3 +
 fs/ksmbd/server.c                                  |    1 +
 fs/ksmbd/smb2pdu.c                                 |   21 +-
 fs/nfs/nfs4state.c                                 |    4 +
 fs/nilfs2/bmap.c                                   |   16 +-
 fs/nilfs2/segment.c                                |    5 +-
 fs/ntfs3/fslog.c                                   |    6 +-
 fs/ntfs3/index.c                                   |    8 +
 fs/ntfs3/inode.c                                   |    2 +-
 fs/ntfs3/namei.c                                   |   10 +
 fs/ntfs3/ntfs_fs.h                                 |    1 +
 fs/pstore/pmsg.c                                   |    7 +-
 fs/reiserfs/xattr_security.c                       |    8 +-
 fs/ubifs/dir.c                                     |    7 +-
 fs/ubifs/tnc.c                                     |  142 +--
 fs/xfs/libxfs/xfs_sb.c                             |   11 +-
 include/asm-generic/io.h                           |   16 +-
 include/drm/drm_file.h                             |    3 +-
 include/drm/i915_pciids.h                          |    1 -
 include/linux/blk-crypto.h                         |    4 +-
 include/linux/bpf.h                                |   42 +-
 include/linux/bpf_verifier.h                       |   38 +-
 include/linux/btf.h                                |    8 +
 include/linux/filter.h                             |    6 +-
 include/linux/mailbox/zynqmp-ipi-message.h         |    2 +-
 include/linux/mlx5/mlx5_ifc.h                      |    3 +-
 include/linux/netfilter/nfnetlink.h                |    1 -
 include/linux/platform_device.h                    |   11 +
 include/linux/posix-timers.h                       |   17 +-
 include/linux/sunrpc/sched.h                       |    3 +-
 include/linux/tick.h                               |    2 +
 include/linux/vt_buffer.h                          |    2 +-
 include/net/netfilter/nf_conntrack_core.h          |    6 +-
 include/net/scm.h                                  |   13 +-
 include/net/xsk_buff_pool.h                        |    9 +-
 include/target/iscsi/iscsi_target_core.h           |    1 +
 include/target/target_core_base.h                  |   14 +-
 include/target/target_core_fabric.h                |   15 +-
 include/trace/events/qrtr.h                        |   33 +-
 include/trace/events/timer.h                       |    3 +-
 include/trace/stages/stage5_get_offsets.h          |   21 +-
 include/uapi/linux/bpf.h                           |   11 +
 include/uapi/linux/btrfs.h                         |    1 +
 include/uapi/linux/const.h                         |    2 +-
 include/xen/xen.h                                  |   11 +
 io_uring/rsrc.c                                    |    2 +-
 kernel/bpf/arraymap.c                              |   12 +-
 kernel/bpf/bloom_filter.c                          |   12 +-
 kernel/bpf/bpf_cgrp_storage.c                      |    6 +-
 kernel/bpf/bpf_inode_storage.c                     |    6 +-
 kernel/bpf/bpf_struct_ops.c                        |    6 +-
 kernel/bpf/bpf_task_storage.c                      |    6 +-
 kernel/bpf/btf.c                                   |  197 ++--
 kernel/bpf/cgroup.c                                |    9 +-
 kernel/bpf/cpumap.c                                |    8 +-
 kernel/bpf/devmap.c                                |   24 +-
 kernel/bpf/hashtab.c                               |   36 +-
 kernel/bpf/helpers.c                               |   98 +-
 kernel/bpf/local_storage.c                         |    6 +-
 kernel/bpf/lpm_trie.c                              |    6 +-
 kernel/bpf/queue_stack_maps.c                      |   22 +-
 kernel/bpf/reuseport_array.c                       |    2 +-
 kernel/bpf/ringbuf.c                               |    6 +-
 kernel/bpf/stackmap.c                              |    6 +-
 kernel/bpf/syscall.c                               |   28 +-
 kernel/bpf/verifier.c                              |  714 +++++++++++---
 kernel/dma/swiotlb.c                               |   16 +-
 kernel/events/core.c                               |    4 +-
 kernel/kcsan/core.c                                |   17 +-
 kernel/kheaders.c                                  |   10 +-
 kernel/module/decompress.c                         |    2 +-
 kernel/power/hibernate.c                           |   15 +-
 kernel/power/power.h                               |    1 +
 kernel/power/swap.c                                |    8 +-
 kernel/rcu/tree.c                                  |    1 +
 kernel/relay.c                                     |    3 +-
 kernel/sched/deadline.c                            |    1 +
 kernel/sched/fair.c                                |    2 +-
 kernel/sched/rt.c                                  |    4 +
 kernel/time/posix-cpu-timers.c                     |   81 +-
 kernel/time/posix-timers.c                         |    4 +
 kernel/time/tick-common.c                          |   12 +-
 kernel/time/tick-sched.c                           |   16 +-
 kernel/time/timekeeping.c                          |    4 +-
 kernel/trace/ring_buffer.c                         |   20 +-
 kernel/trace/trace.c                               |    2 +-
 kernel/trace/trace_events_user.c                   |    3 +
 kernel/workqueue.c                                 |   10 +-
 lib/debugobjects.c                                 |  146 +--
 lib/kunit/debugfs.c                                |   14 +-
 lib/kunit/test.c                                   |   21 +-
 mm/kasan/hw_tags.c                                 |    4 +-
 mm/mempolicy.c                                     |    4 +-
 mm/vmscan.c                                        |   10 +
 net/8021q/vlan_dev.c                               |    2 +-
 net/core/bpf_sk_storage.c                          |    6 +-
 net/core/skbuff.c                                  |    3 +
 net/core/sock_map.c                                |    8 +-
 net/dccp/ipv6.c                                    |    1 +
 net/ipv4/ip_output.c                               |   16 +-
 net/ipv6/ip6_input.c                               |   14 +-
 net/ipv6/raw.c                                     |    5 +-
 net/ipv6/tcp_ipv6.c                                |    2 +
 net/ipv6/udp.c                                     |    2 +
 net/netfilter/nf_conntrack_bpf.c                   |    1 +
 net/netfilter/nf_conntrack_core.c                  |    1 -
 net/netfilter/nf_conntrack_netlink.c               |   16 +-
 net/netfilter/nf_tables_api.c                      |    8 +-
 net/netfilter/nfnetlink.c                          |    2 -
 net/netlink/af_netlink.c                           |   75 +-
 net/packet/af_packet.c                             |   30 +-
 net/packet/diag.c                                  |    4 +-
 net/packet/internal.h                              |   26 +-
 net/rxrpc/key.c                                    |    2 +-
 net/sched/sch_fq.c                                 |    6 +-
 net/sunrpc/clnt.c                                  |    3 -
 net/sunrpc/sched.c                                 |    1 -
 net/xdp/xsk_queue.h                                |    1 +
 net/xdp/xskmap.c                                   |    8 +-
 scripts/gdb/linux/clk.py                           |    2 +
 scripts/gdb/linux/constants.py.in                  |    2 +
 scripts/gdb/linux/genpd.py                         |    4 +-
 scripts/gdb/linux/timerlist.py                     |    4 +-
 scripts/gdb/linux/utils.py                         |    5 +-
 scripts/gdb/vmlinux-gdb.py                         |    5 +-
 security/integrity/ima/Kconfig                     |    2 +-
 security/selinux/Makefile                          |    4 +-
 sound/pci/hda/patch_realtek.c                      |    5 +
 sound/soc/amd/ps/pci-ps.c                          |    2 -
 sound/soc/amd/yc/acp6x-mach.c                      |    7 +
 sound/soc/codecs/cs35l41.c                         |   34 +-
 sound/soc/codecs/da7213.c                          |    6 +
 sound/soc/codecs/es8316.c                          |   14 +-
 sound/soc/fsl/fsl_mqs.c                            |   15 +-
 sound/soc/intel/boards/bytcr_rt5640.c              |   12 +
 sound/soc/intel/boards/sof_sdw.c                   |   11 +
 sound/soc/intel/common/soc-acpi-intel-adl-match.c  |   20 +
 sound/soc/soc-compress.c                           |    3 +
 sound/soc/soc-pcm.c                                |    4 +
 sound/usb/quirks-table.h                           |   58 ++
 tools/arch/x86/kcpuid/cpuid.csv                    |    4 +-
 tools/bpf/bpftool/json_writer.c                    |    3 -
 tools/bpf/bpftool/xlated_dumper.c                  |    7 +
 tools/include/uapi/linux/bpf.h                     |   11 +
 tools/lib/bpf/gen_loader.c                         |   10 +-
 tools/objtool/check.c                              |   11 -
 tools/perf/util/auxtrace.c                         |    5 +-
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |    2 +
 tools/testing/selftests/bpf/network_helpers.c      |    2 +-
 tools/testing/selftests/bpf/prog_tests/align.c     |    4 +-
 .../selftests/bpf/prog_tests/cg_storage_multi.c    |    8 +-
 .../bpf/prog_tests/get_stackid_cannot_attach.c     |    1 +
 .../testing/selftests/bpf/prog_tests/linked_list.c |   14 +-
 .../selftests/bpf/prog_tests/perf_event_stackmap.c |    3 +-
 .../bpf/prog_tests/stacktrace_build_id_nmi.c       |   15 -
 tools/testing/selftests/bpf/progs/linked_list.c    |    2 +-
 .../testing/selftests/bpf/progs/linked_list_fail.c |  100 +-
 tools/testing/selftests/bpf/test_xsk.sh            |    1 +
 tools/testing/selftests/bpf/testing_helpers.c      |   20 +
 tools/testing/selftests/bpf/testing_helpers.h      |    2 +
 tools/testing/selftests/bpf/xskxceiver.c           |   19 +-
 tools/testing/selftests/bpf/xskxceiver.h           |    1 -
 .../selftests/mount_setattr/mount_setattr_test.c   |    1 +
 .../mmcra_thresh_marked_sample_test.c              |    4 +-
 tools/testing/selftests/resctrl/cache.c            |    4 +-
 tools/testing/selftests/resctrl/cat_test.c         |    2 +-
 tools/testing/selftests/resctrl/cmt_test.c         |    2 +-
 tools/testing/selftests/resctrl/fill_buf.c         |    2 +
 tools/testing/selftests/resctrl/mba_test.c         |    9 +-
 tools/testing/selftests/resctrl/mbm_test.c         |    2 +-
 tools/testing/selftests/resctrl/resctrl.h          |    2 +
 tools/testing/selftests/resctrl/resctrl_val.c      |   21 +-
 .../selftests/tc-testing/tc-tests/qdiscs/fq.json   |   22 +
 tools/testing/selftests/user_events/ftrace_test.c  |    5 +
 tools/verification/rv/src/rv.c                     |    2 +-
 804 files changed, 9115 insertions(+), 7189 deletions(-)
author maintainer
#32 lore raw

PATCH 32/663 usb: gadget: udc: core: Invoke usb_gadget_connect only when started

From: Badhri Jagan Sridharan <[email protected]>

commit 0db213ea8eed5534a5169e807f28103cbc9d23df upstream.

usb_udc_connect_control does not check to see if the udc has already been started. This causes gadget->ops->pullup to be called through usb_gadget_connect when invoked from usb_udc_vbus_handler even before usb_gadget_udc_start is called. Guard this by checking for udc->started in usb_udc_connect_control before invoking usb_gadget_connect.

Guarding udc->vbus, udc->started, gadget->connect, gadget->deactivate related functions with connect_lock. usb_gadget_connect_locked, usb_gadget_disconnect_locked, usb_udc_connect_control_locked, usb_gadget_udc_start_locked, usb_gadget_udc_stop_locked are called with this lock held as they can be simulataneously invoked from different code paths.

Adding an additional check to make sure udc is started(udc->started) before pullup callback is invoked.

---
 drivers/usb/gadget/udc/core.c |  148 +++++++++++++++++++++++++++++-------------
 1 file changed, 104 insertions(+), 44 deletions(-)
drivers/usb/gadget/udc/core.c +104 -44
@@ -37,6 +37,10 @@ static struct bus_type gadget_bus_type;
  * @vbus: for udcs who care about vbus status, this value is real vbus status;
  * for udcs who do not care about vbus status, this value is always true
  * @started: the UDC's started state. True if the UDC had started.
+ * @connect_lock: protects udc->vbus, udc->started, gadget->connect, gadget->deactivate related
+ * functions. usb_gadget_connect_locked, usb_gadget_disconnect_locked,
+ * usb_udc_connect_control_locked, usb_gadget_udc_start_locked, usb_gadget_udc_stop_locked are
+ * called with this lock held.
  *
  * This represents the internal data structure which is used by the UDC-class
  * to hold information about udc driver and gadget together.
@@ -48,6 +52,7 @@ struct usb_udc {
 	struct list_head		list;
 	bool				vbus;
 	bool				started;
+	struct mutex			connect_lock;
 };
 
 static struct class *udc_class;
@@ -660,17 +665,9 @@ out:
 }
 EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect);
 
-/**
- * usb_gadget_connect - software-controlled connect to USB host
- * @gadget:the peripheral being connected
- *
- * Enables the D+ (or potentially D-) pullup.  The host will start
- * enumerating this gadget when the pullup is active and a VBUS session
- * is active (the link is powered).
- *
- * Returns zero on success, else negative errno.
- */
-int usb_gadget_connect(struct usb_gadget *gadget)
+/* Internal version of usb_gadget_connect needs to be called with connect_lock held. */
+static int usb_gadget_connect_locked(struct usb_gadget *gadget)
+	__must_hold(&gadget->udc->connect_lock)
 {
 	int ret = 0;
 
@@ -679,10 +676,12 @@ int usb_gadget_connect(struct usb_gadget
 		goto out;
 	}
 
-	if (gadget->deactivated) {
+	if (gadget->deactivated || !gadget->udc->started) {
 		/*
 		 * If gadget is deactivated we only save new state.
 		 * Gadget will be connected automatically after activation.
+		 *
+		 * udc first needs to be started before gadget can be pulled up.
 		 */
 		gadget->connected = true;
 		goto out;
@@ -697,22 +696,32 @@ out:
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(usb_gadget_connect);
 
 /**
- * usb_gadget_disconnect - software-controlled disconnect from USB host
- * @gadget:the peripheral being disconnected
- *
- * Disables the D+ (or potentially D-) pullup, which the host may see
- * as a disconnect (when a VBUS session is active).  Not all systems
- * support software pullup controls.
+ * usb_gadget_connect - software-controlled connect to USB host
+ * @gadget:the peripheral being connected
  *
- * Following a successful disconnect, invoke the ->disconnect() callback
- * for the current gadget driver so that UDC drivers don't need to.
+ * Enables the D+ (or potentially D-) pullup.  The host will start
+ * enumerating this gadget when the pullup is active and a VBUS session
+ * is active (the link is powered).
  *
  * Returns zero on success, else negative errno.
  */
-int usb_gadget_disconnect(struct usb_gadget *gadget)
+int usb_gadget_connect(struct usb_gadget *gadget)
+{
+	int ret;
+
+	mutex_lock(&gadget->udc->connect_lock);
+	ret = usb_gadget_connect_locked(gadget);
+	mutex_unlock(&gadget->udc->connect_lock);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(usb_gadget_connect);
+
+/* Internal version of usb_gadget_disconnect needs to be called with connect_lock held. */
+static int usb_gadget_disconnect_locked(struct usb_gadget *gadget)
+	__must_hold(&gadget->udc->connect_lock)
 {
 	int ret = 0;
 
@@ -724,10 +733,12 @@ int usb_gadget_disconnect(struct usb_gad
 	if (!gadget->connected)
 		goto out;
 
-	if (gadget->deactivated) {
+	if (gadget->deactivated || !gadget->udc->started) {
 		/*
 		 * If gadget is deactivated we only save new state.
 		 * Gadget will stay disconnected after activation.
+		 *
+		 * udc should have been started before gadget being pulled down.
 		 */
 		gadget->connected = false;
 		goto out;
@@ -747,6 +758,30 @@ out:
 
 	return ret;
 }
+
+/**
+ * usb_gadget_disconnect - software-controlled disconnect from USB host
+ * @gadget:the peripheral being disconnected
+ *
+ * Disables the D+ (or potentially D-) pullup, which the host may see
+ * as a disconnect (when a VBUS session is active).  Not all systems
+ * support software pullup controls.
+ *
+ * Following a successful disconnect, invoke the ->disconnect() callback
+ * for the current gadget driver so that UDC drivers don't need to.
+ *
+ * Returns zero on success, else negative errno.
+ */
+int usb_gadget_disconnect(struct usb_gadget *gadget)
+{
+	int ret;
+
+	mutex_lock(&gadget->udc->connect_lock);
+	ret = usb_gadget_disconnect_locked(gadget);
+	mutex_unlock(&gadget->udc->connect_lock);
+
+	return ret;
+}
 EXPORT_SYMBOL_GPL(usb_gadget_disconnect);
 
 /**
@@ -767,10 +802,11 @@ int usb_gadget_deactivate(struct usb_gad
 	if (gadget->deactivated)
 		goto out;
 
+	mutex_lock(&gadget->udc->connect_lock);
 	if (gadget->connected) {
-		ret = usb_gadget_disconnect(gadget);
+		ret = usb_gadget_disconnect_locked(gadget);
 		if (ret)
-			goto out;
+			goto unlock;
 
 		/*
 		 * If gadget was being connected before deactivation, we want
@@ -780,6 +816,8 @@ int usb_gadget_deactivate(struct usb_gad
 	}
 	gadget->deactivated = true;
 
+unlock:
+	mutex_unlock(&gadget->udc->connect_lock);
 out:
 	trace_usb_gadget_deactivate(gadget, ret);
 
@@ -803,6 +841,7 @@ int usb_gadget_activate(struct usb_gadge
 	if (!gadget->deactivated)
 		goto out;
 
+	mutex_lock(&gadget->udc->connect_lock);
 	gadget->deactivated = false;
 
 	/*
@@ -810,7 +849,8 @@ int usb_gadget_activate(struct usb_gadge
 	 * while it was being deactivated, we call usb_gadget_connect().
 	 */
 	if (gadget->connected)
-		ret = usb_gadget_connect(gadget);
+		ret = usb_gadget_connect_locked(gadget);
+	mutex_unlock(&gadget->udc->connect_lock);
 
 out:
 	trace_usb_gadget_activate(gadget, ret);
@@ -1051,12 +1091,13 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
 /* ------------------------------------------------------------------------- */
 
-static void usb_udc_connect_control(struct usb_udc *udc)
+/* Acquire connect_lock before calling this function. */
+static void usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock)
 {
-	if (udc->vbus)
-		usb_gadget_connect(udc->gadget);
+	if (udc->vbus && udc->started)
+		usb_gadget_connect_locked(udc->gadget);
 	else
-		usb_gadget_disconnect(udc->gadget);
+		usb_gadget_disconnect_locked(udc->gadget);
 }
 
 /**
@@ -1072,10 +1113,12 @@ void usb_udc_vbus_handler(struct usb_gad
 {
 	struct usb_udc *udc = gadget->udc;
 
+	mutex_lock(&udc->connect_lock);
 	if (udc) {
 		udc->vbus = status;
-		usb_udc_connect_control(udc);
+		usb_udc_connect_control_locked(udc);
 	}
+	mutex_unlock(&udc->connect_lock);
 }
 EXPORT_SYMBOL_GPL(usb_udc_vbus_handler);
 
@@ -1097,7 +1140,7 @@ void usb_gadget_udc_reset(struct usb_gad
 EXPORT_SYMBOL_GPL(usb_gadget_udc_reset);
 
 /**
- * usb_gadget_udc_start - tells usb device controller to start up
+ * usb_gadget_udc_start_locked - tells usb device controller to start up
  * @udc: The UDC to be started
  *
  * This call is issued by the UDC Class driver when it's about
@@ -1108,8 +1151,11 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset);
  * necessary to have it powered on.
  *
  * Returns zero on success, else negative errno.
+ *
+ * Caller should acquire connect_lock before invoking this function.
  */
-static inline int usb_gadget_udc_start(struct usb_udc *udc)
+static inline int usb_gadget_udc_start_locked(struct usb_udc *udc)
+	__must_hold(&udc->connect_lock)
 {
 	int ret;
 
@@ -1126,7 +1172,7 @@ static inline int usb_gadget_udc_start(s
 }
 
 /**
- * usb_gadget_udc_stop - tells usb device controller we don't need it anymore
+ * usb_gadget_udc_stop_locked - tells usb device controller we don't need it anymore
  * @udc: The UDC to be stopped
  *
  * This call is issued by the UDC Class driver after calling
@@ -1135,8 +1181,11 @@ static inline int usb_gadget_udc_start(s
  * The details are implementation specific, but it can go as
  * far as powering off UDC completely and disable its data
  * line pullups.
+ *
+ * Caller should acquire connect lock before invoking this function.
  */
-static inline void usb_gadget_udc_stop(struct usb_udc *udc)
+static inline void usb_gadget_udc_stop_locked(struct usb_udc *udc)
+	__must_hold(&udc->connect_lock)
 {
 	if (!udc->started) {
 		dev_err(&udc->dev, "UDC had already stopped\n");
@@ -1295,6 +1344,7 @@ int usb_add_gadget(struct usb_gadget *ga
 
 	udc->gadget = gadget;
 	gadget->udc = udc;
+	mutex_init(&udc->connect_lock);
 
 	udc->started = false;
 
@@ -1496,11 +1546,15 @@ static int gadget_bind_driver(struct dev
 	if (ret)
 		goto err_bind;
 
-	ret = usb_gadget_udc_start(udc);
-	if (ret)
+	mutex_lock(&udc->connect_lock);
+	ret = usb_gadget_udc_start_locked(udc);
+	if (ret) {
+		mutex_unlock(&udc->connect_lock);
 		goto err_start;
+	}
 	usb_gadget_enable_async_callbacks(udc);
-	usb_udc_connect_control(udc);
+	usb_udc_connect_control_locked(udc);
+	mutex_unlock(&udc->connect_lock);
 
 	kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
 	return 0;
@@ -1531,12 +1585,14 @@ static void gadget_unbind_driver(struct
 
 	kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
 
-	usb_gadget_disconnect(gadget);
+	mutex_lock(&udc->connect_lock);
+	usb_gadget_disconnect_locked(gadget);
 	usb_gadget_disable_async_callbacks(udc);
 	if (gadget->irq)
 		synchronize_irq(gadget->irq);
 	udc->driver->unbind(gadget);
-	usb_gadget_udc_stop(udc);
+	usb_gadget_udc_stop_locked(udc);
+	mutex_unlock(&udc->connect_lock);
 
 	mutex_lock(&udc_lock);
 	driver->is_bound = false;
@@ -1622,11 +1678,15 @@ static ssize_t soft_connect_store(struct
 	}
 
 	if (sysfs_streq(buf, "connect")) {
-		usb_gadget_udc_start(udc);
-		usb_gadget_connect(udc->gadget);
+		mutex_lock(&udc->connect_lock);
+		usb_gadget_udc_start_locked(udc);
+		usb_gadget_connect_locked(udc->gadget);
+		mutex_unlock(&udc->connect_lock);
 	} else if (sysfs_streq(buf, "disconnect")) {
-		usb_gadget_disconnect(udc->gadget);
-		usb_gadget_udc_stop(udc);
+		mutex_lock(&udc->connect_lock);
+		usb_gadget_disconnect_locked(udc->gadget);
+		usb_gadget_udc_stop_locked(udc);
+		mutex_unlock(&udc->connect_lock);
 	} else {
 		dev_err(dev, "unsupported command '%s'\n", buf);
 		ret = -EINVAL;
author maintainer
#41 lore raw

PATCH 41/663 media: ov8856: Do not check for for module version

In reply to Greg Kroah-Hartman

From: Ricardo Ribalda <[email protected]>

commit 5a4e1b5aed2a36a10d6a3b30fafb6b3bf41c3186 upstream.

It the device is probed in non-zero ACPI D state, the module identification is delayed until the first streamon.

The module identification has two parts: deviceID and version. To rea the version we have to enable OTP read. This cannot be done during streamon, becase it modifies REG_MODE_SELECT.

Since the driver has the same behaviour for all the module versions, do not read the module version from the sensor's OTP.

Fixes 0e014f1a8d54 ("media: ov8856: support device probe in non-zero ACPI D state")
---
 drivers/media/i2c/ov8856.c |   40 ----------------------------------------
 1 file changed, 40 deletions(-)
drivers/media/i2c/ov8856.c +0 -40
@@ -1709,46 +1709,6 @@ static int ov8856_identify_module(struct
 		return -ENXIO;
 	}
 
-	ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
-			       OV8856_REG_VALUE_08BIT, OV8856_MODE_STREAMING);
-	if (ret)
-		return ret;
-
-	ret = ov8856_write_reg(ov8856, OV8856_OTP_MODE_CTRL,
-			       OV8856_REG_VALUE_08BIT, OV8856_OTP_MODE_AUTO);
-	if (ret) {
-		dev_err(&client->dev, "failed to set otp mode");
-		return ret;
-	}
-
-	ret = ov8856_write_reg(ov8856, OV8856_OTP_LOAD_CTRL,
-			       OV8856_REG_VALUE_08BIT,
-			       OV8856_OTP_LOAD_CTRL_ENABLE);
-	if (ret) {
-		dev_err(&client->dev, "failed to enable load control");
-		return ret;
-	}
-
-	ret = ov8856_read_reg(ov8856, OV8856_MODULE_REVISION,
-			      OV8856_REG_VALUE_08BIT, &val);
-	if (ret) {
-		dev_err(&client->dev, "failed to read module revision");
-		return ret;
-	}
-
-	dev_info(&client->dev, "OV8856 revision %x (%s) at address 0x%02x\n",
-		 val,
-		 val == OV8856_2A_MODULE ? "2A" :
-		 val == OV8856_1B_MODULE ? "1B" : "unknown revision",
-		 client->addr);
-
-	ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
-			       OV8856_REG_VALUE_08BIT, OV8856_MODE_STANDBY);
-	if (ret) {
-		dev_err(&client->dev, "failed to exit streaming mode");
-		return ret;
-	}
-
 	ov8856->identified = true;
 
 	return 0;
author maintainer
#42 lore raw

PATCH 42/663 drm/vmwgfx: Fix Legacy Display Unit atomic drm support

In reply to Greg Kroah-Hartman

From: Martin Krastev <[email protected]>

commit a37a512db3fa1b65fe9087003e5b2072cefb3667 upstream.

Legacy Display Unit (LDU) fb dirty support used a custom fb dirty callback. Latter handled only the DIRTYFB IOCTL presentation path but not the ADDFB2/PAGE_FLIP/RMFB IOCTL path, common for Wayland compositors.

Get rid of the custom callback in favor of drm_atomic_helper_dirtyfb and unify the handling of the presentation paths inside of vmw_ldu_primary_plane_atomic_update. This also homogenizes the fb dirty callbacks across all DUs: LDU, SOU and STDU.

Fixes 2f5544ff0300 ("drm/vmwgfx: Use atomic helper function for dirty fb IOCTL")
Cc <[email protected]> # v5.0+
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   62 ------------------------------------
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |    5 --
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |   45 +++++++++++++++++++++-----
 3 files changed, 38 insertions(+), 74 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -61
@@ -1420,70 +1420,10 @@ static void vmw_framebuffer_bo_destroy(s
 	kfree(vfbd);
 }
 
-static int vmw_framebuffer_bo_dirty(struct drm_framebuffer *framebuffer,
-				    struct drm_file *file_priv,
-				    unsigned int flags, unsigned int color,
-				    struct drm_clip_rect *clips,
-				    unsigned int num_clips)
-{
-	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
-	struct vmw_framebuffer_bo *vfbd =
-		vmw_framebuffer_to_vfbd(framebuffer);
-	struct drm_clip_rect norect;
-	int ret, increment = 1;
-
-	drm_modeset_lock_all(&dev_priv->drm);
-
-	if (!num_clips) {
-		num_clips = 1;
-		clips = &norect;
-		norect.x1 = norect.y1 = 0;
-		norect.x2 = framebuffer->width;
-		norect.y2 = framebuffer->height;
-	} else if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY) {
-		num_clips /= 2;
-		increment = 2;
-	}
-
-	switch (dev_priv->active_display_unit) {
-	case vmw_du_legacy:
-		ret = vmw_kms_ldu_do_bo_dirty(dev_priv, &vfbd->base, 0, 0,
-					      clips, num_clips, increment);
-		break;
-	default:
-		ret = -EINVAL;
-		WARN_ONCE(true, "Dirty called with invalid display system.\n");
-		break;
-	}
-
-	vmw_cmd_flush(dev_priv, false);
-
-	drm_modeset_unlock_all(&dev_priv->drm);
-
-	return ret;
-}
-
-static int vmw_framebuffer_bo_dirty_ext(struct drm_framebuffer *framebuffer,
-					struct drm_file *file_priv,
-					unsigned int flags, unsigned int color,
-					struct drm_clip_rect *clips,
-					unsigned int num_clips)
-{
-	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
-
-	if (dev_priv->active_display_unit == vmw_du_legacy &&
-	    vmw_cmd_supported(dev_priv))
-		return vmw_framebuffer_bo_dirty(framebuffer, file_priv, flags,
-						color, clips, num_clips);
-
-	return drm_atomic_helper_dirtyfb(framebuffer, file_priv, flags, color,
-					 clips, num_clips);
-}
-
 static const struct drm_framebuffer_funcs vmw_framebuffer_bo_funcs = {
 	.create_handle = vmw_framebuffer_bo_create_handle,
 	.destroy = vmw_framebuffer_bo_destroy,
-	.dirty = vmw_framebuffer_bo_dirty_ext,
+	.dirty = drm_atomic_helper_dirtyfb,
 };
 
 /*
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +0 -5
@@ -512,11 +512,6 @@ void vmw_du_connector_destroy_state(stru
  */
 int vmw_kms_ldu_init_display(struct vmw_private *dev_priv);
 int vmw_kms_ldu_close_display(struct vmw_private *dev_priv);
-int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
-			    struct vmw_framebuffer *framebuffer,
-			    unsigned int flags, unsigned int color,
-			    struct drm_clip_rect *clips,
-			    unsigned int num_clips, int increment);
 int vmw_kms_update_proxy(struct vmw_resource *res,
 			 const struct drm_clip_rect *clips,
 			 unsigned num_clips,
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +37 -8

82 lines not on this page · raw message

author maintainer
#43 lore raw

PATCH 43/663 blk-stat: fix QUEUE_FLAG_STATS clear

In reply to Greg Kroah-Hartman

From: Chengming Zhou <[email protected]>

commit 20de765f6d9da0c47b756429c60b41063b990a10 upstream.

We need to set QUEUE_FLAG_STATS for two cases:
1. blk_stat_enable_accounting()
2. blk_stat_add_callback()

So we should clear it only when ((q->stats->accounting == 0) && list_empty(&q->stats->callbacks)).

blk_stat_disable_accounting() only check if q->stats->accounting is 0 before clear the flag, this patch fix it.

Also add list_empty(&q->stats->callbacks)) check when enable, or the flag is already set.

The bug can be reproduced on kernel without BLK_DEV_THROTTLING (since it unconditionally enable accounting, see the next patch).

  # cat /sys/block/sr0/queue/scheduler
  none mq-deadline [bfq]
  # cat /sys/kernel/debug/block/sr0/state
  SAME_COMP|IO_STAT|INIT_DONE|STATS|REGISTERED|NOWAIT|30
  # echo none > /sys/block/sr0/queue/scheduler
  # cat /sys/kernel/debug/block/sr0/state
  SAME_COMP|IO_STAT|INIT_DONE|REGISTERED|NOWAIT
  # cat /sys/block/sr0/queue/wbt_lat_usec
  75000

We can see that after changing elevator from "bfq" to "none", "STATS" flag is lost even though WBT callback still need it.

Fixes 68497092bde9 ("block: make queue stat accounting a reference")
Cc <[email protected]> # v5.17+
---
 block/blk-stat.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-stat.c +2 -2
@@ -189,7 +189,7 @@ void blk_stat_disable_accounting(struct
 	unsigned long flags;
 
 	spin_lock_irqsave(&q->stats->lock, flags);
-	if (!--q->stats->accounting)
+	if (!--q->stats->accounting && list_empty(&q->stats->callbacks))
 		blk_queue_flag_clear(QUEUE_FLAG_STATS, q);
 	spin_unlock_irqrestore(&q->stats->lock, flags);
 }
@@ -200,7 +200,7 @@ void blk_stat_enable_accounting(struct r
 	unsigned long flags;
 
 	spin_lock_irqsave(&q->stats->lock, flags);
-	if (!q->stats->accounting++)
+	if (!q->stats->accounting++ && list_empty(&q->stats->callbacks))
 		blk_queue_flag_set(QUEUE_FLAG_STATS, q);
 	spin_unlock_irqrestore(&q->stats->lock, flags);
 }
author maintainer
#44 lore raw

PATCH 44/663 blk-mq: release crypto keyslot before reporting I/O complete

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

commit 9cd1e566676bbcb8a126acd921e4e194e6339603 upstream.

Once all I/O using a blk_crypto_key has completed, filesystems can call blk_crypto_evict_key(). However, the block layer currently doesn't call blk_crypto_put_keyslot() until the request is being freed, which happens after upper layers have been told (via bio_endio()) the I/O has completed. This causes a race condition where blk_crypto_evict_key() can see 'slot_refs != 0' without there being an actual bug.

This makes __blk_crypto_evict_key() hit the 'WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)' and return without doing anything, eventually causing a use-after-free in blk_crypto_reprogram_all_keys(). (This is a very rare bug and has only been seen when per-file keys are being used with fscrypt.)

There are two options to fix this: either release the keyslot before bio_endio() is called on the request's last bio, or make __blk_crypto_evict_key() ignore slot_refs. Let's go with the first solution, since it preserves the ability to report bugs (via WARN_ON_ONCE) where a key is evicted while still in-use.

---
 block/blk-crypto-internal.h |   25 +++++++++++++++++++++----
 block/blk-crypto.c          |   24 ++++++++++++------------
 block/blk-merge.c           |    2 ++
 block/blk-mq.c              |   15 ++++++++++++++-
 4 files changed, 49 insertions(+), 17 deletions(-)
block/blk-crypto-internal.h +21 -4
@@ -65,6 +65,11 @@ static inline bool blk_crypto_rq_is_encr
 	return rq->crypt_ctx;
 }
 
+static inline bool blk_crypto_rq_has_keyslot(struct request *rq)
+{
+	return rq->crypt_keyslot;
+}
+
 blk_status_t blk_crypto_get_keyslot(struct blk_crypto_profile *profile,
 				    const struct blk_crypto_key *key,
 				    struct blk_crypto_keyslot **slot_ptr);
@@ -119,6 +124,11 @@ static inline bool blk_crypto_rq_is_encr
 	return false;
 }
 
+static inline bool blk_crypto_rq_has_keyslot(struct request *rq)
+{
+	return false;
+}
+
 #endif /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 void __bio_crypt_advance(struct bio *bio, unsigned int bytes);
@@ -153,14 +163,21 @@ static inline bool blk_crypto_bio_prep(s
 	return true;
 }
 
-blk_status_t __blk_crypto_init_request(struct request *rq);
-static inline blk_status_t blk_crypto_init_request(struct request *rq)
+blk_status_t __blk_crypto_rq_get_keyslot(struct request *rq);
+static inline blk_status_t blk_crypto_rq_get_keyslot(struct request *rq)
 {
 	if (blk_crypto_rq_is_encrypted(rq))
-		return __blk_crypto_init_request(rq);
+		return __blk_crypto_rq_get_keyslot(rq);
 	return BLK_STS_OK;
 }
 
+void __blk_crypto_rq_put_keyslot(struct request *rq);
+static inline void blk_crypto_rq_put_keyslot(struct request *rq)
+{
+	if (blk_crypto_rq_has_keyslot(rq))
+		__blk_crypto_rq_put_keyslot(rq);
+}
+
 void __blk_crypto_free_request(struct request *rq);
 static inline void blk_crypto_free_request(struct request *rq)
 {
@@ -199,7 +216,7 @@ static inline blk_status_t blk_crypto_in
 {
 
 	if (blk_crypto_rq_is_encrypted(rq))
-		return blk_crypto_init_request(rq);
+		return blk_crypto_rq_get_keyslot(rq);
 	return BLK_STS_OK;
 }
 
block/blk-crypto.c +12 -12
@@ -224,27 +224,27 @@ static bool bio_crypt_check_alignment(st
 	return true;
 }
 
-blk_status_t __blk_crypto_init_request(struct request *rq)
+blk_status_t __blk_crypto_rq_get_keyslot(struct request *rq)
 {
 	return blk_crypto_get_keyslot(rq->q->crypto_profile,
 				      rq->crypt_ctx->bc_key,
 				      &rq->crypt_keyslot);
 }
 
-/**
- * __blk_crypto_free_request - Uninitialize the crypto fields of a request.
- *
- * @rq: The request whose crypto fields to uninitialize.
- *
- * Completely uninitializes the crypto fields of a request. If a keyslot has
- * been programmed into some inline encryption hardware, that keyslot is
- * released. The rq->crypt_ctx is also freed.
- */
-void __blk_crypto_free_request(struct request *rq)
+void __blk_crypto_rq_put_keyslot(struct request *rq)
 {
 	blk_crypto_put_keyslot(rq->crypt_keyslot);
+	rq->crypt_keyslot = NULL;
+}
+
+void __blk_crypto_free_request(struct request *rq)
+{
+	/* The keyslot, if one was needed, should have been released earlier. */
+	if (WARN_ON_ONCE(rq->crypt_keyslot))
+		__blk_crypto_rq_put_keyslot(rq);
+
 	mempool_free(rq->crypt_ctx, bio_crypt_ctx_pool);
-	blk_crypto_rq_set_defaults(rq);
+	rq->crypt_ctx = NULL;
 }
 
 /**
block/blk-merge.c +2 -0
@@ -873,6 +873,8 @@ static struct request *attempt_merge(str
 	if (!blk_discard_mergable(req))
 		elv_merge_requests(q, req, next);
 
+	blk_crypto_rq_put_keyslot(next);
+
 	/*
 	 * 'next' is going away, so update stats accordingly
 	 */
block/blk-mq.c +14 -1
@@ -840,6 +840,12 @@ static void blk_complete_request(struct
 		req->q->integrity.profile->complete_fn(req, total_bytes);
 #endif
 
+	/*
+	 * Upper layers may call blk_crypto_evict_key() anytime after the last
+	 * bio_endio().  Therefore, the keyslot must be released before that.
+	 */
+	blk_crypto_rq_put_keyslot(req);
+
 	blk_account_io_completion(req, total_bytes);
 
 	do {
@@ -905,6 +911,13 @@ bool blk_update_request(struct request *
 		req->q->integrity.profile->complete_fn(req, nr_bytes);
 #endif
 
+	/*
+	 * Upper layers may call blk_crypto_evict_key() anytime after the last
+	 * bio_endio().  Therefore, the keyslot must be released before that.
+	 */
+	if (blk_crypto_rq_has_keyslot(req) && nr_bytes >= blk_rq_bytes(req))
+		__blk_crypto_rq_put_keyslot(req);
+
 	if (unlikely(error && !blk_rq_is_passthrough(req) &&
 		     !(req->rq_flags & RQF_QUIET)) &&
 		     !test_bit(GD_DEAD, &req->q->disk->state)) {
@@ -2987,7 +3000,7 @@ void blk_mq_submit_bio(struct bio *bio)
 
 	blk_mq_bio_to_request(rq, bio, nr_segs);
 
-	ret = blk_crypto_init_request(rq);
+	ret = blk_crypto_rq_get_keyslot(rq);
 	if (ret != BLK_STS_OK) {
 		bio->bi_status = ret;
 		bio_endio(bio);
author maintainer
#45 lore raw

PATCH 45/663 blk-crypto: make blk_crypto_evict_key() return void

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

commit 70493a63ba04f754f7a7dd53a4fcc82700181490 upstream.

blk_crypto_evict_key() is only called in contexts such as inode eviction where failure is not an option. So there is nothing the caller can do with errors except log them. (dm-table.c does "use" the error code, but only to pass on to upper layers, so it doesn't really count.)

Just make blk_crypto_evict_key() return void and log errors itself.

---
 block/blk-crypto.c         |   20 +++++++++-----------
 drivers/md/dm-table.c      |   19 +++++--------------
 include/linux/blk-crypto.h |    4 ++--
 3 files changed, 16 insertions(+), 27 deletions(-)
block/blk-crypto.c +9 -11
@@ -13,6 +13,7 @@
 #include <linux/blkdev.h>
 #include <linux/blk-crypto-profile.h>
 #include <linux/module.h>
+#include <linux/ratelimit.h>
 #include <linux/slab.h>
 
 #include "blk-crypto-internal.h"
@@ -408,21 +409,18 @@ int blk_crypto_start_using_key(struct bl
  * Upper layers (filesystems) must call this function to ensure that a key is
  * evicted from any hardware that it might have been programmed into.  The key
  * must not be in use by any in-flight IO when this function is called.
- *
- * Return: 0 on success or if the key wasn't in any keyslot; -errno on error.
  */
-int blk_crypto_evict_key(struct block_device *bdev,
-			 const struct blk_crypto_key *key)
+void blk_crypto_evict_key(struct block_device *bdev,
+			  const struct blk_crypto_key *key)
 {
 	struct request_queue *q = bdev_get_queue(bdev);
+	int err;
 
 	if (blk_crypto_config_supported_natively(bdev, &key->crypto_cfg))
-		return __blk_crypto_evict_key(q->crypto_profile, key);
-
-	/*
-	 * If the block_device didn't support the key, then blk-crypto-fallback
-	 * may have been used, so try to evict the key from blk-crypto-fallback.
-	 */
-	return blk_crypto_fallback_evict_key(key);
+		err = __blk_crypto_evict_key(q->crypto_profile, key);
+	else
+		err = blk_crypto_fallback_evict_key(key);
+	if (err)
+		pr_warn_ratelimited("%pg: error %d evicting key\n", bdev, err);
 }
 EXPORT_SYMBOL_GPL(blk_crypto_evict_key);
drivers/md/dm-table.c +5 -14
@@ -1203,21 +1203,12 @@ struct dm_crypto_profile {
 	struct mapped_device *md;
 };
 
-struct dm_keyslot_evict_args {
-	const struct blk_crypto_key *key;
-	int err;
-};
-
 static int dm_keyslot_evict_callback(struct dm_target *ti, struct dm_dev *dev,
 				     sector_t start, sector_t len, void *data)
 {
-	struct dm_keyslot_evict_args *args = data;
-	int err;
+	const struct blk_crypto_key *key = data;
 
-	err = blk_crypto_evict_key(dev->bdev, args->key);
-	if (!args->err)
-		args->err = err;
-	/* Always try to evict the key from all devices. */
+	blk_crypto_evict_key(dev->bdev, key);
 	return 0;
 }
 
@@ -1230,7 +1221,6 @@ static int dm_keyslot_evict(struct blk_c
 {
 	struct mapped_device *md =
 		container_of(profile, struct dm_crypto_profile, profile)->md;
-	struct dm_keyslot_evict_args args = { key };
 	struct dm_table *t;
 	int srcu_idx;
 
@@ -1243,11 +1233,12 @@ static int dm_keyslot_evict(struct blk_c
 
 		if (!ti->type->iterate_devices)
 			continue;
-		ti->type->iterate_devices(ti, dm_keyslot_evict_callback, &args);
+		ti->type->iterate_devices(ti, dm_keyslot_evict_callback,
+					  (void *)key);
 	}
 
 	dm_put_live_table(md, srcu_idx);
-	return args.err;
+	return 0;
 }
 
 static int
include/linux/blk-crypto.h +2 -2
@@ -95,8 +95,8 @@ int blk_crypto_init_key(struct blk_crypt
 int blk_crypto_start_using_key(struct block_device *bdev,
 			       const struct blk_crypto_key *key);
 
-int blk_crypto_evict_key(struct block_device *bdev,
-			 const struct blk_crypto_key *key);
+void blk_crypto_evict_key(struct block_device *bdev,
+			  const struct blk_crypto_key *key);
 
 bool blk_crypto_config_supported_natively(struct block_device *bdev,
 					  const struct blk_crypto_config *cfg);
author maintainer
#46 lore raw

PATCH 46/663 blk-crypto: make blk_crypto_evict_key() more robust

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

commit 5c7cb94452901a93e90c2230632e2c12a681bc92 upstream.

If blk_crypto_evict_key() sees that the key is still in-use (due to a bug) or that ->keyslot_evict failed, it currently just returns while leaving the key linked into the keyslot management structures.

However, blk_crypto_evict_key() is only called in contexts such as inode eviction where failure is not an option. So actually the caller proceeds with freeing the blk_crypto_key regardless of the return value of blk_crypto_evict_key().

These two assumptions don't match, and the result is that there can be a use-after-free in blk_crypto_reprogram_all_keys() after one of these errors occurs. (Note, these errors *shouldn't* happen; we're just talking about what happens if they do anyway.)

Fix this by making blk_crypto_evict_key() unlink the key from the keyslot management structures even on failure.

Also improve some comments.

---
 block/blk-crypto-profile.c |   46 ++++++++++++++++++++-------------------------
 block/blk-crypto.c         |   28 +++++++++++++++++++--------
 2 files changed, 41 insertions(+), 33 deletions(-)
block/blk-crypto-profile.c +21 -25
@@ -354,28 +354,16 @@ bool __blk_crypto_cfg_supported(struct b
 	return true;
 }
 
-/**
- * __blk_crypto_evict_key() - Evict a key from a device.
- * @profile: the crypto profile of the device
- * @key: the key to evict.  It must not still be used in any I/O.
- *
- * If the device has keyslots, this finds the keyslot (if any) that contains the
- * specified key and calls the driver's keyslot_evict function to evict it.
- *
- * Otherwise, this just calls the driver's keyslot_evict function if it is
- * implemented, passing just the key (without any particular keyslot).  This
- * allows layered devices to evict the key from their underlying devices.
- *
- * Context: Process context. Takes and releases profile->lock.
- * Return: 0 on success or if there's no keyslot with the specified key, -EBUSY
- *	   if the keyslot is still in use, or another -errno value on other
- *	   error.
+/*
+ * This is an internal function that evicts a key from an inline encryption
+ * device that can be either a real device or the blk-crypto-fallback "device".
+ * It is used only by blk_crypto_evict_key(); see that function for details.
  */
 int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
 			   const struct blk_crypto_key *key)
 {
 	struct blk_crypto_keyslot *slot;
-	int err = 0;
+	int err;
 
 	if (profile->num_slots == 0) {
 		if (profile->ll_ops.keyslot_evict) {
@@ -389,22 +377,30 @@ int __blk_crypto_evict_key(struct blk_cr
 
 	blk_crypto_hw_enter(profile);
 	slot = blk_crypto_find_keyslot(profile, key);
-	if (!slot)
-		goto out_unlock;
+	if (!slot) {
+		/*
+		 * Not an error, since a key not in use by I/O is not guaranteed
+		 * to be in a keyslot.  There can be more keys than keyslots.
+		 */
+		err = 0;
+		goto out;
+	}
 
 	if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) {
+		/* BUG: key is still in use by I/O */
 		err = -EBUSY;
-		goto out_unlock;
+		goto out_remove;
 	}
 	err = profile->ll_ops.keyslot_evict(profile, key,
 					    blk_crypto_keyslot_index(slot));
-	if (err)
-		goto out_unlock;
-
+out_remove:
+	/*
+	 * Callers free the key even on error, so unlink the key from the hash
+	 * table and clear slot->key even on error.
+	 */
 	hlist_del(&slot->hash_node);
 	slot->key = NULL;
-	err = 0;
-out_unlock:
+out:
 	blk_crypto_hw_exit(profile);
 	return err;
 }
block/blk-crypto.c +20 -8
@@ -400,15 +400,19 @@ int blk_crypto_start_using_key(struct bl
 }
 
 /**
- * blk_crypto_evict_key() - Evict a key from any inline encryption hardware
- *			    it may have been programmed into
- * @bdev: The block_device who's associated inline encryption hardware this key
- *     might have been programmed into
- * @key: The key to evict
+ * blk_crypto_evict_key() - Evict a blk_crypto_key from a block_device
+ * @bdev: a block_device on which I/O using the key may have been done
+ * @key: the key to evict
  *
- * Upper layers (filesystems) must call this function to ensure that a key is
- * evicted from any hardware that it might have been programmed into.  The key
- * must not be in use by any in-flight IO when this function is called.
+ * For a given block_device, this function removes the given blk_crypto_key from
+ * the keyslot management structures and evicts it from any underlying hardware
+ * keyslot(s) or blk-crypto-fallback keyslot it may have been programmed into.
+ *
+ * Upper layers must call this before freeing the blk_crypto_key.  It must be
+ * called for every block_device the key may have been used on.  The key must no
+ * longer be in use by any I/O when this function is called.
+ *
+ * Context: May sleep.
  */
 void blk_crypto_evict_key(struct block_device *bdev,
 			  const struct blk_crypto_key *key)
@@ -420,6 +424,14 @@ void blk_crypto_evict_key(struct block_d
 		err = __blk_crypto_evict_key(q->crypto_profile, key);
 	else
 		err = blk_crypto_fallback_evict_key(key);
+	/*
+	 * An error can only occur here if the key failed to be evicted from a
+	 * keyslot (due to a hardware or driver issue) or is allegedly still in
+	 * use by I/O (due to a kernel bug).  Even in these cases, the key is
+	 * still unlinked from the keyslot management structures, and the caller
+	 * is allowed and expected to free it right away.  There's nothing
+	 * callers can do to handle errors, so just log them and return void.
+	 */
 	if (err)
 		pr_warn_ratelimited("%pg: error %d evicting key\n", bdev, err);
 }
author maintainer
#47 lore raw

PATCH 47/663 staging: iio: resolver: ads1210: fix config mode

In reply to Greg Kroah-Hartman

From: Nuno Sá <[email protected]>

commit 16313403d873ff17a587818b61f84c8cb4971cef upstream.

As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode.

[1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf

Fixes b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup")
Cc stable <[email protected]>
---
 drivers/staging/iio/resolver/ad2s1210.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +1 -1
@@ -101,7 +101,7 @@ struct ad2s1210_state {
 static const int ad2s1210_mode_vals[4][2] = {
 	[MOD_POS] = { 0, 0 },
 	[MOD_VEL] = { 0, 1 },
-	[MOD_CONFIG] = { 1, 0 },
+	[MOD_CONFIG] = { 1, 1 },
 };
 
 static inline void ad2s1210_set_mode(enum ad2s1210_mode mode,
author maintainer
#48 lore raw

PATCH 48/663 tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

commit 094fb49a2d0d6827c86d2e0840873e6db0c491d2 upstream.

If userspace races tcsetattr() with a write, the drained condition might not be guaranteed by the kernel. There is a race window after checking Tx is empty before tty_set_termios() takes termios_rwsem for write. During that race window, more characters can be queued by a racing writer.

Any ongoing transmission might produce garbage during HW's ->set_termios() call. The intent of TCSADRAIN/FLUSH seems to be preventing such a character corruption. If those flags are set, take tty's write lock to stop any writer before performing the lower layer Tx empty check and wait for the pending characters to be sent (if any).

The initial wait for all-writers-done must be placed outside of tty's write lock to avoid deadlock which makes it impossible to use tty_wait_until_sent(). The write lock is retried if a racing write is detected.

---
 drivers/tty/tty.h       |    2 ++
 drivers/tty/tty_io.c    |    4 ++--
 drivers/tty/tty_ioctl.c |   45 +++++++++++++++++++++++++++++++++------------
 3 files changed, 37 insertions(+), 14 deletions(-)
drivers/tty/tty.h +2 -0
@@ -62,6 +62,8 @@ int __tty_check_change(struct tty_struct
 int tty_check_change(struct tty_struct *tty);
 void __stop_tty(struct tty_struct *tty);
 void __start_tty(struct tty_struct *tty);
+void tty_write_unlock(struct tty_struct *tty);
+int tty_write_lock(struct tty_struct *tty, int ndelay);
 void tty_vhangup_session(struct tty_struct *tty);
 void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty);
 int tty_signal_session_leader(struct tty_struct *tty, int exit_session);
drivers/tty/tty_io.c +2 -2
@@ -933,13 +933,13 @@ static ssize_t tty_read(struct kiocb *io
 	return i;
 }
 
-static void tty_write_unlock(struct tty_struct *tty)
+void tty_write_unlock(struct tty_struct *tty)
 {
 	mutex_unlock(&tty->atomic_write_lock);
 	wake_up_interruptible_poll(&tty->write_wait, EPOLLOUT);
 }
 
-static int tty_write_lock(struct tty_struct *tty, int ndelay)
+int tty_write_lock(struct tty_struct *tty, int ndelay)
 {
 	if (!mutex_trylock(&tty->atomic_write_lock)) {
 		if (ndelay)
drivers/tty/tty_ioctl.c +33 -12

54 lines not on this page · raw message

author maintainer
#49 lore raw

PATCH 49/663 xhci: fix debugfs register accesses while suspended

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

commit 735baf1b23458f71a8b15cb924af22c9ff9cd125 upstream.

Wire up the debugfs regset device pointer so that the controller is resumed before accessing registers to avoid crashing or locking up if it happens to be runtime suspended.

Fixes 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver")
Cc [email protected] # 4.15: 30332eeefec8: debugfs: regset32: Add Runtime PM support
---
 drivers/usb/host/xhci-debugfs.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-debugfs.c +1 -0
@@ -133,6 +133,7 @@ static void xhci_debugfs_regset(struct x
 	regset->regs = regs;
 	regset->nregs = nregs;
 	regset->base = hcd->regs + base;
+	regset->dev = hcd->self.controller;
 
 	debugfs_create_regset32((const char *)rgs->name, 0444, parent, regset);
 }
author maintainer
#50 lore raw

PATCH 50/663 serial: fix TIOCSRS485 locking

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

commit 9e4f2a8004213339e9d837d891a59cc80e082966 upstream.

The RS485 multipoint addressing support for some reason added a new ADDRB termios cflag which is (only!) updated from one of the RS485 ioctls.

Make sure to take the termios rw semaphore for the right ioctl (i.e. set, not get).

Fixes ae50bb275283 ("serial: take termios_rwsem for ->rs485_config() & pass termios as param")
Cc Ilpo Järvinen <[email protected]>
---
 drivers/tty/serial/serial_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/serial_core.c +2 -2
@@ -1552,7 +1552,7 @@ uart_ioctl(struct tty_struct *tty, unsig
 		goto out;
 
 	/* rs485_config requires more locking than others */
-	if (cmd == TIOCGRS485)
+	if (cmd == TIOCSRS485)
 		down_write(&tty->termios_rwsem);
 
 	mutex_lock(&port->mutex);
@@ -1595,7 +1595,7 @@ uart_ioctl(struct tty_struct *tty, unsig
 	}
 out_up:
 	mutex_unlock(&port->mutex);
-	if (cmd == TIOCGRS485)
+	if (cmd == TIOCSRS485)
 		up_write(&tty->termios_rwsem);
 out:
 	return ret;
author maintainer
#33 lore raw

PATCH 33/663 usb: gadget: udc: core: Prevent redundant calls to pullup

In reply to Greg Kroah-Hartman

From: Badhri Jagan Sridharan <[email protected]>

commit a3afbf5cc887fc3401f012fe629810998ed61859 upstream.

usb_gadget_connect calls gadget->ops->pullup without checking whether gadget->connected was previously set. Make this symmetric to usb_gadget_disconnect by returning early if gadget->connected is already set.

Fixes 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected")
---
 drivers/usb/gadget/udc/core.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/gadget/udc/core.c +3 -0
@@ -676,6 +676,9 @@ static int usb_gadget_connect_locked(str
 		goto out;
 	}
 
+	if (gadget->connected)
+		goto out;
+
 	if (gadget->deactivated || !gadget->udc->started) {
 		/*
 		 * If gadget is deactivated we only save new state.
author maintainer
#51 lore raw

PATCH 51/663 serial: 8250: Fix serial8250_tx_empty() race with DMA Tx

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

commit 146a37e05d620cef4ad430e5d1c9c077fe6fa76f upstream.

There's a potential race before THRE/TEMT deasserts when DMA Tx is starting up (or the next batch of continuous Tx is being submitted). This can lead to misdetecting Tx empty condition.

It is entirely normal for THRE/TEMT to be set for some time after the DMA Tx had been setup in serial8250_tx_dma(). As Tx side is definitely not empty at that point, it seems incorrect for serial8250_tx_empty() claim Tx is empty.

Fix the race by also checking in serial8250_tx_empty() whether there's DMA Tx active.

Note: This fix only addresses in-kernel race mainly to make using TCSADRAIN/FLUSH robust. Userspace can still cause other races but they seem userspace concurrency control problems.

Fixes 9ee4b83e51f74 ("serial: 8250: Add support for dmaengine")
---
 drivers/tty/serial/8250/8250.h      |   12 ++++++++++++
 drivers/tty/serial/8250/8250_port.c |    7 ++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250.h +12 -0
@@ -365,6 +365,13 @@ static inline void serial8250_do_prepare
 	if (dma->prepare_rx_dma)
 		dma->prepare_rx_dma(p);
 }
+
+static inline bool serial8250_tx_dma_running(struct uart_8250_port *p)
+{
+	struct uart_8250_dma *dma = p->dma;
+
+	return dma && dma->tx_running;
+}
 #else
 static inline int serial8250_tx_dma(struct uart_8250_port *p)
 {
@@ -380,6 +387,11 @@ static inline int serial8250_request_dma
 	return -1;
 }
 static inline void serial8250_release_dma(struct uart_8250_port *p) { }
+
+static inline bool serial8250_tx_dma_running(struct uart_8250_port *p)
+{
+	return false;
+}
 #endif
 
 static inline int ns16550a_goto_highspeed(struct uart_8250_port *up)
drivers/tty/serial/8250/8250_port.c +4 -3
@@ -2009,18 +2009,19 @@ static int serial8250_tx_threshold_handl
 static unsigned int serial8250_tx_empty(struct uart_port *port)
 {
 	struct uart_8250_port *up = up_to_u8250p(port);
+	unsigned int result = 0;
 	unsigned long flags;
-	u16 lsr;
 
 	serial8250_rpm_get(up);
 
 	spin_lock_irqsave(&port->lock, flags);
-	lsr = serial_lsr_in(up);
+	if (!serial8250_tx_dma_running(up) && uart_lsr_tx_empty(serial_lsr_in(up)))
+		result = TIOCSER_TEMT;
 	spin_unlock_irqrestore(&port->lock, flags);
 
 	serial8250_rpm_put(up);
 
-	return uart_lsr_tx_empty(lsr) ? TIOCSER_TEMT : 0;
+	return result;
 }
 
 unsigned int serial8250_do_get_mctrl(struct uart_port *port)
author maintainer
#52 lore raw

PATCH 52/663 serial: max310x: fix IO data corruption in batched operations

In reply to Greg Kroah-Hartman

From: Jan Kundrát <[email protected]>

commit 3f42b142ea1171967e40e10e4b0241c0d6d28d41 upstream.

After upgrading from 5.16 to 6.1, our board with a MAX14830 started producing lots of garbage data over UART. Bisection pointed out commit 285e76fc049c as the culprit. That patch tried to replace hand-written code which I added in 2b4bac48c1084 ("serial: max310x: Use batched reads when reasonably safe") with the generic regmap infrastructure for batched operations.

Unfortunately, the regmap_raw_read and regmap_raw_write which were used are actually functions which perform IO over *multiple* registers. That's not what is needed for accessing these Tx/Rx FIFOs; the appropriate functions are the _noinc_ versions, not the _raw_ ones.

Fix this regression by using regmap_noinc_read() and regmap_noinc_write() along with the necessary regmap_config setup; with this patch in place, our board communicates happily again. Since our board uses SPI for talking to this chip, the I2C part is completely untested.

---
 drivers/tty/serial/max310x.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +15 -2
@@ -525,6 +525,11 @@ static bool max310x_reg_precious(struct
 	return false;
 }
 
+static bool max310x_reg_noinc(struct device *dev, unsigned int reg)
+{
+	return reg == MAX310X_RHR_REG;
+}
+
 static int max310x_set_baud(struct uart_port *port, int baud)
 {
 	unsigned int mode = 0, div = 0, frac = 0, c = 0, F = 0;
@@ -651,14 +656,14 @@ static void max310x_batch_write(struct u
 {
 	struct max310x_one *one = to_max310x_port(port);
 
-	regmap_raw_write(one->regmap, MAX310X_THR_REG, txbuf, len);
+	regmap_noinc_write(one->regmap, MAX310X_THR_REG, txbuf, len);
 }
 
 static void max310x_batch_read(struct uart_port *port, u8 *rxbuf, unsigned int len)
 {
 	struct max310x_one *one = to_max310x_port(port);
 
-	regmap_raw_read(one->regmap, MAX310X_RHR_REG, rxbuf, len);
+	regmap_noinc_read(one->regmap, MAX310X_RHR_REG, rxbuf, len);
 }
 
 static void max310x_handle_rx(struct uart_port *port, unsigned int rxlen)
@@ -1469,6 +1474,10 @@ static struct regmap_config regcfg = {
 	.writeable_reg = max310x_reg_writeable,
 	.volatile_reg = max310x_reg_volatile,
 	.precious_reg = max310x_reg_precious,
+	.writeable_noinc_reg = max310x_reg_noinc,
+	.readable_noinc_reg = max310x_reg_noinc,
+	.max_raw_read = MAX310X_FIFO_SIZE,
+	.max_raw_write = MAX310X_FIFO_SIZE,
 };
 
 #ifdef CONFIG_SPI_MASTER
@@ -1554,6 +1563,10 @@ static struct regmap_config regcfg_i2c =
 	.volatile_reg = max310x_reg_volatile,
 	.precious_reg = max310x_reg_precious,
 	.max_register = MAX310X_I2C_REVID_EXTREG,
+	.writeable_noinc_reg = max310x_reg_noinc,
+	.readable_noinc_reg = max310x_reg_noinc,
+	.max_raw_read = MAX310X_FIFO_SIZE,
+	.max_raw_write = MAX310X_FIFO_SIZE,
 };
 
 static const struct max310x_if_cfg max310x_i2c_if_cfg = {
author maintainer
#53 lore raw

PATCH 53/663 tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem

In reply to Greg Kroah-Hartman

From: Joel Fernandes (Google) <[email protected]>

commit 58d7668242647e661a20efe065519abd6454287e upstream.

For CONFIG_NO_HZ_FULL systems, the tick_do_timer_cpu cannot be offlined. However, cpu_is_hotpluggable() still returns true for those CPUs. This causes torture tests that do offlining to end up trying to offline this CPU causing test failures. Such failure happens on all architectures.

Fix the repeated error messages thrown by this (even if the hotplug errors are harmless) by asking the opinion of the nohz subsystem on whether the CPU can be hotplugged.

[ Apply Frederic Weisbecker feedback on refactoring tick_nohz_cpu_down(). ]

For drivers/base/ portion:

Cc Frederic Weisbecker <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc Zhouyi Zhou <[email protected]>
Cc Will Deacon <[email protected]>
Cc Marc Zyngier <[email protected]>
Fixes 2987557f52b9 ("driver-core/cpu: Expose hotpluggability to the rest of the kernel")
---
 drivers/base/cpu.c       |    3 ++-
 include/linux/tick.h     |    2 ++
 kernel/time/tick-sched.c |   11 ++++++++---
 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/base/cpu.c +2 -1
@@ -487,7 +487,8 @@ static const struct attribute_group *cpu
 bool cpu_is_hotpluggable(unsigned int cpu)
 {
 	struct device *dev = get_cpu_device(cpu);
-	return dev && container_of(dev, struct cpu, dev)->hotpluggable;
+	return dev && container_of(dev, struct cpu, dev)->hotpluggable
+		&& tick_nohz_cpu_hotpluggable(cpu);
 }
 EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
 
include/linux/tick.h +2 -0
@@ -216,6 +216,7 @@ extern void tick_nohz_dep_set_signal(str
 				     enum tick_dep_bits bit);
 extern void tick_nohz_dep_clear_signal(struct signal_struct *signal,
 				       enum tick_dep_bits bit);
+extern bool tick_nohz_cpu_hotpluggable(unsigned int cpu);
 
 /*
  * The below are tick_nohz_[set,clear]_dep() wrappers that optimize off-cases
@@ -280,6 +281,7 @@ static inline void tick_nohz_full_add_cp
 
 static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { }
 static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { }
+static inline bool tick_nohz_cpu_hotpluggable(unsigned int cpu) { return true; }
 
 static inline void tick_dep_set(enum tick_dep_bits bit) { }
 static inline void tick_dep_clear(enum tick_dep_bits bit) { }
kernel/time/tick-sched.c +8 -3
@@ -527,7 +527,7 @@ void __init tick_nohz_full_setup(cpumask
 	tick_nohz_full_running = true;
 }
 
-static int tick_nohz_cpu_down(unsigned int cpu)
+bool tick_nohz_cpu_hotpluggable(unsigned int cpu)
 {
 	/*
 	 * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
@@ -535,8 +535,13 @@ static int tick_nohz_cpu_down(unsigned i
 	 * CPUs. It must remain online when nohz full is enabled.
 	 */
 	if (tick_nohz_full_running && tick_do_timer_cpu == cpu)
-		return -EBUSY;
-	return 0;
+		return false;
+	return true;
+}
+
+static int tick_nohz_cpu_down(unsigned int cpu)
+{
+	return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY;
 }
 
 void __init tick_nohz_init(void)
author maintainer
#54 lore raw

PATCH 54/663 fs: fix sysctls.c built

In reply to Greg Kroah-Hartman

From: Kefeng Wang <[email protected]>

commit e3184de9d46c2eebdb776face2e2662c6733331d upstream.

'obj-$(CONFIG_SYSCTL) += sysctls.o' must be moved after "obj-y :=", or it won't be built as it is overwrited.

Note that there is nothing that is going to break by linking sysctl.o later, we were just being way to cautious and patches have been updated to reflect these considerations and sent for stable as well with the whole "base" stuff needing to be linked prior to child sysctl tables that use that directory. All of the kernel sysctl APIs always share the same directory, and races against using it should end up re-using the same single created directory.

And so something we can do eventually is do away with all the base stuff. For now it's fine, it's not creating an issue. It is just a bit pedantic and careful.

Fixes ab171b952c6e ("fs: move namespace sysctls and declare fs base directory")
Cc Christian Brauner <[email protected]>
Cc Kefeng Wang <[email protected]>
[mcgrof: enhanced commit log for stable criteria and clarify base stuff ]
---
 fs/Makefile |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/Makefile +1 -2
@@ -6,7 +6,6 @@
 # Rewritten to use lists instead of if-statements.
 # 
 
-obj-$(CONFIG_SYSCTL)		+= sysctls.o
 
 obj-y :=	open.o read_write.o file_table.o super.o \
 		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
@@ -49,7 +48,7 @@ obj-$(CONFIG_FS_MBCACHE)	+= mbcache.o
 obj-$(CONFIG_FS_POSIX_ACL)	+= posix_acl.o
 obj-$(CONFIG_NFS_COMMON)	+= nfs_common/
 obj-$(CONFIG_COREDUMP)		+= coredump.o
-obj-$(CONFIG_SYSCTL)		+= drop_caches.o
+obj-$(CONFIG_SYSCTL)		+= drop_caches.o sysctls.o
 
 obj-$(CONFIG_FHANDLE)		+= fhandle.o
 obj-y				+= iomap/
author maintainer
#55 lore raw

PATCH 55/663 MIPS: fw: Allow firmware to pass a empty env

In reply to Greg Kroah-Hartman

From: Jiaxun Yang <[email protected]>

commit ee1809ed7bc456a72dc8410b475b73021a3a68d5 upstream.

fw_getenv will use env entry to determine style of env, however it is legal for firmware to just pass a empty list.

Check if first entry exist before running strchr to avoid null pointer dereference.

---
 arch/mips/fw/lib/cmdline.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/fw/lib/cmdline.c +1 -1
@@ -53,7 +53,7 @@ char *fw_getenv(char *envname)
 {
 	char *result = NULL;
 
-	if (_fw_envp != NULL) {
+	if (_fw_envp != NULL && fw_envp(0) != NULL) {
 		/*
 		 * Return a pointer to the given environment variable.
 		 * YAMON uses "name", "value" pairs, while U-Boot uses
author maintainer
#56 lore raw

PATCH 56/663 ipmi:ssif: Add send_retries increment

In reply to Greg Kroah-Hartman

From: Corey Minyard <[email protected]>

commit 6ce7995a43febe693d4894033c6e29314970646a upstream.

A recent change removed an increment of send_retries, re-add it.

Fixes 95767ed78a18 ipmi:ssif: resend_msg() cannot fail
---
 drivers/char/ipmi/ipmi_ssif.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +3 -1
@@ -564,8 +564,10 @@ static void retry_timeout(struct timer_l
 
 	if (waiting)
 		start_get(ssif_info);
-	if (resend)
+	if (resend) {
 		start_resend(ssif_info);
+		ssif_inc_stat(ssif_info, send_retries);
+	}
 }
 
 static void watch_timeout(struct timer_list *t)
author maintainer
#57 lore raw

PATCH 57/663 ipmi: fix SSIF not responding under certain cond.

In reply to Greg Kroah-Hartman

From: Zhang Yuchen <[email protected]>

commit 6d2555cde2918409b0331560e66f84a0ad4849c6 upstream.

The ipmi communication is not restored after a specific version of BMC is upgraded on our server.
The ipmi driver does not respond after printing the following log:

ipmi_ssif: Invalid response getting flags: 1c 1

I found that after entering this branch, ssif_info->ssif_state always holds SSIF_GETTING_FLAGS and never return to IDLE.

As a result, the driver cannot be loaded, because the driver status is checked during the unload process and must be IDLE in shutdown_ssif():

        while (ssif_info->ssif_state != SSIF_IDLE)
                schedule_timeout(1);

The process trigger this problem is:

1. One msg timeout and next msg start send, and call ssif_set_need_watch().

2. ssif_set_need_watch()->watch_timeout()->start_flag_fetch() change ssif_state to SSIF_GETTING_FLAGS.

3. In msg_done_handler() ssif_state == SSIF_GETTING_FLAGS, if an error message is received, the second branch does not modify the ssif_state.

4. All retry action need IS_SSIF_IDLE() == True. Include retry action in watch_timeout(), msg_done_handler(). Sending msg does not work either. SSIF_IDLE is also checked in start_next_msg().

5. The only thing that can be triggered in the SSIF driver is watch_timeout(), after destory_user(), this timer will stop too.

So, if enter this branch, the ssif_state will remain SSIF_GETTING_FLAGS and can't send msg, no timer started, can't unload.

We did a comparative test before and after adding this patch, and the result is effective.

Fixes 259307074bfc ("ipmi: Add SMBus interface driver (SSIF)")

Message-Id: <[email protected]>

---
 drivers/char/ipmi/ipmi_ssif.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +2 -2
@@ -794,9 +794,9 @@ static void msg_done_handler(struct ssif
 		} else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
 			   || data[1] != IPMI_GET_MSG_FLAGS_CMD) {
 			/*
-			 * Don't abort here, maybe it was a queued
-			 * response to a previous command.
+			 * Recv error response, give up.
 			 */
+			ssif_info->ssif_state = SSIF_IDLE;
 			ipmi_ssif_unlock_cond(ssif_info, flags);
 			dev_warn(&ssif_info->client->dev,
 				 "Invalid response getting flags: %x %x\n",
author maintainer
#58 lore raw

PATCH 58/663 iio: addac: stx104: Fix race condition when converting analog-to-digital

In reply to Greg Kroah-Hartman

From: William Breathitt Gray <[email protected]>

commit 4f9b80aefb9e2f542a49d9ec087cf5919730e1dd upstream.

The ADC conversion procedure requires several device I/O operations performed in a particular sequence. If stx104_read_raw() is called concurrently, the ADC conversion procedure could be clobbered. Prevent such a race condition by utilizing a mutex.

---
 drivers/iio/addac/stx104.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/addac/stx104.c +4 -0
@@ -114,6 +114,8 @@ static int stx104_read_raw(struct iio_de
 			return IIO_VAL_INT;
 		}
 
+		mutex_lock(&priv->lock);
+
 		/* select ADC channel */
 		iowrite8(chan->channel | (chan->channel << 4), &reg->achan);
 
@@ -124,6 +126,8 @@ static int stx104_read_raw(struct iio_de
 		while (ioread8(&reg->cir_asr) & BIT(7));
 
 		*val = ioread16(&reg->ssr_ad);
+
+		mutex_unlock(&priv->lock);
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_OFFSET:
 		/* get ADC bipolar/unipolar configuration */
author maintainer
#59 lore raw

PATCH 59/663 iio: addac: stx104: Fix race condition for stx104_write_raw()

In reply to Greg Kroah-Hartman

From: William Breathitt Gray <[email protected]>

commit 9740827468cea80c42db29e7171a50e99acf7328 upstream.

The priv->chan_out_states array and actual DAC value can become mismatched if stx104_write_raw() is called concurrently. Prevent such a race condition by utilizing a mutex.

---
 drivers/iio/addac/stx104.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iio/addac/stx104.c +8 -0
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
@@ -69,10 +70,12 @@ struct stx104_reg {
 
 /**
  * struct stx104_iio - IIO device private data structure
+ * @lock: synchronization lock to prevent I/O race conditions
  * @chan_out_states:	channels' output states
  * @reg:		I/O address offset for the device registers
  */
 struct stx104_iio {
+	struct mutex lock;
 	unsigned int chan_out_states[STX104_NUM_OUT_CHAN];
 	struct stx104_reg __iomem *reg;
 };
@@ -182,9 +185,12 @@ static int stx104_write_raw(struct iio_d
 			if ((unsigned int)val > 65535)
 				return -EINVAL;
 
+			mutex_lock(&priv->lock);
+
 			priv->chan_out_states[chan->channel] = val;
 			iowrite16(val, &priv->reg->dac[chan->channel]);
 
+			mutex_unlock(&priv->lock);
 			return 0;
 		}
 		return -EINVAL;
@@ -355,6 +361,8 @@ static int stx104_probe(struct device *d
 
 	indio_dev->name = dev_name(dev);
 
+	mutex_init(&priv->lock);
+
 	/* configure device for software trigger operation */
 	iowrite8(0, &priv->reg->acr);
 
author maintainer
#60 lore raw

PATCH 60/663 kheaders: Use array declaration instead of char

In reply to Greg Kroah-Hartman

From: Kees Cook <[email protected]>

commit b69edab47f1da8edd8e7bfdf8c70f51a2a5d89fb upstream.

Under CONFIG_FORTIFY_SOURCE, memcpy() will check the size of destination and source buffers. Defining kernel_headers_data as "char" would trip this check. Since these addresses are treated as byte arrays, define them as arrays (as done everywhere else).

This was seen with:

  $ cat /sys/kernel/kheaders.tar.xz >> /dev/null

detected buffer overflow in memcpy
kernel BUG at lib/string_helpers.c:1027!
...

  RIP: 0010:fortify_panic+0xf/0x20
  [...]
  Call Trace:
   <TASK>
   ikheaders_read+0x45/0x50 [kheaders]
   kernfs_fop_read_iter+0x1a4/0x2f0
  ...
---
 kernel/kheaders.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/kheaders.c +5 -5
@@ -26,15 +26,15 @@ asm (
 "	.popsection				\n"
 );
 
-extern char kernel_headers_data;
-extern char kernel_headers_data_end;
+extern char kernel_headers_data[];
+extern char kernel_headers_data_end[];
 
 static ssize_t
 ikheaders_read(struct file *file,  struct kobject *kobj,
 	       struct bin_attribute *bin_attr,
 	       char *buf, loff_t off, size_t len)
 {
-	memcpy(buf, &kernel_headers_data + off, len);
+	memcpy(buf, &kernel_headers_data[off], len);
 	return len;
 }
 
@@ -48,8 +48,8 @@ static struct bin_attribute kheaders_att
 
 static int __init ikheaders_init(void)
 {
-	kheaders_attr.size = (&kernel_headers_data_end -
-			      &kernel_headers_data);
+	kheaders_attr.size = (kernel_headers_data_end -
+			      kernel_headers_data);
 	return sysfs_create_bin_file(kernel_kobj, &kheaders_attr);
 }
 
author maintainer
#34 lore raw

PATCH 34/663 usb: dwc3: gadget: Stall and restart EP0 if host is unresponsive

In reply to Greg Kroah-Hartman

From: Wesley Cheng <[email protected]>

commit 02435a739b81ae24aff5d6e930efef9458e2af3c upstream.

It was observed that there are hosts that may complete pending SETUP transactions before the stop active transfers and controller halt occurs, leading to lingering endxfer commands on DEPs on subsequent pullup/gadget start iterations.

  dwc3_gadget_ep_disable   name=ep8in flags=0x3009  direction=1
  dwc3_gadget_ep_disable   name=ep4in flags=1  direction=1
  dwc3_gadget_ep_disable   name=ep3out flags=1  direction=0

usb_gadget_disconnect deactivated=0 connected=0 ret=0

The sequence shows that the USB gadget disconnect (dwc3_gadget_pullup(0)) routine completed successfully, allowing for the USB gadget to proceed with a USB gadget connect. However, if this occurs the system runs into an issue where:

  BUG: spinlock already unlocked on CPU
  spin_bug+0x0
  dwc3_remove_requests+0x278
  dwc3_ep0_out_start+0xb0
  __dwc3_gadget_start+0x25c

This is due to the pending endxfers, leading to gadget start (w/o lock held) to execute the remove requests, which will unlock the dwc3 spinlock as part of giveback.

To mitigate this, resolve the pending endxfers on the pullup disable path by re-locating the SETUP phase check after stop active transfers, since that is where the DWC3_EP_DELAY_STOP is potentially set. This also allows for handling of a host that may be unresponsive by using the completion timeout to trigger the stall and restart for EP0.

---
 drivers/usb/dwc3/gadget.c |   49 ++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 17 deletions(-)
drivers/usb/dwc3/gadget.c +32 -17
@@ -2532,29 +2532,17 @@ static int __dwc3_gadget_start(struct dw
 static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
 {
 	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&dwc->lock, flags);
 	dwc->connected = false;
 
 	/*
-	 * Per databook, when we want to stop the gadget, if a control transfer
-	 * is still in process, complete it and get the core into setup phase.
+	 * Attempt to end pending SETUP status phase, and not wait for the
+	 * function to do so.
 	 */
-	if (dwc->ep0state != EP0_SETUP_PHASE) {
-		int ret;
-
-		if (dwc->delayed_status)
-			dwc3_ep0_send_delayed_status(dwc);
-
-		reinit_completion(&dwc->ep0_in_setup);
-
-		spin_unlock_irqrestore(&dwc->lock, flags);
-		ret = wait_for_completion_timeout(&dwc->ep0_in_setup,
-				msecs_to_jiffies(DWC3_PULL_UP_TIMEOUT));
-		spin_lock_irqsave(&dwc->lock, flags);
-		if (ret == 0)
-			dev_warn(dwc->dev, "timed out waiting for SETUP phase\n");
-	}
+	if (dwc->delayed_status)
+		dwc3_ep0_send_delayed_status(dwc);
 
 	/*
 	 * In the Synopsys DesignWare Cores USB3 Databook Rev. 3.30a
@@ -2568,6 +2556,33 @@ static int dwc3_gadget_soft_disconnect(s
 	spin_unlock_irqrestore(&dwc->lock, flags);
 
 	/*
+	 * Per databook, when we want to stop the gadget, if a control transfer
+	 * is still in process, complete it and get the core into setup phase.
+	 * In case the host is unresponsive to a SETUP transaction, forcefully
+	 * stall the transfer, and move back to the SETUP phase, so that any
+	 * pending endxfers can be executed.
+	 */
+	if (dwc->ep0state != EP0_SETUP_PHASE) {
+		reinit_completion(&dwc->ep0_in_setup);
+
+		ret = wait_for_completion_timeout(&dwc->ep0_in_setup,
+				msecs_to_jiffies(DWC3_PULL_UP_TIMEOUT));
+		if (ret == 0) {
+			unsigned int    dir;
+
+			dev_warn(dwc->dev, "wait for SETUP phase timed out\n");
+			spin_lock_irqsave(&dwc->lock, flags);
+			dir = !!dwc->ep0_expect_in;
+			if (dwc->ep0state == EP0_DATA_PHASE)
+				dwc3_ep0_end_control_data(dwc, dwc->eps[dir]);
+			else
+				dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]);
+			dwc3_ep0_stall_and_restart(dwc);
+			spin_unlock_irqrestore(&dwc->lock, flags);
+		}
+	}
+
+	/*
 	 * Note: if the GEVNTCOUNT indicates events in the event buffer, the
 	 * driver needs to acknowledge them before the controller can halt.
 	 * Simply let the interrupt handler acknowledges and handle the
author maintainer
#61 lore raw

PATCH 61/663 wifi: mt76: add missing locking to protect against concurrent rx/status calls

In reply to Greg Kroah-Hartman

From: Felix Fietkau <[email protected]>

commit 5b8ccdfb943f6a03c676d2ea816dd38c149e920b upstream.

According to the documentation, ieee80211_rx_list must not run concurrently with ieee80211_tx_status (or its variants).

Fixes 88046b2c9f6d ("mt76: add support for reporting tx status with skb")
---
 drivers/net/wireless/mediatek/mt76/dma.c         |    2 ++
 drivers/net/wireless/mediatek/mt76/mt7603/mac.c  |    5 ++++-
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c  |    5 ++++-
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c |    5 ++++-
 drivers/net/wireless/mediatek/mt76/tx.c          |    4 ++++
 5 files changed, 18 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +2 -0
@@ -577,7 +577,9 @@ free:
 free_skb:
 	status.skb = tx_info.skb;
 	hw = mt76_tx_status_get_hw(dev, tx_info.skb);
+	spin_lock_bh(&dev->rx_lock);
 	ieee80211_tx_status_ext(hw, &status);
+	spin_unlock_bh(&dev->rx_lock);
 
 	return ret;
 }
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +4 -1
@@ -1279,8 +1279,11 @@ void mt7603_mac_add_txs(struct mt7603_de
 	if (wcidx >= MT7603_WTBL_STA || !sta)
 		goto out;
 
-	if (mt7603_fill_txs(dev, msta, &info, txs_data))
+	if (mt7603_fill_txs(dev, msta, &info, txs_data)) {
+		spin_lock_bh(&dev->mt76.rx_lock);
 		ieee80211_tx_status_noskb(mt76_hw(dev), sta, &info);
+		spin_unlock_bh(&dev->mt76.rx_lock);
+	}
 
 out:
 	rcu_read_unlock();
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +4 -1
@@ -1530,8 +1530,11 @@ static void mt7615_mac_add_txs(struct mt
 	if (wcid->phy_idx && dev->mt76.phys[MT_BAND1])
 		mphy = dev->mt76.phys[MT_BAND1];
 
-	if (mt7615_fill_txs(dev, msta, &info, txs_data))
+	if (mt7615_fill_txs(dev, msta, &info, txs_data)) {
+		spin_lock_bh(&dev->mt76.rx_lock);
 		ieee80211_tx_status_noskb(mphy->hw, sta, &info);
+		spin_unlock_bh(&dev->mt76.rx_lock);
+	}
 
 out:
 	rcu_read_unlock();
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +4 -1
@@ -631,8 +631,11 @@ void mt76x02_send_tx_status(struct mt76x
 
 	mt76_tx_status_unlock(mdev, &list);
 
-	if (!status.skb)
+	if (!status.skb) {
+		spin_lock_bh(&dev->mt76.rx_lock);
 		ieee80211_tx_status_ext(mt76_hw(dev), &status);
+		spin_unlock_bh(&dev->mt76.rx_lock);
+	}
 
 	if (!len)
 		goto out;
drivers/net/wireless/mediatek/mt76/tx.c +4 -0
@@ -77,7 +77,9 @@ mt76_tx_status_unlock(struct mt76_dev *d
 		}
 
 		hw = mt76_tx_status_get_hw(dev, skb);
+		spin_lock_bh(&dev->rx_lock);
 		ieee80211_tx_status_ext(hw, &status);
+		spin_unlock_bh(&dev->rx_lock);
 	}
 	rcu_read_unlock();
 }
@@ -263,7 +265,9 @@ void __mt76_tx_complete_skb(struct mt76_
 	if (cb->pktid < MT_PACKET_ID_FIRST) {
 		hw = mt76_tx_status_get_hw(dev, skb);
 		status.sta = wcid_to_sta(wcid);
+		spin_lock_bh(&dev->rx_lock);
 		ieee80211_tx_status_ext(hw, &status);
+		spin_unlock_bh(&dev->rx_lock);
 		goto out;
 	}
 
author maintainer
#62 lore raw

PATCH 62/663 wifi: rtw89: correct 5 MHz mask setting

In reply to Greg Kroah-Hartman

From: Eric Huang <[email protected]>

commit d33fc8d0368c180fe2338bfae4f5367a66a719f4 upstream.

Use primary channel index to determine which 5 MHz mask should be enable. This mask is used to prevent noise from channel edge to effect CCA threshold in wide bandwidth (>= 40 MHZ).

Fixes 1b00e9236a71 ("rtw89: 8852c: add set channel of BB part")
Fixes 6b0698984eb0 ("wifi: rtw89: 8852b: add chip_ops::set_channel")
---
 drivers/net/wireless/realtek/rtw89/rtw8852b.c |    9 +++++----
 drivers/net/wireless/realtek/rtw89/rtw8852c.c |    9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8852b.c +5 -4
@@ -1284,7 +1284,7 @@ static void rtw8852b_ctrl_cck_en(struct
 static void rtw8852b_5m_mask(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan,
 			     enum rtw89_phy_idx phy_idx)
 {
-	u8 pri_ch = chan->primary_channel;
+	u8 pri_ch = chan->pri_ch_idx;
 	bool mask_5m_low;
 	bool mask_5m_en;
 
@@ -1292,12 +1292,13 @@ static void rtw8852b_5m_mask(struct rtw8
 	case RTW89_CHANNEL_WIDTH_40:
 		/* Prich=1: Mask 5M High, Prich=2: Mask 5M Low */
 		mask_5m_en = true;
-		mask_5m_low = pri_ch == 2;
+		mask_5m_low = pri_ch == RTW89_SC_20_LOWER;
 		break;
 	case RTW89_CHANNEL_WIDTH_80:
 		/* Prich=3: Mask 5M High, Prich=4: Mask 5M Low, Else: Disable */
-		mask_5m_en = pri_ch == 3 || pri_ch == 4;
-		mask_5m_low = pri_ch == 4;
+		mask_5m_en = pri_ch == RTW89_SC_20_UPMOST ||
+			     pri_ch == RTW89_SC_20_LOWEST;
+		mask_5m_low = pri_ch == RTW89_SC_20_LOWEST;
 		break;
 	default:
 		mask_5m_en = false;
drivers/net/wireless/realtek/rtw89/rtw8852c.c +5 -4
@@ -1445,18 +1445,19 @@ static void rtw8852c_5m_mask(struct rtw8
 			     const struct rtw89_chan *chan,
 			     enum rtw89_phy_idx phy_idx)
 {
-	u8 pri_ch = chan->primary_channel;
+	u8 pri_ch = chan->pri_ch_idx;
 	bool mask_5m_low;
 	bool mask_5m_en;
 
 	switch (chan->band_width) {
 	case RTW89_CHANNEL_WIDTH_40:
 		mask_5m_en = true;
-		mask_5m_low = pri_ch == 2;
+		mask_5m_low = pri_ch == RTW89_SC_20_LOWER;
 		break;
 	case RTW89_CHANNEL_WIDTH_80:
-		mask_5m_en = ((pri_ch == 3) || (pri_ch == 4));
-		mask_5m_low = pri_ch == 4;
+		mask_5m_en = pri_ch == RTW89_SC_20_UPMOST ||
+			     pri_ch == RTW89_SC_20_LOWEST;
+		mask_5m_low = pri_ch == RTW89_SC_20_LOWEST;
 		break;
 	default:
 		mask_5m_en = false;
author maintainer
#35 lore raw

PATCH 35/663 USB: dwc3: fix runtime pm imbalance on probe errors

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

commit 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 upstream.

Make sure not to suspend the device when probe fails to avoid disabling clocks and phys multiple times.

Fixes 328082376aea ("usb: dwc3: fix runtime PM in error path")
Cc Roger Quadros <[email protected]>
---
 drivers/usb/dwc3/core.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/usb/dwc3/core.c +5 -9
@@ -1883,13 +1883,11 @@ static int dwc3_probe(struct platform_de
 	spin_lock_init(&dwc->lock);
 	mutex_init(&dwc->mutex);
 
+	pm_runtime_get_noresume(dev);
 	pm_runtime_set_active(dev);
 	pm_runtime_use_autosuspend(dev);
 	pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
 	pm_runtime_enable(dev);
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0)
-		goto err1;
 
 	pm_runtime_forbid(dev);
 
@@ -1954,12 +1952,10 @@ err3:
 	dwc3_free_event_buffers(dwc);
 
 err2:
-	pm_runtime_allow(&pdev->dev);
-
-err1:
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
-
+	pm_runtime_allow(dev);
+	pm_runtime_disable(dev);
+	pm_runtime_set_suspended(dev);
+	pm_runtime_put_noidle(dev);
 disable_clks:
 	dwc3_clk_disable(dwc);
 assert_reset:
author maintainer
#36 lore raw

PATCH 36/663 USB: dwc3: fix runtime pm imbalance on unbind

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

commit 44d257e9012ee8040e41d224d0e5bfb5ef5427ea upstream.

Make sure to balance the runtime PM usage count on driver unbind by adding back the pm_runtime_allow() call that had been erroneously removed.

Fixes 266d0493900a ("usb: dwc3: core: don't trigger runtime pm when remove driver")
Cc Li Jun <[email protected]>
---
 drivers/usb/dwc3/core.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/dwc3/core.c +1 -0
@@ -1979,6 +1979,7 @@ static int dwc3_remove(struct platform_d
 	dwc3_core_exit(dwc);
 	dwc3_ulpi_exit(dwc);
 
+	pm_runtime_allow(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
author maintainer
#37 lore raw

PATCH 37/663 hwmon: (k10temp) Check range scale when CUR_TEMP register is read-write

In reply to Greg Kroah-Hartman

From: Babu Moger <[email protected]>

commit 0c072385348e3ac5229145644055d3e2afb5b3db upstream.

Spec says, when CUR_TEMP_TJ_SEL == 3 and CUR_TEMP_RANGE_SEL == 0, it should use RangeUnadjusted is 0, which is (CurTmp*0.125 -49) C. The CUR_TEMP register is read-write when CUR_TEMP_TJ_SEL == 3 (bit 17-16).

Add the check to detect it.

Sensors command's output before the patch.
$sensors
k10temp-pci-00c3
Adapter: PCI adapter

 Tctl:         +76.6°C <- Wrong value
 Tccd1:        +26.5°C
 Tccd2:        +27.5°C
 Tccd3:        +27.2°C
 Tccd4:        +27.5°C
 Tccd5:        +26.0°C
 Tccd6:        +26.2°C
 Tccd7:        +25.0°C
 Tccd8:        +26.5°C

Sensors command's output after the patch.
$sensors
k10temp-pci-00c3
Adapter: PCI adapter

 Tctl:         +28.8°C <- corrected value
 Tccd1:        +27.5°C
 Tccd2:        +28.5°C
 Tccd3:        +28.5°C
 Tccd4:        +28.5°C
 Tccd5:        +27.0°C
 Tccd6:        +27.5°C
 Tccd7:        +27.0°C
 Tccd8:        +27.5°C
Fixes 1b59788979ac ("hwmon: (k10temp) Add temperature offset for Ryzen 2700X")
---
 drivers/hwmon/k10temp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/k10temp.c +3 -1
@@ -75,6 +75,7 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
 
 #define ZEN_CUR_TEMP_SHIFT			21
 #define ZEN_CUR_TEMP_RANGE_SEL_MASK		BIT(19)
+#define ZEN_CUR_TEMP_TJ_SEL_MASK		GENMASK(17, 16)
 
 struct k10temp_data {
 	struct pci_dev *pdev;
@@ -155,7 +156,8 @@ static long get_raw_temp(struct k10temp_
 
 	data->read_tempreg(data->pdev, &regval);
 	temp = (regval >> ZEN_CUR_TEMP_SHIFT) * 125;
-	if (regval & data->temp_adjust_mask)
+	if ((regval & data->temp_adjust_mask) ||
+	    (regval & ZEN_CUR_TEMP_TJ_SEL_MASK) == ZEN_CUR_TEMP_TJ_SEL_MASK)
 		temp -= 49000;
 	return temp;
 }
author maintainer
#38 lore raw

PATCH 38/663 hwmon: (adt7475) Use device_property APIs when configuring polarity

In reply to Greg Kroah-Hartman

From: Chris Packham <[email protected]>

commit 2a8e41ad337508fc5d598c0f9288890214f8e318 upstream.

On DT unaware platforms of_property_read_u32_array() returns -ENOSYS which wasn't handled by the code treating adi,pwm-active-state as optional. Update the code to use device_property_read_u32_array() which deals gracefully with DT unaware platforms.

---
 drivers/hwmon/adt7475.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/adt7475.c +3 -3
@@ -1604,9 +1604,9 @@ static int adt7475_set_pwm_polarity(stru
 	int ret, i;
 	u8 val;
 
-	ret = of_property_read_u32_array(client->dev.of_node,
-					 "adi,pwm-active-state", states,
-					 ARRAY_SIZE(states));
+	ret = device_property_read_u32_array(&client->dev,
+					     "adi,pwm-active-state", states,
+					     ARRAY_SIZE(states));
 	if (ret)
 		return ret;
 
author maintainer
#39 lore raw

PATCH 39/663 tpm: Add !tpm_amd_is_rng_defective() to the hwrng_unregister() call site

In reply to Greg Kroah-Hartman

From: Jarkko Sakkinen <[email protected]>

commit bd8621ca1510e6e802df9855bdc35a04a3cfa932 upstream.

The following crash was reported:

[ 1950.279393] list_del corruption, ffff99560d485790->next is NULL
[ 1950.279400] ------------[ cut here ]------------
[ 1950.279401] kernel BUG at lib/list_debug.c:49!
[ 1950.279405] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[ 1950.279407] CPU: 11 PID: 5886 Comm: modprobe Tainted: G O 6.2.8_1 #1
[ 1950.279409] Hardware name: Gigabyte Technology Co., Ltd. B550M AORUS PRO-P/B550M AORUS PRO-P,
BIOS F15c 05/11/2022
[ 1950.279410] RIP: 0010:__list_del_entry_valid+0x59/0xc0
[ 1950.279415] Code: 48 8b 01 48 39 f8 75 5a 48 8b 72 08 48 39 c6 75 65 b8 01 00 00 00 c3 cc cc cc
cc 48 89 fe 48 c7 c7 08 a8 13 9e e8 b7 0a bc ff <0f> 0b 48 89 fe 48 c7 c7 38 a8 13 9e e8 a6 0a bc
ff 0f 0b 48 89 fe
[ 1950.279416] RSP: 0018:ffffa96d05647e08 EFLAGS: 00010246
[ 1950.279418] RAX: 0000000000000033 RBX: ffff99560d485750 RCX: 0000000000000000
[ 1950.279419] RDX: 0000000000000000 RSI: ffffffff9e107c59 RDI: 00000000ffffffff
[ 1950.279420] RBP: ffffffffc19c5168 R08: 0000000000000000 R09: ffffa96d05647cc8
[ 1950.279421] R10: 0000000000000003 R11: ffffffff9ea2a568 R12: 0000000000000000
[ 1950.279422] R13: ffff99560140a2e0 R14: ffff99560127d2e0 R15: 0000000000000000
[ 1950.279422] FS: 00007f67da795380(0000) GS:ffff995d1f0c0000(0000) knlGS:0000000000000000
[ 1950.279424] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1950.279424] CR2: 00007f67da7e65c0 CR3: 00000001feed2000 CR4: 0000000000750ee0
[ 1950.279426] PKRU: 55555554
[ 1950.279426] Call Trace:
[ 1950.279428] <TASK>
[ 1950.279430] hwrng_unregister+0x28/0xe0 [rng_core]
[ 1950.279436] tpm_chip_unregister+0xd5/0xf0 [tpm]

Add the forgotten !tpm_amd_is_rng_defective() invariant to the hwrng_unregister() call site inside tpm_chip_unregister().

Fixes f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs")
Fixes b006c439d58d ("hwrng: core - start hwrng kthread also for untrusted sources")
---
 drivers/char/tpm/tpm-chip.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm-chip.c +2 -1
@@ -683,7 +683,8 @@ EXPORT_SYMBOL_GPL(tpm_chip_register);
 void tpm_chip_unregister(struct tpm_chip *chip)
 {
 	tpm_del_legacy_sysfs(chip);
-	if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip))
+	if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip) &&
+	    !tpm_amd_is_rng_defective(chip))
 		hwrng_unregister(&chip->hwrng);
 	tpm_bios_log_teardown(chip);
 	if (chip->flags & TPM_CHIP_FLAG_TPM2 && !tpm_is_firmware_upgrade(chip))
author maintainer
#40 lore raw

PATCH 40/663 posix-cpu-timers: Implement the missing timer_wait_running callback

In reply to Greg Kroah-Hartman

From: Thomas Gleixner <[email protected]>

commit f7abf14f0001a5a47539d9f60bbdca649e43536b upstream.

For some unknown reason the introduction of the timer_wait_running callback missed to fixup posix CPU timers, which went unnoticed for almost four years. Marco reported recently that the WARN_ON() in timer_wait_running() triggers with a posix CPU timer test case.

Posix CPU timers have two execution models for expiring timers depending on CONFIG_POSIX_CPU_TIMERS_TASK_WORK:

1) If not enabled, the expiry happens in hard interrupt context so spin waiting on the remote CPU is reasonably time bound.

Implement an empty stub function for that case.

2) If enabled, the expiry happens in task work before returning to user space or guest mode. The expired timers are marked as firing and moved from the timer queue to a local list head with sighand lock held. Once the timers are moved, sighand lock is dropped and the expiry happens in fully preemptible context. That means the expiring task can be scheduled out, migrated, interrupted etc. So spin waiting on it is more than suboptimal.

The timer wheel has a timer_wait_running() mechanism for RT, which uses a per CPU timer-base expiry lock which is held by the expiry code and the task waiting for the timer function to complete blocks on that lock.

This does not work in the same way for posix CPU timers as there is no timer base and expiry for process wide timers can run on any task belonging to that process, but the concept of waiting on an expiry lock can be used too in a slightly different way:

- Add a mutex to struct posix_cputimers_work. This struct is per task and used to schedule the expiry task work from the timer interrupt.

- Add a task_struct pointer to struct cpu_timer which is used to store a the task which runs the expiry. That's filled in when the task moves the expired timers to the local expiry list. That's not affecting the size of the k_itimer union as there are bigger union members already

- Let the task take the expiry mutex around the expiry function

- Let the waiter acquire a task reference with rcu_read_lock() held and block on the expiry mutex

This avoids spin-waiting on a task which might not even be on a CPU and works nicely for RT too.

---
 include/linux/posix-timers.h   |   17 +++++---
 kernel/time/posix-cpu-timers.c |   81 +++++++++++++++++++++++++++++++++--------
 kernel/time/posix-timers.c     |    4 ++
 3 files changed, 82 insertions(+), 20 deletions(-)
include/linux/posix-timers.h +11 -6
@@ -4,6 +4,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/list.h>
+#include <linux/mutex.h>
 #include <linux/alarmtimer.h>
 #include <linux/timerqueue.h>
 
@@ -62,16 +63,18 @@ static inline int clockid_to_fd(const cl
  * cpu_timer - Posix CPU timer representation for k_itimer
  * @node:	timerqueue node to queue in the task/sig
  * @head:	timerqueue head on which this timer is queued
- * @task:	Pointer to target task
+ * @pid:	Pointer to target task PID
  * @elist:	List head for the expiry list
  * @firing:	Timer is currently firing
+ * @handling:	Pointer to the task which handles expiry
  */
 struct cpu_timer {
-	struct timerqueue_node	node;
-	struct timerqueue_head	*head;
-	struct pid		*pid;
-	struct list_head	elist;
-	int			firing;
+	struct timerqueue_node		node;
+	struct timerqueue_head		*head;
+	struct pid			*pid;
+	struct list_head		elist;
+	int				firing;
+	struct task_struct __rcu	*handling;
 };
 
 static inline bool cpu_timer_enqueue(struct timerqueue_head *head,
@@ -135,10 +138,12 @@ struct posix_cputimers {
 /**
  * posix_cputimers_work - Container for task work based posix CPU timer expiry
  * @work:	The task work to be scheduled
+ * @mutex:	Mutex held around expiry in context of this task work
  * @scheduled:  @work has been scheduled already, no further processing
  */
 struct posix_cputimers_work {
 	struct callback_head	work;
+	struct mutex		mutex;
 	unsigned int		scheduled;
 };
 
kernel/time/posix-cpu-timers.c +67 -14

127 lines not on this page · raw message

kernel/time/posix-timers.c +4 -0
@@ -846,6 +846,10 @@ static struct k_itimer *timer_wait_runni
 	rcu_read_lock();
 	unlock_timer(timer, *flags);
 
+	/*
+	 * kc->timer_wait_running() might drop RCU lock. So @timer
+	 * cannot be touched anymore after the function returns!
+	 */
 	if (!WARN_ON_ONCE(!kc->timer_wait_running))
 		kc->timer_wait_running(timer);
 
author maintainer
#31 lore raw

PATCH 31/663 wifi: rtw88: usb: fix priority queue to endpoint mapping

In reply to Greg Kroah-Hartman

From: Sascha Hauer <[email protected]>

commit a6f187f92bcc2b17821538b4a11d61764e68b091 upstream.

The RTW88 chipsets have four different priority queues in hardware. For the USB type chipsets the packets destined for a specific priority queue must be sent through the endpoint corresponding to the queue. This was not fully understood when porting from the RTW88 USB out of tree driver and thus violated.

This patch implements the qsel to endpoint mapping as in get_usb_bulkout_id_88xx() in the downstream driver.

Without this the driver often issues "timed out to flush queue 3" warnings and often TX stalls completely.

---
 drivers/net/wireless/realtek/rtw88/usb.c |   70 ++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 23 deletions(-)
drivers/net/wireless/realtek/rtw88/usb.c +47 -23
@@ -118,6 +118,22 @@ static void rtw_usb_write32(struct rtw_d
 	rtw_usb_write(rtwdev, addr, val, 4);
 }
 
+static int dma_mapping_to_ep(enum rtw_dma_mapping dma_mapping)
+{
+	switch (dma_mapping) {
+	case RTW_DMA_MAPPING_HIGH:
+		return 0;
+	case RTW_DMA_MAPPING_NORMAL:
+		return 1;
+	case RTW_DMA_MAPPING_LOW:
+		return 2;
+	case RTW_DMA_MAPPING_EXTRA:
+		return 3;
+	default:
+		return -EINVAL;
+	}
+}
+
 static int rtw_usb_parse(struct rtw_dev *rtwdev,
 			 struct usb_interface *interface)
 {
@@ -129,6 +145,8 @@ static int rtw_usb_parse(struct rtw_dev
 	int num_out_pipes = 0;
 	int i;
 	u8 num;
+	const struct rtw_chip_info *chip = rtwdev->chip;
+	const struct rtw_rqpn *rqpn;
 
 	for (i = 0; i < interface_desc->bNumEndpoints; i++) {
 		endpoint = &host_interface->endpoint[i].desc;
@@ -183,31 +201,34 @@ static int rtw_usb_parse(struct rtw_dev
 
 	rtwdev->hci.bulkout_num = num_out_pipes;
 
-	switch (num_out_pipes) {
-	case 4:
-	case 3:
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID0] = 2;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID1] = 2;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID2] = 2;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID3] = 2;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID4] = 1;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID5] = 1;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID6] = 0;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID7] = 0;
-		break;
-	case 2:
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID0] = 1;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID1] = 1;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID2] = 1;
-		rtwusb->qsel_to_ep[TX_DESC_QSEL_TID3] = 1;
-		break;
-	case 1:
-		break;
-	default:
-		rtw_err(rtwdev, "failed to get out_pipes(%d)\n", num_out_pipes);
+	if (num_out_pipes < 1 || num_out_pipes > 4) {
+		rtw_err(rtwdev, "invalid number of endpoints %d\n", num_out_pipes);
 		return -EINVAL;
 	}
 
+	rqpn = &chip->rqpn_table[num_out_pipes];
+
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID0] = dma_mapping_to_ep(rqpn->dma_map_be);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID1] = dma_mapping_to_ep(rqpn->dma_map_bk);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID2] = dma_mapping_to_ep(rqpn->dma_map_bk);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID3] = dma_mapping_to_ep(rqpn->dma_map_be);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID4] = dma_mapping_to_ep(rqpn->dma_map_vi);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID5] = dma_mapping_to_ep(rqpn->dma_map_vi);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID6] = dma_mapping_to_ep(rqpn->dma_map_vo);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID7] = dma_mapping_to_ep(rqpn->dma_map_vo);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID8] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID9] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID10] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID11] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID12] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID13] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID14] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_TID15] = -EINVAL;
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_BEACON] = dma_mapping_to_ep(rqpn->dma_map_hi);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_HIGH] = dma_mapping_to_ep(rqpn->dma_map_hi);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_MGMT] = dma_mapping_to_ep(rqpn->dma_map_mg);
+	rtwusb->qsel_to_ep[TX_DESC_QSEL_H2C] = dma_mapping_to_ep(rqpn->dma_map_hi);
+
 	return 0;
 }
 
@@ -250,7 +271,7 @@ static void rtw_usb_write_port_tx_comple
 static int qsel_to_ep(struct rtw_usb *rtwusb, unsigned int qsel)
 {
 	if (qsel >= ARRAY_SIZE(rtwusb->qsel_to_ep))
-		return 0;
+		return -EINVAL;
 
 	return rtwusb->qsel_to_ep[qsel];
 }
@@ -265,6 +286,9 @@ static int rtw_usb_write_port(struct rtw
 	int ret;
 	int ep = qsel_to_ep(rtwusb, qsel);
 
+	if (ep < 0)
+		return ep;
+
 	pipe = usb_sndbulkpipe(usbd, rtwusb->out_ep[ep]);
 	urb = usb_alloc_urb(0, GFP_ATOMIC);
 	if (!urb)
author maintainer
#64 lore raw

PATCH 64/663 pwm: meson: Fix g12a ao clk81 name

In reply to Greg Kroah-Hartman

From: Heiner Kallweit <[email protected]>

commit 9e4fa80ab7ef9eb4f7b1ea9fc31e0eb040e85e25 upstream.

Fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the g12a clock driver.

Fixes f41efceb46e6 ("pwm: meson: Add clock source configuration for Meson G12A")
---
 drivers/pwm/pwm-meson.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-meson.c +2 -2
@@ -427,7 +427,7 @@ static const struct meson_pwm_data pwm_a
 };
 
 static const char * const pwm_g12a_ao_ab_parent_names[] = {
-	"xtal", "aoclk81", "fclk_div4", "fclk_div5"
+	"xtal", "g12a_ao_clk81", "fclk_div4", "fclk_div5"
 };
 
 static const struct meson_pwm_data pwm_g12a_ao_ab_data = {
@@ -436,7 +436,7 @@ static const struct meson_pwm_data pwm_g
 };
 
 static const char * const pwm_g12a_ao_cd_parent_names[] = {
-	"xtal", "aoclk81",
+	"xtal", "g12a_ao_clk81",
 };
 
 static const struct meson_pwm_data pwm_g12a_ao_cd_data = {
author maintainer
#73 lore raw

PATCH 73/663 crypto: ccp - Dont initialize CCP for PSP 0x1649

In reply to Greg Kroah-Hartman

From: Mario Limonciello <[email protected]>

commit c79a3169b9f3633c215b55857eba5921e5b49217 upstream.

A number of platforms are emitting the error:
```ccp: unable to access the device: you might be running a broken BIOS.```

This is expected behavior as CCP is no longer accessible from the PSP's PCIe BAR so stop trying to probe CCP for 0x1649.

---
 drivers/crypto/ccp/sp-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/sp-pci.c +1 -1
@@ -451,9 +451,9 @@ static const struct pci_device_id sp_pci
 	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] },
 	{ PCI_VDEVICE(AMD, 0x1486), (kernel_ulong_t)&dev_vdata[3] },
 	{ PCI_VDEVICE(AMD, 0x15DF), (kernel_ulong_t)&dev_vdata[4] },
-	{ PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[4] },
 	{ PCI_VDEVICE(AMD, 0x14CA), (kernel_ulong_t)&dev_vdata[5] },
 	{ PCI_VDEVICE(AMD, 0x15C7), (kernel_ulong_t)&dev_vdata[6] },
+	{ PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[6] },
 	/* Last entry must be zero */
 	{ 0, }
 };
author maintainer
#74 lore raw

PATCH 74/663 rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed

In reply to Greg Kroah-Hartman

From: Zheng Yejian <[email protected]>

commit 7a29fb4a4771124bc61de397dbfc1554dbbcc19c upstream.

Registering a kprobe on __rcu_irq_enter_check_tick() can cause kernel stack overflow as shown below. This issue can be reproduced by enabling CONFIG_NO_HZ_FULL and booting the kernel with argument "nohz_full=", and then giving the following commands at the shell prompt:

  # cd /sys/kernel/tracing/
  # echo 'p:mp1 __rcu_irq_enter_check_tick' >> kprobe_events
  # echo 1 > events/kprobes/enable

This commit therefore adds __rcu_irq_enter_check_tick() to the kprobes blacklist using NOKPROBE_SYMBOL().

Insufficient stack space to handle exception!

ESR: 0x00000000f2000004 -- BRK (AArch64)
FAR: 0x0000ffffccf3e510
Task stack:     [0xffff80000ad30000..0xffff80000ad38000]
IRQ stack:      [0xffff800008050000..0xffff800008058000]
Overflow stack: [0xffff089c36f9f310..0xffff089c36fa0310]
CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19
Hardware name: linux,dummy-virt (DT)
pstate: 400003c5 (nZcv DAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __rcu_irq_enter_check_tick+0x0/0x1b8
lr : ct_nmi_enter+0x11c/0x138

sp : ffff80000ad30080
x29: ffff80000ad30080 x28: ffff089c82e20000 x27: 0000000000000000
x26: 0000000000000000 x25: ffff089c02a8d100 x24: 0000000000000000
x23: 00000000400003c5 x22: 0000ffffccf3e510 x21: ffff089c36fae148
x20: ffff80000ad30120 x19: ffffa8da8fcce148 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: ffffa8da8e44ea6c
x14: ffffa8da8e44e968 x13: ffffa8da8e03136c x12: 1fffe113804d6809
x11: ffff6113804d6809 x10: 0000000000000a60 x9 : dfff800000000000 x8 : ffff089c026b404f x7 : 00009eec7fb297f7 x6 : 0000000000000001 x5 : ffff80000ad30120 x4 : dfff800000000000 x3 : ffffa8da8e3016f4 x2 : 0000000000000003 x1 : 0000000000000000 x0 : 0000000000000000

Kernel panic - not syncing: kernel stack overflow
CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19
Hardware name: linux,dummy-virt (DT)
Call trace:
 dump_backtrace+0xf8/0x108
 show_stack+0x20/0x30
 dump_stack_lvl+0x68/0x84
 dump_stack+0x1c/0x38
 panic+0x214/0x404
 add_taint+0x0/0xf8
 panic_bad_stack+0x144/0x160
 handle_bad_stack+0x38/0x58
 __bad_stack+0x78/0x7c
 __rcu_irq_enter_check_tick+0x0/0x1b8
 arm64_enter_el1_dbg.isra.0+0x14/0x20
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 arm64_enter_el1_dbg.isra.0+0x14/0x20
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 arm64_enter_el1_dbg.isra.0+0x14/0x20
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 [...]
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 arm64_enter_el1_dbg.isra.0+0x14/0x20
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 arm64_enter_el1_dbg.isra.0+0x14/0x20
 el1_dbg+0x2c/0x90
 el1h_64_sync_handler+0xcc/0xe8
 el1h_64_sync+0x64/0x68
 __rcu_irq_enter_check_tick+0x0/0x1b8
 el1_interrupt+0x28/0x60
 el1h_64_irq_handler+0x18/0x28
 el1h_64_irq+0x64/0x68
 __ftrace_set_clr_event_nolock+0x98/0x198
 __ftrace_set_clr_event+0x58/0x80
 system_enable_write+0x144/0x178
 vfs_write+0x174/0x738
 ksys_write+0xd0/0x188
 __arm64_sys_write+0x4c/0x60
 invoke_syscall+0x64/0x180
 el0_svc_common.constprop.0+0x84/0x160
 do_el0_svc+0x48/0xe8
 el0_svc+0x34/0xd0
 el0t_64_sync_handler+0xb8/0xc0
 el0t_64_sync+0x190/0x194

SMP: stopping secondary CPUs
Kernel Offset: 0x28da86000000 from 0xffff800008000000
PHYS_OFFSET: 0xfffff76600000000
CPU features: 0x00000,01a00100,0000421b Memory Limit: none

---
 kernel/rcu/tree.c |    1 +
 1 file changed, 1 insertion(+)
kernel/rcu/tree.c +1 -0
@@ -659,6 +659,7 @@ void __rcu_irq_enter_check_tick(void)
 	}
 	raw_spin_unlock_rcu_node(rdp->mynode);
 }
+NOKPROBE_SYMBOL(__rcu_irq_enter_check_tick);
 #endif /* CONFIG_NO_HZ_FULL */
 
 /*
author maintainer
#75 lore raw

PATCH 75/663 reiserfs: Add security prefix to xattr name in reiserfs_security_write()

In reply to Greg Kroah-Hartman

From: Roberto Sassu <[email protected]>

commit d82dcd9e21b77d338dc4875f3d4111f0db314a7c upstream.

Reiserfs sets a security xattr at inode creation time in two stages: first, it calls reiserfs_security_init() to obtain the xattr from active LSMs; then, it calls reiserfs_security_write() to actually write that xattr.

Unfortunately, it seems there is a wrong expectation that LSMs provide the full xattr name in the form 'security.<suffix>'. However, LSMs always provided just the suffix, causing reiserfs to not write the xattr at all (if the suffix is shorter than the prefix), or to write an xattr with the wrong name.

Add a temporary buffer in reiserfs_security_write(), and write to it the full xattr name, before passing it to reiserfs_xattr_set_handle().

Also replace the name length check with a check that the full xattr name is not larger than XATTR_NAME_MAX.

Cc [email protected] # v2.6.x
Fixes 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation")
---
 fs/reiserfs/xattr_security.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/reiserfs/xattr_security.c +6 -2
@@ -82,11 +82,15 @@ int reiserfs_security_write(struct reise
 			    struct inode *inode,
 			    struct reiserfs_security_handle *sec)
 {
+	char xattr_name[XATTR_NAME_MAX + 1] = XATTR_SECURITY_PREFIX;
 	int error;
-	if (strlen(sec->name) < sizeof(XATTR_SECURITY_PREFIX))
+
+	if (XATTR_SECURITY_PREFIX_LEN + strlen(sec->name) > XATTR_NAME_MAX)
 		return -EINVAL;
 
-	error = reiserfs_xattr_set_handle(th, inode, sec->name, sec->value,
+	strlcat(xattr_name, sec->name, sizeof(xattr_name));
+
+	error = reiserfs_xattr_set_handle(th, inode, xattr_name, sec->value,
 					  sec->length, XATTR_CREATE);
 	if (error == -ENODATA || error == -EOPNOTSUPP)
 		error = 0;
author maintainer
#76 lore raw

PATCH 76/663 cpufreq: qcom-cpufreq-hw: fix double IO unmap and resource release on exit

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

commit ba5e770c9698782bc203bbf5cf3b36a77720bdbe upstream.

Commit 054a3ef683a1 ("cpufreq: qcom-hw: Allocate qcom_cpufreq_data during probe") moved getting memory resource and iomap from qcom_cpufreq_hw_cpu_init() to the probe function, however it left untouched cleanup in qcom_cpufreq_hw_cpu_exit().

During device unbind this will lead to doule release of resource and double iounmap(), first by qcom_cpufreq_hw_cpu_exit() and second via managed resources:

resource: Trying to free nonexistent resource <0x0000000018593000-0x0000000018593fff> Trying to vunmap() nonexistent vm area (0000000088a7d4dc)
...

  vunmap (mm/vmalloc.c:2771 (discriminator 1))
  iounmap (mm/ioremap.c:60)
  devm_ioremap_release (lib/devres.c:19)
  devres_release_all (drivers/base/devres.c:506 drivers/base/devres.c:535)
  device_unbind_cleanup (drivers/base/dd.c:523)
  device_release_driver_internal (drivers/base/dd.c:1248 drivers/base/dd.c:1263)
  device_driver_detach (drivers/base/dd.c:1300)
  unbind_store (drivers/base/bus.c:243)
  drv_attr_store (drivers/base/bus.c:127)
  sysfs_kf_write (fs/sysfs/file.c:137)
  kernfs_fop_write_iter (fs/kernfs/file.c:334)
  vfs_write (include/linux/fs.h:1851 fs/read_write.c:491 fs/read_write.c:584)
  ksys_write (fs/read_write.c:637)
  __arm64_sys_write (fs/read_write.c:646)
  invoke_syscall (arch/arm64/include/asm/current.h:19 arch/arm64/kernel/syscall.c:57)
  el0_svc_common.constprop.0 (arch/arm64/include/asm/daifflags.h:28 arch/arm64/kernel/syscall.c:150)
  do_el0_svc (arch/arm64/kernel/syscall.c:194)
  el0_svc (arch/arm64/include/asm/daifflags.h:28 arch/arm64/kernel/entry-common.c:133 arch/arm64/kernel/entry-common.c:142 arch/arm64/kernel/entry-common.c:638)
  el0t_64_sync_handler (arch/arm64/kernel/entry-common.c:656)
  el0t_64_sync (arch/arm64/kernel/entry.S:591)
Fixes 054a3ef683a1 ("cpufreq: qcom-hw: Allocate qcom_cpufreq_data during probe")
Cc Manivannan Sadhasivam <[email protected]>
---
 drivers/cpufreq/qcom-cpufreq-hw.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/cpufreq/qcom-cpufreq-hw.c +2 -9
@@ -43,7 +43,6 @@ struct qcom_cpufreq_soc_data {
 
 struct qcom_cpufreq_data {
 	void __iomem *base;
-	struct resource *res;
 
 	/*
 	 * Mutex to synchronize between de-init sequence and re-starting LMh
@@ -590,16 +589,12 @@ static int qcom_cpufreq_hw_cpu_exit(stru
 {
 	struct device *cpu_dev = get_cpu_device(policy->cpu);
 	struct qcom_cpufreq_data *data = policy->driver_data;
-	struct resource *res = data->res;
-	void __iomem *base = data->base;
 
 	dev_pm_opp_remove_all_dynamic(cpu_dev);
 	dev_pm_opp_of_cpumask_remove_table(policy->related_cpus);
 	qcom_cpufreq_hw_lmh_exit(data);
 	kfree(policy->freq_table);
 	kfree(data);
-	iounmap(base);
-	release_mem_region(res->start, resource_size(res));
 
 	return 0;
 }
@@ -718,17 +713,15 @@ static int qcom_cpufreq_hw_driver_probe(
 	for (i = 0; i < num_domains; i++) {
 		struct qcom_cpufreq_data *data = &qcom_cpufreq.data[i];
 		struct clk_init_data clk_init = {};
-		struct resource *res;
 		void __iomem *base;
 
-		base = devm_platform_get_and_ioremap_resource(pdev, i, &res);
+		base = devm_platform_ioremap_resource(pdev, i);
 		if (IS_ERR(base)) {
-			dev_err(dev, "Failed to map resource %pR\n", res);
+			dev_err(dev, "Failed to map resource index %d\n", i);
 			return PTR_ERR(base);
 		}
 
 		data->base = base;
-		data->res = res;
 
 		/* Register CPU clock for each frequency domain */
 		clk_init.name = kasprintf(GFP_KERNEL, "qcom_cpufreq%d", i);
author maintainer
#77 lore raw

PATCH 77/663 KVM: x86/pmu: Disallow legacy LBRs if architectural LBRs are available

In reply to Greg Kroah-Hartman

From: Sean Christopherson <[email protected]>

commit 098f4c061ea10b777033b71c10bd9fd706820ee9 upstream.

Disallow enabling LBR support if the CPU supports architectural LBRs. Traditional LBR support is absent on CPU models that have architectural LBRs, and KVM doesn't yet support arch LBRs, i.e. KVM will pass through non-existent MSRs if userspace enables LBRs for the guest.

Cc Yang Weijiang <[email protected]>
Cc Like Xu <[email protected]>
Fixes be635e34c284 ("KVM: vmx/pmu: Expose LBR_FMT in the MSR_IA32_PERF_CAPABILITIES")
---
 arch/x86/kvm/vmx/vmx.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx/vmx.c +5 -3
@@ -7749,9 +7749,11 @@ static u64 vmx_get_perf_capabilities(voi
 	if (boot_cpu_has(X86_FEATURE_PDCM))
 		rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap);
 
-	x86_perf_get_lbr(&lbr);
-	if (lbr.nr)
-		perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
+	if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR)) {
+		x86_perf_get_lbr(&lbr);
+		if (lbr.nr)
+			perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
+	}
 
 	if (vmx_pebs_supported()) {
 		perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
author maintainer
#78 lore raw

PATCH 78/663 KVM: nVMX: Emulate NOPs in L2, and PAUSE if its not intercepted

In reply to Greg Kroah-Hartman

From: Sean Christopherson <[email protected]>

commit 4984563823f0034d3533854c1b50e729f5191089 upstream.

Extend VMX's nested intercept logic for emulated instructions to handle "pause" interception, in quotes because KVM's emulator doesn't filter out NOPs when checking for nested intercepts. Failure to allow emulation of NOPs results in KVM injecting a #UD into L2 on any NOP that collides with the emulator's definition of PAUSE, i.e. on all single-byte NOPs.

For PAUSE itself, honor L1's PAUSE-exiting control, but ignore PLE to avoid unnecessarily injecting a #UD into L2. Per the SDM, the first execution of PAUSE after VM-Entry is treated as the beginning of a new loop, i.e. will never trigger a PLE VM-Exit, and so L1 can't expect any given execution of PAUSE to deterministically exit.

... the processor considers this execution to be the first execution of PAUSE in a loop. (It also does so for the first execution of PAUSE at CPL 0 after VM entry.)

All that said, the PLE side of things is currently a moot point, as KVM doesn't expose PLE to L1.

Note, vmx_check_intercept() is still wildly broken when L1 wants to intercept an instruction, as KVM injects a #UD instead of synthesizing a nested VM-Exit. That issue extends far beyond NOP/PAUSE and needs far more effort to fix, i.e. is a problem for the future.

Fixes 07721feee46b ("KVM: nVMX: Don't emulate instructions in guest mode")
Cc Mathias Krause <[email protected]>
---
 arch/x86/kvm/vmx/vmx.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/x86/kvm/vmx/vmx.c +15 -0
@@ -7893,6 +7893,21 @@ static int vmx_check_intercept(struct kv
 		/* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED.  */
 		break;
 
+	case x86_intercept_pause:
+		/*
+		 * PAUSE is a single-byte NOP with a REPE prefix, i.e. collides
+		 * with vanilla NOPs in the emulator.  Apply the interception
+		 * check only to actual PAUSE instructions.  Don't check
+		 * PAUSE-loop-exiting, software can't expect a given PAUSE to
+		 * exit, i.e. KVM is within its rights to allow L2 to execute
+		 * the PAUSE.
+		 */
+		if ((info->rep_prefix != REPE_PREFIX) ||
+		    !nested_cpu_has2(vmcs12, CPU_BASED_PAUSE_EXITING))
+			return X86EMUL_CONTINUE;
+
+		break;
+
 	/* TODO: check more intercepts... */
 	default:
 		break;
author maintainer
#79 lore raw

PATCH 79/663 KVM: arm64: Avoid vcpu->mutex v. kvm->lock inversion in CPU_ON

In reply to Greg Kroah-Hartman

From: Oliver Upton <[email protected]>

commit 0acc7239c20a8401b8968c2adace8f7c9b0295ae upstream.

KVM/arm64 had the lock ordering backwards on vcpu->mutex and kvm->lock from the very beginning. One such example is the way vCPU resets are
handled: the kvm->lock is acquired while handling a guest CPU_ON PSCI call.

Add a dedicated lock to serialize writes to kvm_vcpu_arch::{mp_state, reset_state}. Promote all accessors of mp_state to {READ,WRITE}_ONCE() as readers do not acquire the mp_state_lock. While at it, plug yet another race by taking the mp_state_lock in the KVM_SET_MP_STATE ioctl handler.

As changes to MP state are now guarded with a dedicated lock, drop the kvm->lock acquisition from the PSCI CPU_ON path. Similarly, move the reader of reset_state outside of the kvm->lock and instead protect it with the mp_state_lock. Note that writes to reset_state::reset have been demoted to regular stores as both readers and writers acquire the mp_state_lock.

While the kvm->lock inversion still exists in kvm_reset_vcpu(), at least now PSCI CPU_ON no longer depends on it for serializing vCPU reset.

---
 arch/arm64/include/asm/kvm_host.h |    1 +
 arch/arm64/kvm/arm.c              |   31 ++++++++++++++++++++++---------
 arch/arm64/kvm/psci.c             |   28 ++++++++++++++++------------
 arch/arm64/kvm/reset.c            |    9 +++++----
 4 files changed, 44 insertions(+), 25 deletions(-)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -482,6 +482,7 @@ struct kvm_vcpu_arch {
 
 	/* vcpu power state */
 	struct kvm_mp_state mp_state;
+	spinlock_t mp_state_lock;
 
 	/* Cache some mmu pages needed inside spinlock regions */
 	struct kvm_mmu_memory_cache mmu_page_cache;
arch/arm64/kvm/arm.c +22 -9
@@ -336,6 +336,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu
 {
 	int err;
 
+	spin_lock_init(&vcpu->arch.mp_state_lock);
+
 	/* Force users to call KVM_ARM_VCPU_INIT */
 	vcpu->arch.target = -1;
 	bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES);
@@ -453,34 +455,41 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *
 	vcpu->cpu = -1;
 }
 
-void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu)
+static void __kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu)
 {
-	vcpu->arch.mp_state.mp_state = KVM_MP_STATE_STOPPED;
+	WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_STOPPED);
 	kvm_make_request(KVM_REQ_SLEEP, vcpu);
 	kvm_vcpu_kick(vcpu);
 }
 
+void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu)
+{
+	spin_lock(&vcpu->arch.mp_state_lock);
+	__kvm_arm_vcpu_power_off(vcpu);
+	spin_unlock(&vcpu->arch.mp_state_lock);
+}
+
 bool kvm_arm_vcpu_stopped(struct kvm_vcpu *vcpu)
 {
-	return vcpu->arch.mp_state.mp_state == KVM_MP_STATE_STOPPED;
+	return READ_ONCE(vcpu->arch.mp_state.mp_state) == KVM_MP_STATE_STOPPED;
 }
 
 static void kvm_arm_vcpu_suspend(struct kvm_vcpu *vcpu)
 {
-	vcpu->arch.mp_state.mp_state = KVM_MP_STATE_SUSPENDED;
+	WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_SUSPENDED);
 	kvm_make_request(KVM_REQ_SUSPEND, vcpu);
 	kvm_vcpu_kick(vcpu);
 }
 
 static bool kvm_arm_vcpu_suspended(struct kvm_vcpu *vcpu)
 {
-	return vcpu->arch.mp_state.mp_state == KVM_MP_STATE_SUSPENDED;
+	return READ_ONCE(vcpu->arch.mp_state.mp_state) == KVM_MP_STATE_SUSPENDED;
 }
 
 int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
 				    struct kvm_mp_state *mp_state)
 {
-	*mp_state = vcpu->arch.mp_state;
+	*mp_state = READ_ONCE(vcpu->arch.mp_state);
 
 	return 0;
 }
@@ -490,12 +499,14 @@ int kvm_arch_vcpu_ioctl_set_mpstate(stru
 {
 	int ret = 0;
 
+	spin_lock(&vcpu->arch.mp_state_lock);
+
 	switch (mp_state->mp_state) {
 	case KVM_MP_STATE_RUNNABLE:
-		vcpu->arch.mp_state = *mp_state;
+		WRITE_ONCE(vcpu->arch.mp_state, *mp_state);
 		break;
 	case KVM_MP_STATE_STOPPED:
-		kvm_arm_vcpu_power_off(vcpu);
+		__kvm_arm_vcpu_power_off(vcpu);
 		break;
 	case KVM_MP_STATE_SUSPENDED:
 		kvm_arm_vcpu_suspend(vcpu);
@@ -504,6 +515,8 @@ int kvm_arch_vcpu_ioctl_set_mpstate(stru
 		ret = -EINVAL;
 	}
 
+	spin_unlock(&vcpu->arch.mp_state_lock);
+
 	return ret;
 }
 
@@ -1223,7 +1236,7 @@ static int kvm_arch_vcpu_ioctl_vcpu_init
 	if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
 		kvm_arm_vcpu_power_off(vcpu);
 	else
-		vcpu->arch.mp_state.mp_state = KVM_MP_STATE_RUNNABLE;
+		WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_RUNNABLE);
 
 	return 0;
 }
arch/arm64/kvm/psci.c +16 -12
@@ -62,6 +62,7 @@ static unsigned long kvm_psci_vcpu_on(st
 	struct vcpu_reset_state *reset_state;
 	struct kvm *kvm = source_vcpu->kvm;
 	struct kvm_vcpu *vcpu = NULL;
+	int ret = PSCI_RET_SUCCESS;
 	unsigned long cpu_id;
 
 	cpu_id = smccc_get_arg1(source_vcpu);
@@ -76,11 +77,15 @@ static unsigned long kvm_psci_vcpu_on(st
 	 */
 	if (!vcpu)
 		return PSCI_RET_INVALID_PARAMS;
+
+	spin_lock(&vcpu->arch.mp_state_lock);
 	if (!kvm_arm_vcpu_stopped(vcpu)) {
 		if (kvm_psci_version(source_vcpu) != KVM_ARM_PSCI_0_1)
-			return PSCI_RET_ALREADY_ON;
+			ret = PSCI_RET_ALREADY_ON;
 		else
-			return PSCI_RET_INVALID_PARAMS;
+			ret = PSCI_RET_INVALID_PARAMS;
+
+		goto out_unlock;
 	}
 
 	reset_state = &vcpu->arch.reset_state;
@@ -96,7 +101,7 @@ static unsigned long kvm_psci_vcpu_on(st
 	 */
 	reset_state->r0 = smccc_get_arg3(source_vcpu);
 
-	WRITE_ONCE(reset_state->reset, true);
+	reset_state->reset = true;
 	kvm_make_request(KVM_REQ_VCPU_RESET, vcpu);
 
 	/*
@@ -108,7 +113,9 @@ static unsigned long kvm_psci_vcpu_on(st
 	vcpu->arch.mp_state.mp_state = KVM_MP_STATE_RUNNABLE;
 	kvm_vcpu_wake_up(vcpu);
 
-	return PSCI_RET_SUCCESS;
+out_unlock:
+	spin_unlock(&vcpu->arch.mp_state_lock);
+	return ret;
 }
 
 static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu)
@@ -168,8 +175,11 @@ static void kvm_prepare_system_event(str
 	 * after this call is handled and before the VCPUs have been
 	 * re-initialized.
 	 */
-	kvm_for_each_vcpu(i, tmp, vcpu->kvm)
-		tmp->arch.mp_state.mp_state = KVM_MP_STATE_STOPPED;
+	kvm_for_each_vcpu(i, tmp, vcpu->kvm) {
+		spin_lock(&tmp->arch.mp_state_lock);
+		WRITE_ONCE(tmp->arch.mp_state.mp_state, KVM_MP_STATE_STOPPED);
+		spin_unlock(&tmp->arch.mp_state_lock);
+	}
 	kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP);
 
 	memset(&vcpu->run->system_event, 0, sizeof(vcpu->run->system_event));
@@ -229,7 +239,6 @@ static unsigned long kvm_psci_check_allo
 
 static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
 {
-	struct kvm *kvm = vcpu->kvm;
 	u32 psci_fn = smccc_get_function(vcpu);
 	unsigned long val;
 	int ret = 1;
@@ -254,9 +263,7 @@ static int kvm_psci_0_2_call(struct kvm_
 		kvm_psci_narrow_to_32bit(vcpu);
 		fallthrough;
 	case PSCI_0_2_FN64_CPU_ON:
-		mutex_lock(&kvm->lock);
 		val = kvm_psci_vcpu_on(vcpu);
-		mutex_unlock(&kvm->lock);
 		break;
 	case PSCI_0_2_FN_AFFINITY_INFO:
 		kvm_psci_narrow_to_32bit(vcpu);
@@ -395,7 +402,6 @@ static int kvm_psci_1_x_call(struct kvm_
 
 static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
 {
-	struct kvm *kvm = vcpu->kvm;
 	u32 psci_fn = smccc_get_function(vcpu);
 	unsigned long val;
 
@@ -405,9 +411,7 @@ static int kvm_psci_0_1_call(struct kvm_
 		val = PSCI_RET_SUCCESS;
 		break;
 	case KVM_PSCI_FN_CPU_ON:
-		mutex_lock(&kvm->lock);
 		val = kvm_psci_vcpu_on(vcpu);
-		mutex_unlock(&kvm->lock);
 		break;
 	default:
 		val = PSCI_RET_NOT_SUPPORTED;
arch/arm64/kvm/reset.c +5 -4
@@ -255,15 +255,16 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu
 
 	mutex_lock(&vcpu->kvm->lock);
 	ret = kvm_set_vm_width(vcpu);
-	if (!ret) {
-		reset_state = vcpu->arch.reset_state;
-		WRITE_ONCE(vcpu->arch.reset_state.reset, false);
-	}
 	mutex_unlock(&vcpu->kvm->lock);
 
 	if (ret)
 		return ret;
 
+	spin_lock(&vcpu->arch.mp_state_lock);
+	reset_state = vcpu->arch.reset_state;
+	vcpu->arch.reset_state.reset = false;
+	spin_unlock(&vcpu->arch.mp_state_lock);
+
 	/* Reset PMU outside of the non-preemptible section */
 	kvm_pmu_vcpu_reset(vcpu);
 
author maintainer
#80 lore raw

PATCH 80/663 KVM: arm64: Avoid lock inversion when setting the VM register width

In reply to Greg Kroah-Hartman

From: Oliver Upton <[email protected]>

commit c43120afb5c66a3465c7468f5cf9806a26484cde upstream.

kvm->lock must be taken outside of the vcpu->mutex. Of course, the locking documentation for KVM makes this abundantly clear. Nonetheless, the locking order in KVM/arm64 has been wrong for quite a while; we acquire the kvm->lock while holding the vcpu->mutex all over the shop.

All was seemingly fine until commit 42a90008f890 ("KVM: Ensure lockdep knows about kvm->lock vs. vcpu->mutex ordering rule") caught us with our pants down, leading to lockdep barfing:

======================================================
WARNING: possible circular locking dependency detected 6.2.0-rc7+ #19 Not tainted
------------------------------------------------------
qemu-system-aar/859 is trying to acquire lock:
ffff5aa69269eba0 (&host_kvm->lock){+.+.}-{3:3}, at: kvm_reset_vcpu+0x34/0x274

but task is already holding lock:
ffff5aa68768c0b8 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x8c/0xba0

which lock already depends on the new lock.

Add a dedicated lock to serialize writes to VM-scoped configuration from the context of a vCPU. Protect the register width flags with the new lock, thus avoiding the need to grab the kvm->lock while holding vcpu->mutex in kvm_reset_vcpu().

---
 arch/arm64/include/asm/kvm_host.h |    3 +++
 arch/arm64/kvm/arm.c              |   18 ++++++++++++++++++
 arch/arm64/kvm/reset.c            |    6 +++---
 3 files changed, 24 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +3 -0
@@ -191,6 +191,9 @@ struct kvm_arch {
 	/* Mandated version of PSCI */
 	u32 psci_version;
 
+	/* Protects VM-scoped configuration data */
+	struct mutex config_lock;
+
 	/*
 	 * If we encounter a data abort without valid instruction syndrome
 	 * information, report this to user space.  User space can (and
arch/arm64/kvm/arm.c +18 -0
@@ -138,6 +138,16 @@ int kvm_arch_init_vm(struct kvm *kvm, un
 {
 	int ret;
 
+	mutex_init(&kvm->arch.config_lock);
+
+#ifdef CONFIG_LOCKDEP
+	/* Clue in lockdep that the config_lock must be taken inside kvm->lock */
+	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
+	mutex_unlock(&kvm->arch.config_lock);
+	mutex_unlock(&kvm->lock);
+#endif
+
 	ret = kvm_share_hyp(kvm, kvm + 1);
 	if (ret)
 		return ret;
@@ -338,6 +348,14 @@ int kvm_arch_vcpu_create(struct kvm_vcpu
 
 	spin_lock_init(&vcpu->arch.mp_state_lock);
 
+#ifdef CONFIG_LOCKDEP
+	/* Inform lockdep that the config_lock is acquired after vcpu->mutex */
+	mutex_lock(&vcpu->mutex);
+	mutex_lock(&vcpu->kvm->arch.config_lock);
+	mutex_unlock(&vcpu->kvm->arch.config_lock);
+	mutex_unlock(&vcpu->mutex);
+#endif
+
 	/* Force users to call KVM_ARM_VCPU_INIT */
 	vcpu->arch.target = -1;
 	bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES);
arch/arm64/kvm/reset.c +3 -3
@@ -200,7 +200,7 @@ static int kvm_set_vm_width(struct kvm_v
 
 	is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT);
 
-	lockdep_assert_held(&kvm->lock);
+	lockdep_assert_held(&kvm->arch.config_lock);
 
 	if (test_bit(KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED, &kvm->arch.flags)) {
 		/*
@@ -253,9 +253,9 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu
 	bool loaded;
 	u32 pstate;
 
-	mutex_lock(&vcpu->kvm->lock);
+	mutex_lock(&vcpu->kvm->arch.config_lock);
 	ret = kvm_set_vm_width(vcpu);
-	mutex_unlock(&vcpu->kvm->lock);
+	mutex_unlock(&vcpu->kvm->arch.config_lock);
 
 	if (ret)
 		return ret;
author maintainer
#81 lore raw

PATCH 81/663 KVM: arm64: Use config_lock to protect data ordered against KVM_RUN

In reply to Greg Kroah-Hartman

From: Oliver Upton <[email protected]>

commit 4bba7f7def6f278266dadf845da472cfbfed784e upstream.

There are various bits of VM-scoped data that can only be configured before the first call to KVM_RUN, such as the hypercall bitmaps and the PMU. As these fields are protected by the kvm->lock and accessed while holding vcpu->mutex, this is yet another example of lock inversion.

Change out the kvm->lock for kvm->arch.config_lock in all of these instances. Opportunistically simplify the locking mechanics of the PMU configuration by holding the config_lock for the entirety of kvm_arm_pmu_v3_set_attr().

Note that this also addresses a couple of bugs. There is an unguarded read of the PMU version in KVM_ARM_VCPU_PMU_V3_FILTER which could race with KVM_ARM_VCPU_PMU_V3_SET_PMU. Additionally, until now writes to the per-vCPU vPMU irq were not serialized VM-wide, meaning concurrent calls to KVM_ARM_VCPU_PMU_V3_IRQ could lead to a false positive in pmu_irq_is_valid().

---
 arch/arm64/kvm/arm.c        |    4 ++--
 arch/arm64/kvm/guest.c      |    2 ++
 arch/arm64/kvm/hypercalls.c |    4 ++--
 arch/arm64/kvm/pmu-emul.c   |   23 ++++++-----------------
 4 files changed, 12 insertions(+), 21 deletions(-)
arch/arm64/kvm/arm.c +2 -2
@@ -634,9 +634,9 @@ int kvm_arch_vcpu_run_pid_change(struct
 	if (kvm_vm_is_protected(kvm))
 		kvm_call_hyp_nvhe(__pkvm_vcpu_init_traps, vcpu);
 
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 	set_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags);
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 
 	return ret;
 }
arch/arm64/kvm/guest.c +2 -0
@@ -951,7 +951,9 @@ int kvm_arm_vcpu_arch_set_attr(struct kv
 
 	switch (attr->group) {
 	case KVM_ARM_VCPU_PMU_V3_CTRL:
+		mutex_lock(&vcpu->kvm->arch.config_lock);
 		ret = kvm_arm_pmu_v3_set_attr(vcpu, attr);
+		mutex_unlock(&vcpu->kvm->arch.config_lock);
 		break;
 	case KVM_ARM_VCPU_TIMER_CTRL:
 		ret = kvm_arm_timer_set_attr(vcpu, attr);
arch/arm64/kvm/hypercalls.c +2 -2
@@ -377,7 +377,7 @@ static int kvm_arm_set_fw_reg_bmap(struc
 	if (val & ~fw_reg_features)
 		return -EINVAL;
 
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 
 	if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags) &&
 	    val != *fw_reg_bmap) {
@@ -387,7 +387,7 @@ static int kvm_arm_set_fw_reg_bmap(struc
 
 	WRITE_ONCE(*fw_reg_bmap, val);
 out:
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 	return ret;
 }
 
arch/arm64/kvm/pmu-emul.c +6 -17
@@ -876,7 +876,7 @@ static int kvm_arm_pmu_v3_set_pmu(struct
 	struct arm_pmu *arm_pmu;
 	int ret = -ENXIO;
 
-	mutex_lock(&kvm->lock);
+	lockdep_assert_held(&kvm->arch.config_lock);
 	mutex_lock(&arm_pmus_lock);
 
 	list_for_each_entry(entry, &arm_pmus, entry) {
@@ -896,7 +896,6 @@ static int kvm_arm_pmu_v3_set_pmu(struct
 	}
 
 	mutex_unlock(&arm_pmus_lock);
-	mutex_unlock(&kvm->lock);
 	return ret;
 }
 
@@ -904,22 +903,20 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_v
 {
 	struct kvm *kvm = vcpu->kvm;
 
+	lockdep_assert_held(&kvm->arch.config_lock);
+
 	if (!kvm_vcpu_has_pmu(vcpu))
 		return -ENODEV;
 
 	if (vcpu->arch.pmu.created)
 		return -EBUSY;
 
-	mutex_lock(&kvm->lock);
 	if (!kvm->arch.arm_pmu) {
 		/* No PMU set, get the default one */
 		kvm->arch.arm_pmu = kvm_pmu_probe_armpmu();
-		if (!kvm->arch.arm_pmu) {
-			mutex_unlock(&kvm->lock);
+		if (!kvm->arch.arm_pmu)
 			return -ENODEV;
-		}
 	}
-	mutex_unlock(&kvm->lock);
 
 	switch (attr->attr) {
 	case KVM_ARM_VCPU_PMU_V3_IRQ: {
@@ -963,19 +960,13 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_v
 		     filter.action != KVM_PMU_EVENT_DENY))
 			return -EINVAL;
 
-		mutex_lock(&kvm->lock);
-
-		if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags)) {
-			mutex_unlock(&kvm->lock);
+		if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags))
 			return -EBUSY;
-		}
 
 		if (!kvm->arch.pmu_filter) {
 			kvm->arch.pmu_filter = bitmap_alloc(nr_events, GFP_KERNEL_ACCOUNT);
-			if (!kvm->arch.pmu_filter) {
-				mutex_unlock(&kvm->lock);
+			if (!kvm->arch.pmu_filter)
 				return -ENOMEM;
-			}
 
 			/*
 			 * The default depends on the first applied filter.
@@ -994,8 +985,6 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_v
 		else
 			bitmap_clear(kvm->arch.pmu_filter, filter.base_event, filter.nevents);
 
-		mutex_unlock(&kvm->lock);
-
 		return 0;
 	}
 	case KVM_ARM_VCPU_PMU_V3_SET_PMU: {
author maintainer
#82 lore raw

PATCH 82/663 KVM: arm64: Use config_lock to protect vgic state

In reply to Greg Kroah-Hartman

From: Oliver Upton <[email protected]>

commit f00327731131d1b5aa6a1aa9f50bcf8d620ace4c upstream.

Almost all of the vgic state is VM-scoped but accessed from the context of a vCPU. These accesses were serialized on the kvm->lock which cannot be nested within a vcpu->mutex critical section.

Move over the vgic state to using the config_lock. Tweak the lock ordering where necessary to ensure that the config_lock is acquired after the vcpu->mutex. Acquire the config_lock in kvm_vgic_create() to avoid a race between the converted flows and GIC creation. Where necessary, continue to acquire kvm->lock to avoid a race with vCPU creation (i.e. flows that use lock_all_vcpus()).

Finally, promote the locking expectations in comments to lockdep assertions and update the locking documentation for the config_lock as well as vcpu->mutex.

---
 arch/arm64/kvm/vgic/vgic-debug.c      |    8 ++---
 arch/arm64/kvm/vgic/vgic-init.c       |   36 ++++++++++++++++----------
 arch/arm64/kvm/vgic/vgic-its.c        |   18 ++++++++-----
 arch/arm64/kvm/vgic/vgic-kvm-device.c |   47 ++++++++++++++++++++--------------
 arch/arm64/kvm/vgic/vgic-mmio-v3.c    |    4 +-
 arch/arm64/kvm/vgic/vgic-mmio.c       |   12 ++++----
 arch/arm64/kvm/vgic/vgic-v4.c         |   11 ++++---
 arch/arm64/kvm/vgic/vgic.c            |   12 +++++---
 8 files changed, 88 insertions(+), 60 deletions(-)
arch/arm64/kvm/vgic/vgic-debug.c +4 -4
@@ -85,7 +85,7 @@ static void *vgic_debug_start(struct seq
 	struct kvm *kvm = s->private;
 	struct vgic_state_iter *iter;
 
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 	iter = kvm->arch.vgic.iter;
 	if (iter) {
 		iter = ERR_PTR(-EBUSY);
@@ -104,7 +104,7 @@ static void *vgic_debug_start(struct seq
 	if (end_of_vgic(iter))
 		iter = NULL;
 out:
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 	return iter;
 }
 
@@ -132,12 +132,12 @@ static void vgic_debug_stop(struct seq_f
 	if (IS_ERR(v))
 		return;
 
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 	iter = kvm->arch.vgic.iter;
 	kfree(iter->lpi_array);
 	kfree(iter);
 	kvm->arch.vgic.iter = NULL;
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 }
 
 static void print_dist_state(struct seq_file *s, struct vgic_dist *dist)
arch/arm64/kvm/vgic/vgic-init.c +23 -13
@@ -74,9 +74,6 @@ int kvm_vgic_create(struct kvm *kvm, u32
 	unsigned long i;
 	int ret;
 
-	if (irqchip_in_kernel(kvm))
-		return -EEXIST;
-
 	/*
 	 * This function is also called by the KVM_CREATE_IRQCHIP handler,
 	 * which had no chance yet to check the availability of the GICv2
@@ -87,10 +84,20 @@ int kvm_vgic_create(struct kvm *kvm, u32
 		!kvm_vgic_global_state.can_emulate_gicv2)
 		return -ENODEV;
 
+	/* Must be held to avoid race with vCPU creation */
+	lockdep_assert_held(&kvm->lock);
+
 	ret = -EBUSY;
 	if (!lock_all_vcpus(kvm))
 		return ret;
 
+	mutex_lock(&kvm->arch.config_lock);
+
+	if (irqchip_in_kernel(kvm)) {
+		ret = -EEXIST;
+		goto out_unlock;
+	}
+
 	kvm_for_each_vcpu(i, vcpu, kvm) {
 		if (vcpu_has_run_once(vcpu))
 			goto out_unlock;
@@ -118,6 +125,7 @@ int kvm_vgic_create(struct kvm *kvm, u32
 		INIT_LIST_HEAD(&kvm->arch.vgic.rd_regions);
 
 out_unlock:
+	mutex_unlock(&kvm->arch.config_lock);
 	unlock_all_vcpus(kvm);
 	return ret;
 }
@@ -227,9 +235,9 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *
 	 * KVM io device for the redistributor that belongs to this VCPU.
 	 */
 	if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
-		mutex_lock(&vcpu->kvm->lock);
+		mutex_lock(&vcpu->kvm->arch.config_lock);
 		ret = vgic_register_redist_iodev(vcpu);
-		mutex_unlock(&vcpu->kvm->lock);
+		mutex_unlock(&vcpu->kvm->arch.config_lock);
 	}
 	return ret;
 }
@@ -250,7 +258,6 @@ static void kvm_vgic_vcpu_enable(struct
  * The function is generally called when nr_spis has been explicitly set
  * by the guest through the KVM DEVICE API. If not nr_spis is set to 256.
  * vgic_initialized() returns true when this function has succeeded.
- * Must be called with kvm->lock held!
  */
 int vgic_init(struct kvm *kvm)
 {
@@ -259,6 +266,8 @@ int vgic_init(struct kvm *kvm)
 	int ret = 0, i;
 	unsigned long idx;
 
+	lockdep_assert_held(&kvm->arch.config_lock);
+
 	if (vgic_initialized(kvm))
 		return 0;
 
@@ -373,12 +382,13 @@ void kvm_vgic_vcpu_destroy(struct kvm_vc
 	vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
 }
 
-/* To be called with kvm->lock held */
 static void __kvm_vgic_destroy(struct kvm *kvm)
 {
 	struct kvm_vcpu *vcpu;
 	unsigned long i;
 
+	lockdep_assert_held(&kvm->arch.config_lock);
+
 	vgic_debug_destroy(kvm);
 
 	kvm_for_each_vcpu(i, vcpu, kvm)
@@ -389,9 +399,9 @@ static void __kvm_vgic_destroy(struct kv
 
 void kvm_vgic_destroy(struct kvm *kvm)
 {
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 	__kvm_vgic_destroy(kvm);
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 }
 
 /**
@@ -414,9 +424,9 @@ int vgic_lazy_init(struct kvm *kvm)
 		if (kvm->arch.vgic.vgic_model != KVM_DEV_TYPE_ARM_VGIC_V2)
 			return -EBUSY;
 
-		mutex_lock(&kvm->lock);
+		mutex_lock(&kvm->arch.config_lock);
 		ret = vgic_init(kvm);
-		mutex_unlock(&kvm->lock);
+		mutex_unlock(&kvm->arch.config_lock);
 	}
 
 	return ret;
@@ -441,7 +451,7 @@ int kvm_vgic_map_resources(struct kvm *k
 	if (likely(vgic_ready(kvm)))
 		return 0;
 
-	mutex_lock(&kvm->lock);
+	mutex_lock(&kvm->arch.config_lock);
 	if (vgic_ready(kvm))
 		goto out;
 
@@ -459,7 +469,7 @@ int kvm_vgic_map_resources(struct kvm *k
 		dist->ready = true;
 
 out:
-	mutex_unlock(&kvm->lock);
+	mutex_unlock(&kvm->arch.config_lock);
 	return ret;
 }
 
arch/arm64/kvm/vgic/vgic-its.c +12 -6
@@ -2045,6 +2045,13 @@ static int vgic_its_attr_regs_access(str
 
 	mutex_lock(&dev->kvm->lock);
 
+	if (!lock_all_vcpus(dev->kvm)) {
+		mutex_unlock(&dev->kvm->lock);
+		return -EBUSY;
+	}
+
+	mutex_lock(&dev->kvm->arch.config_lock);
+
 	if (IS_VGIC_ADDR_UNDEF(its->vgic_its_base)) {
 		ret = -ENXIO;
 		goto out;
@@ -2058,11 +2065,6 @@ static int vgic_its_attr_regs_access(str
 		goto out;
 	}
 
-	if (!lock_all_vcpus(dev->kvm)) {
-		ret = -EBUSY;
-		goto out;
-	}
-
 	addr = its->vgic_its_base + offset;
 
 	len = region->access_flags & VGIC_ACCESS_64bit ? 8 : 4;
@@ -2076,8 +2078,9 @@ static int vgic_its_attr_regs_access(str
 	} else {
 		*reg = region->its_read(dev->kvm, its, addr, len);
 	}
-	unlock_all_vcpus(dev->kvm);
 out:
+	mutex_unlock(&dev->kvm->arch.config_lock);
+	unlock_all_vcpus(dev->kvm);
 	mutex_unlock(&dev->kvm->lock);
 	return ret;
 }
@@ -2757,6 +2760,8 @@ static int vgic_its_ctrl(struct kvm *kvm
 		return -EBUSY;
 	}
 
+	mutex_lock(&kvm->arch.config_lock);
+
 	switch (attr) {
 	case KVM_DEV_ARM_ITS_CTRL_RESET:
 		vgic_its_reset(kvm, its);
@@ -2769,6 +2774,7 @@ static int vgic_its_ctrl(struct kvm *kvm
 		break;
 	}
 
+	mutex_unlock(&kvm->arch.config_lock);
 	unlock_all_vcpus(kvm);
 	mutex_unlock(&its->its_lock);
 	mutex_unlock(&kvm->lock);
arch/arm64/kvm/vgic/vgic-kvm-device.c +28 -19

129 lines not on this page · raw message

arch/arm64/kvm/vgic/vgic-mmio-v3.c +2 -2
@@ -111,7 +111,7 @@ static void vgic_mmio_write_v3_misc(stru
 	case GICD_CTLR: {
 		bool was_enabled, is_hwsgi;
 
-		mutex_lock(&vcpu->kvm->lock);
+		mutex_lock(&vcpu->kvm->arch.config_lock);
 
 		was_enabled = dist->enabled;
 		is_hwsgi = dist->nassgireq;
@@ -139,7 +139,7 @@ static void vgic_mmio_write_v3_misc(stru
 		else if (!was_enabled && dist->enabled)
 			vgic_kick_vcpus(vcpu->kvm);
 
-		mutex_unlock(&vcpu->kvm->lock);
+		mutex_unlock(&vcpu->kvm->arch.config_lock);
 		break;
 	}
 	case GICD_TYPER:
arch/arm64/kvm/vgic/vgic-mmio.c +6 -6
@@ -527,13 +527,13 @@ unsigned long vgic_mmio_read_active(stru
 	u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
 	u32 val;
 
-	mutex_lock(&vcpu->kvm->lock);
+	mutex_lock(&vcpu->kvm->arch.config_lock);
 	vgic_access_active_prepare(vcpu, intid);
 
 	val = __vgic_mmio_read_active(vcpu, addr, len);
 
 	vgic_access_active_finish(vcpu, intid);
-	mutex_unlock(&vcpu->kvm->lock);
+	mutex_unlock(&vcpu->kvm->arch.config_lock);
 
 	return val;
 }
@@ -622,13 +622,13 @@ void vgic_mmio_write_cactive(struct kvm_
 {
 	u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
 
-	mutex_lock(&vcpu->kvm->lock);
+	mutex_lock(&vcpu->kvm->arch.config_lock);
 	vgic_access_active_prepare(vcpu, intid);
 
 	__vgic_mmio_write_cactive(vcpu, addr, len, val);
 
 	vgic_access_active_finish(vcpu, intid);
-	mutex_unlock(&vcpu->kvm->lock);
+	mutex_unlock(&vcpu->kvm->arch.config_lock);
 }
 
 int vgic_mmio_uaccess_write_cactive(struct kvm_vcpu *vcpu,
@@ -659,13 +659,13 @@ void vgic_mmio_write_sactive(struct kvm_
 {
 	u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
 
-	mutex_lock(&vcpu->kvm->lock);
+	mutex_lock(&vcpu->kvm->arch.config_lock);
 	vgic_access_active_prepare(vcpu, intid);
 
 	__vgic_mmio_write_sactive(vcpu, addr, len, val);
 
 	vgic_access_active_finish(vcpu, intid);
-	mutex_unlock(&vcpu->kvm->lock);
+	mutex_unlock(&vcpu->kvm->arch.config_lock);
 }
 
 int vgic_mmio_uaccess_write_sactive(struct kvm_vcpu *vcpu,
arch/arm64/kvm/vgic/vgic-v4.c +6 -5
@@ -232,9 +232,8 @@ int vgic_v4_request_vpe_irq(struct kvm_v
  * @kvm:	Pointer to the VM being initialized
  *
  * We may be called each time a vITS is created, or when the
- * vgic is initialized. This relies on kvm->lock to be
- * held. In both cases, the number of vcpus should now be
- * fixed.
+ * vgic is initialized. In both cases, the number of vcpus
+ * should now be fixed.
  */
 int vgic_v4_init(struct kvm *kvm)
 {
@@ -243,6 +242,8 @@ int vgic_v4_init(struct kvm *kvm)
 	int nr_vcpus, ret;
 	unsigned long i;
 
+	lockdep_assert_held(&kvm->arch.config_lock);
+
 	if (!kvm_vgic_global_state.has_gicv4)
 		return 0; /* Nothing to see here... move along. */
 
@@ -309,14 +310,14 @@ int vgic_v4_init(struct kvm *kvm)
 /**
  * vgic_v4_teardown - Free the GICv4 data structures
  * @kvm:	Pointer to the VM being destroyed
- *
- * Relies on kvm->lock to be held.
  */
 void vgic_v4_teardown(struct kvm *kvm)
 {
 	struct its_vm *its_vm = &kvm->arch.vgic.its_vm;
 	int i;
 
+	lockdep_assert_held(&kvm->arch.config_lock);
+
 	if (!its_vm->vpes)
 		return;
 
arch/arm64/kvm/vgic/vgic.c +7 -5
@@ -24,11 +24,13 @@ struct vgic_global kvm_vgic_global_state
 /*
  * Locking order is always:
  * kvm->lock (mutex)
- *   its->cmd_lock (mutex)
- *     its->its_lock (mutex)
- *       vgic_cpu->ap_list_lock		must be taken with IRQs disabled
- *         kvm->lpi_list_lock		must be taken with IRQs disabled
- *           vgic_irq->irq_lock		must be taken with IRQs disabled
+ *   vcpu->mutex (mutex)
+ *     kvm->arch.config_lock (mutex)
+ *       its->cmd_lock (mutex)
+ *         its->its_lock (mutex)
+ *           vgic_cpu->ap_list_lock		must be taken with IRQs disabled
+ *             kvm->lpi_list_lock		must be taken with IRQs disabled
+ *               vgic_irq->irq_lock		must be taken with IRQs disabled
  *
  * As the ap_list_lock might be taken from the timer interrupt handler,
  * we have to disable IRQs before taking this lock and everything lower
author maintainer
#65 lore raw

PATCH 65/663 soundwire: qcom: correct setting ignore bit on v1.5.1

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

commit bd934f77eeac377e81ddac8673803e7334b82d3d upstream.

According to the comment and to downstream sources, the SWRM_CONTINUE_EXEC_ON_CMD_IGNORE in SWRM_CMD_FIFO_CFG_ADDR register should be set for v1.5.1 and newer, so fix the >= operator.

Fixes 542d3491cdd7 ("soundwire: qcom: set continue execution flag for ignored commands")
---
 drivers/soundwire/qcom.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
@@ -704,7 +704,7 @@ static int qcom_swrm_init(struct qcom_sw
 	}
 
 	/* Configure number of retries of a read/write cmd */
-	if (ctrl->version > 0x01050001) {
+	if (ctrl->version >= 0x01050001) {
 		/* Only for versions >= 1.5.1 */
 		ctrl->reg_write(ctrl, SWRM_CMD_FIFO_CFG_ADDR,
 				SWRM_RD_WR_CMD_RETRIES |
author maintainer
#83 lore raw

PATCH 83/663 KVM: arm64: vgic: Dont acquire its_lock before config_lock

In reply to Greg Kroah-Hartman

From: Oliver Upton <[email protected]>

commit 49e5d16b6fc003407a33a9961b4bcbb970bd1c76 upstream.

commit f00327731131 ("KVM: arm64: Use config_lock to protect vgic state") was meant to rectify a longstanding lock ordering issue in KVM where the kvm->lock is taken while holding vcpu->mutex. As it so happens, the aforementioned commit introduced yet another locking issue by acquiring the its_lock before acquiring the config lock.

This is obviously wrong, especially considering that the lock ordering is well documented in vgic.c. Reshuffle the locks once more to take the config_lock before the its_lock. While at it, sprinkle in the lockdep hinting that has become popular as of late to keep lockdep apprised of our ordering.

Fixes f00327731131 ("KVM: arm64: Use config_lock to protect vgic state")
---
 arch/arm64/kvm/vgic/vgic-its.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
arch/arm64/kvm/vgic/vgic-its.c +12 -3
@@ -1958,6 +1958,16 @@ static int vgic_its_create(struct kvm_de
 	mutex_init(&its->its_lock);
 	mutex_init(&its->cmd_lock);
 
+	/* Yep, even more trickery for lock ordering... */
+#ifdef CONFIG_LOCKDEP
+	mutex_lock(&dev->kvm->arch.config_lock);
+	mutex_lock(&its->cmd_lock);
+	mutex_lock(&its->its_lock);
+	mutex_unlock(&its->its_lock);
+	mutex_unlock(&its->cmd_lock);
+	mutex_unlock(&dev->kvm->arch.config_lock);
+#endif
+
 	its->vgic_its_base = VGIC_ADDR_UNDEF;
 
 	INIT_LIST_HEAD(&its->device_list);
@@ -2752,15 +2762,14 @@ static int vgic_its_ctrl(struct kvm *kvm
 		return 0;
 
 	mutex_lock(&kvm->lock);
-	mutex_lock(&its->its_lock);
 
 	if (!lock_all_vcpus(kvm)) {
-		mutex_unlock(&its->its_lock);
 		mutex_unlock(&kvm->lock);
 		return -EBUSY;
 	}
 
 	mutex_lock(&kvm->arch.config_lock);
+	mutex_lock(&its->its_lock);
 
 	switch (attr) {
 	case KVM_DEV_ARM_ITS_CTRL_RESET:
@@ -2774,9 +2783,9 @@ static int vgic_its_ctrl(struct kvm *kvm
 		break;
 	}
 
+	mutex_unlock(&its->its_lock);
 	mutex_unlock(&kvm->arch.config_lock);
 	unlock_all_vcpus(kvm);
-	mutex_unlock(&its->its_lock);
 	mutex_unlock(&kvm->lock);
 	return ret;
 }
author maintainer
#84 lore raw

PATCH 84/663 relayfs: fix out-of-bounds access in relay_file_read

In reply to Greg Kroah-Hartman

From: Zhang Zhengming <[email protected]>

commit 43ec16f1450f4936025a9bdf1a273affdb9732c1 upstream.

There is a crash in relay_file_read, as the var from point to the end of last subbuf.

The oops looks something like:

pc : __arch_copy_to_user+0x180/0x310
lr : relay_file_read+0x20c/0x2c8
Call trace:
 __arch_copy_to_user+0x180/0x310
 full_proxy_read+0x68/0x98
 vfs_read+0xb0/0x1d0
 ksys_read+0x6c/0xf0
 __arm64_sys_read+0x20/0x28
 el0_svc_common.constprop.3+0x84/0x108
 do_el0_svc+0x74/0x90
 el0_svc+0x1c/0x28
 el0_sync_handler+0x88/0xb0
 el0_sync+0x148/0x180

We get the condition by analyzing the vmcore:

1). The last produced byte and last consumed byte
both at the end of the last subbuf

2). A softirq calls function(e.g __blk_add_trace)

    to write relay buffer occurs when an program is calling
    relay_file_read_avail().

        relay_file_read
                relay_file_read_avail
                        relay_file_read_consume(buf, 0, 0);
                        //interrupted by softirq who will write subbuf
                        ....
                        return 1;
                //read_start point to the end of the last subbuf
                read_start = relay_file_read_start_pos
                //avail is equal to subsize
                avail = relay_file_read_subbuf_avail
                //from  points to an invalid memory address
                from = buf->start + read_start
                //system is crashed
                copy_to_user(buffer, from, avail)
---
 kernel/relay.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/relay.c +2 -1
@@ -989,7 +989,8 @@ static size_t relay_file_read_start_pos(
 	size_t subbuf_size = buf->chan->subbuf_size;
 	size_t n_subbufs = buf->chan->n_subbufs;
 	size_t consumed = buf->subbufs_consumed % n_subbufs;
-	size_t read_pos = consumed * subbuf_size + buf->bytes_consumed;
+	size_t read_pos = (consumed * subbuf_size + buf->bytes_consumed)
+			% (n_subbufs * subbuf_size);
 
 	read_subbuf = read_pos / subbuf_size;
 	padding = buf->padding[read_subbuf];
author maintainer
#85 lore raw

PATCH 85/663 drm/amd/display: Remove stutter only configurations

In reply to Greg Kroah-Hartman

From: Nasir Osman <[email protected]>

[ Upstream commit 71c4ca2d3b079d0ba4d9b3033641fea906cebfb6 ]

[why]
Newer ASICs such as DCN314 needs to allow for both self refresh and mem clk switching rather than just self refresh only. Otherwise, we can see some p-state hangs on ASICs that do support mem clk switching.

[how]
Added an allow_self_refresh_only flag for dcn30_internal_validate_bw and created a validate_bw method for DCN314 with the allow_self_refresh_only flag set to false (to support mem clk switching).

Stable-dep-of: 1e994cc0956b ("drm/amd/display: limit timing for single dimm memory")

---
 .../drm/amd/display/dc/dcn30/dcn30_resource.c | 16 +++---
 .../drm/amd/display/dc/dcn30/dcn30_resource.h |  3 +-
 .../drm/amd/display/dc/dcn31/dcn31_resource.c |  2 +-
 .../amd/display/dc/dcn314/dcn314_resource.c   | 57 ++++++++++++++++++-
 .../amd/display/dc/dcn314/dcn314_resource.h   |  4 ++
 .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c  |  2 +-
 6 files changed, 73 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +9 -7
index c18c52a60100e..c4e206aedf731 100644
@@ -1648,7 +1648,8 @@ noinline bool dcn30_internal_validate_bw(
 		display_e2e_pipe_params_st *pipes,
 		int *pipe_cnt_out,
 		int *vlevel_out,
-		bool fast_validate)
+		bool fast_validate,
+		bool allow_self_refresh_only)
 {
 	bool out = false;
 	bool repopulate_pipes = false;
@@ -1675,7 +1676,7 @@ noinline bool dcn30_internal_validate_bw(
 
 	dml_log_pipe_params(&context->bw_ctx.dml, pipes, pipe_cnt);
 
-	if (!fast_validate) {
+	if (!fast_validate || !allow_self_refresh_only) {
 		/*
 		 * DML favors voltage over p-state, but we're more interested in
 		 * supporting p-state over voltage. We can't support p-state in
@@ -1688,11 +1689,12 @@ noinline bool dcn30_internal_validate_bw(
 		if (vlevel < context->bw_ctx.dml.soc.num_states)
 			vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);
 	}
-	if (fast_validate || vlevel == context->bw_ctx.dml.soc.num_states ||
-			vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] == dm_dram_clock_change_unsupported) {
+	if (allow_self_refresh_only &&
+	    (fast_validate || vlevel == context->bw_ctx.dml.soc.num_states ||
+			vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] == dm_dram_clock_change_unsupported)) {
 		/*
-		 * If mode is unsupported or there's still no p-state support then
-		 * fall back to favoring voltage.
+		 * If mode is unsupported or there's still no p-state support
+		 * then fall back to favoring voltage.
 		 *
 		 * We don't actually support prefetch mode 2, so require that we
 		 * at least support prefetch mode 1.
@@ -2063,7 +2065,7 @@ bool dcn30_validate_bandwidth(struct dc *dc,
 	BW_VAL_TRACE_COUNT();
 
 	DC_FP_START();
-	out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);
+	out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate, true);
 	DC_FP_END();
 
 	if (pipe_cnt == 0)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.h +2 -1
index 7d063c7d6a4bf..8e6b8b7368fdb 100644
@@ -64,7 +64,8 @@ bool dcn30_internal_validate_bw(
 		display_e2e_pipe_params_st *pipes,
 		int *pipe_cnt_out,
 		int *vlevel_out,
-		bool fast_validate);
+		bool fast_validate,
+		bool allow_self_refresh_only);
 void dcn30_calculate_wm_and_dlg(
 		struct dc *dc, struct dc_state *context,
 		display_e2e_pipe_params_st *pipes,
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +1 -1
index 3ca517dcc82dc..d3918a10773a3 100644
@@ -1795,7 +1795,7 @@ bool dcn31_validate_bandwidth(struct dc *dc,
 	BW_VAL_TRACE_COUNT();
 
 	DC_FP_START();
-	out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);
+	out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate, true);
 	DC_FP_END();
 
 	// Disable fast_validate to set min dcfclk in alculate_wm_and_dlg
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +56 -1

69 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.h +4 -0
index 0dd3153aa5c17..49ffe71018dfb 100644
@@ -39,6 +39,10 @@ struct dcn314_resource_pool {
 	struct resource_pool base;
 };
 
+bool dcn314_validate_bandwidth(struct dc *dc,
+		struct dc_state *context,
+		bool fast_validate);
+
 struct resource_pool *dcn314_create_resource_pool(
 		const struct dc_init_data *init_data,
 		struct dc *dc);
drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +1 -1
index d4c0f9cdac8e2..4fa6363647937 100644
@@ -634,7 +634,7 @@ int dcn30_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc,
 	while (dummy_latency_index < max_latency_table_entries) {
 		context->bw_ctx.dml.soc.dram_clock_change_latency_us =
 				dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us;
-		dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false);
+		dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false, true);
 
 		if (context->bw_ctx.dml.soc.allow_dram_self_refresh_or_dram_clock_change_in_vblank ==
 			dm_allow_self_refresh_and_mclk_switch)
Signature · 1 line
2.39.2
author maintainer
#86 lore raw

PATCH 86/663 drm/amd/display: limit timing for single dimm memory

In reply to Greg Kroah-Hartman

From: Daniel Miess <[email protected]>

[ Upstream commit 1e994cc0956b8dabd1b1fef315bbd722733b8aa8 ]

[Why]
1. It could hit bandwidth limitdation under single dimm memory when connecting 8K external monitor.
2. IsSupportedVidPn got validation failed with 2K240Hz eDP + 8K24Hz external monitor.
3. It's better to filter out such combination in EnumVidPnCofuncModality
4. For short term, filter out in dc bandwidth validation.

[How]
Force 2K@240Hz+8K@24Hz timing validation false in dc.

---
 .../amd/display/dc/dcn314/dcn314_resource.c   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +20 -0
index 54ed3de869d3b..9ffba4c6fe550 100644
@@ -1697,6 +1697,23 @@ static void dcn314_get_panel_config_defaults(struct dc_panel_config *panel_confi
 	*panel_config = panel_config_defaults;
 }
 
+static bool filter_modes_for_single_channel_workaround(struct dc *dc,
+		struct dc_state *context)
+{
+	// Filter 2K@240Hz+8K@24fps above combination timing if memory only has single dimm LPDDR
+	if (dc->clk_mgr->bw_params->vram_type == 34 && dc->clk_mgr->bw_params->num_channels < 2) {
+		int total_phy_pix_clk = 0;
+
+		for (int i = 0; i < context->stream_count; i++)
+			if (context->res_ctx.pipe_ctx[i].stream)
+				total_phy_pix_clk += context->res_ctx.pipe_ctx[i].stream->phy_pix_clk;
+
+		if (total_phy_pix_clk >= (1148928+826260)) //2K@240Hz+8K@24fps
+			return true;
+	}
+	return false;
+}
+
 bool dcn314_validate_bandwidth(struct dc *dc,
 		struct dc_state *context,
 		bool fast_validate)
@@ -1712,6 +1729,9 @@ bool dcn314_validate_bandwidth(struct dc *dc,
 
 	BW_VAL_TRACE_COUNT();
 
+	if (filter_modes_for_single_channel_workaround(dc, context))
+		goto validate_fail;
+
 	DC_FP_START();
 	// do not support self refresh only
 	out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate, false);
Signature · 1 line
2.39.2
author maintainer
#87 lore raw

PATCH 87/663 drm/amd/display: fix PSR-SU/DSC interoperability support

In reply to Greg Kroah-Hartman

From: Hamza Mahfooz <[email protected]>

[ Upstream commit 13b90cf900ab69dd5cab3cc5035bc7614037e64e ]

Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass slice_height into su_y_granularity to feed the DSC slice height into PSR-SU code.

Stable-dep-of: 0b5dfe12755f ("drm/amd/display: fix a divided-by-zero error")

---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |  3 ++
 .../amd/display/modules/power/power_helpers.c | 31 +++++++++++++++++++
 .../amd/display/modules/power/power_helpers.h |  3 ++
 3 files changed, 37 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +3 -0
index 26291db0a3cf6..872d06fe14364 100644
@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream)
 		psr_config.allow_multi_disp_optimizations =
 			(amdgpu_dc_feature_mask & DC_PSR_ALLOW_MULTI_DISP_OPT);
 
+		if (!psr_su_set_y_granularity(dc, link, stream, &psr_config))
+			return false;
+
 		ret = dc_link_setup_psr(link, stream, &psr_config, &psr_context);
 
 	}
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +31 -0
index 9b5d9b2c9a6a7..cf4fa87c7db60 100644
@@ -916,3 +916,34 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s
 {
 	return context && context->stream_count == 1 && dc_is_embedded_signal(stream->signal);
 }
+
+bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
+			      struct dc_stream_state *stream,
+			      struct psr_config *config)
+{
+	uint16_t pic_height;
+	uint8_t slice_height;
+
+	if ((link->connector_signal & SIGNAL_TYPE_EDP) &&
+	    (!dc->caps.edp_dsc_support ||
+	    link->panel_config.dsc.disable_dsc_edp ||
+	    !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT ||
+	    !stream->timing.dsc_cfg.num_slices_v))
+		return true;
+
+	pic_height = stream->timing.v_addressable +
+		stream->timing.v_border_top + stream->timing.v_border_bottom;
+	slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v;
+
+	if (slice_height) {
+		if (config->su_y_granularity &&
+		    (slice_height % config->su_y_granularity)) {
+			ASSERT(0);
+			return false;
+		}
+
+		config->su_y_granularity = slice_height;
+	}
+
+	return true;
+}
drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3 -0
index 316452e9dbc91..bb16b37b83da7 100644
@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config,
 		const struct dc_stream_state *stream);
 bool mod_power_only_edp(const struct dc_state *context,
 		const struct dc_stream_state *stream);
+bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
+			      struct dc_stream_state *stream,
+			      struct psr_config *config);
 #endif /* MODULES_POWER_POWER_HELPERS_H_ */
Signature · 1 line
2.39.2
author maintainer
#88 lore raw

PATCH 88/663 drm/amd/display: fix a divided-by-zero error

In reply to Greg Kroah-Hartman

From: Alex Hung <[email protected]>

[ Upstream commit 0b5dfe12755f87ec014bb4cc1930485026167430 ]

[Why & How]

timing.dsc_cfg.num_slices_v can be zero and it is necessary to check before using it.

This fixes the error "divide error: 0000 [#1] PREEMPT SMP NOPTI".

---
 drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +4 -0
index cf4fa87c7db60..e75b443ee95dc 100644
@@ -933,6 +933,10 @@ bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
 
 	pic_height = stream->timing.v_addressable +
 		stream->timing.v_border_top + stream->timing.v_border_bottom;
+
+	if (stream->timing.dsc_cfg.num_slices_v == 0)
+		return false;
+
 	slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v;
 
 	if (slice_height) {
Signature · 1 line
2.39.2
author maintainer
#89 lore raw

PATCH 89/663 KVM: RISC-V: Retry fault if vma_lookup() results become invalid

In reply to Greg Kroah-Hartman

From: David Matlack <[email protected]>

commit 2ed90cb0938a45b12eb947af062d12c7af0067b3 upstream.

Read mmu_invalidate_seq before dropping the mmap_lock so that KVM can detect if the results of vma_lookup() (e.g. vma_shift) become stale before it acquires kvm->mmu_lock. This fixes a theoretical bug where a VMA could be changed by userspace after vma_lookup() and before KVM reads the mmu_invalidate_seq, causing KVM to install page table entries based on a (possibly) no-longer-valid vma_shift.

Re-order the MMU cache top-up to earlier in user_mem_abort() so that it is not done after KVM has read mmu_invalidate_seq (i.e. so as to avoid inducing spurious fault retries).

It's unlikely that any sane userspace currently modifies VMAs in such a way as to trigger this race. And even with directed testing I was unable to reproduce it. But a sufficiently motivated host userspace might be able to exploit this race.

Note KVM/ARM had the same bug and was fixed in a separate, near identical patch (see Link).

---
 arch/riscv/kvm/mmu.c |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
arch/riscv/kvm/mmu.c +16 -9
@@ -628,6 +628,13 @@ int kvm_riscv_gstage_map(struct kvm_vcpu
 			!(memslot->flags & KVM_MEM_READONLY)) ? true : false;
 	unsigned long vma_pagesize, mmu_seq;
 
+	/* We need minimum second+third level pages */
+	ret = kvm_mmu_topup_memory_cache(pcache, gstage_pgd_levels);
+	if (ret) {
+		kvm_err("Failed to topup G-stage cache\n");
+		return ret;
+	}
+
 	mmap_read_lock(current->mm);
 
 	vma = vma_lookup(current->mm, hva);
@@ -648,6 +655,15 @@ int kvm_riscv_gstage_map(struct kvm_vcpu
 	if (vma_pagesize == PMD_SIZE || vma_pagesize == PGDIR_SIZE)
 		gfn = (gpa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT;
 
+	/*
+	 * Read mmu_invalidate_seq so that KVM can detect if the results of
+	 * vma_lookup() or gfn_to_pfn_prot() become stale priort to acquiring
+	 * kvm->mmu_lock.
+	 *
+	 * Rely on mmap_read_unlock() for an implicit smp_rmb(), which pairs
+	 * with the smp_wmb() in kvm_mmu_invalidate_end().
+	 */
+	mmu_seq = kvm->mmu_invalidate_seq;
 	mmap_read_unlock(current->mm);
 
 	if (vma_pagesize != PGDIR_SIZE &&
@@ -657,15 +673,6 @@ int kvm_riscv_gstage_map(struct kvm_vcpu
 		return -EFAULT;
 	}
 
-	/* We need minimum second+third level pages */
-	ret = kvm_mmu_topup_memory_cache(pcache, gstage_pgd_levels);
-	if (ret) {
-		kvm_err("Failed to topup G-stage cache\n");
-		return ret;
-	}
-
-	mmu_seq = kvm->mmu_invalidate_seq;
-
 	hfn = gfn_to_pfn_prot(kvm, gfn, is_write, &writable);
 	if (hfn == KVM_PFN_ERR_HWPOISON) {
 		send_sig_mceerr(BUS_MCEERR_AR, (void __user *)hva,
author maintainer
#90 lore raw

PATCH 90/663 ksmbd: fix racy issue under cocurrent smb2 tree disconnect

In reply to Greg Kroah-Hartman

From: Namjae Jeon <[email protected]>

commit 30210947a343b6b3ca13adc9bfc88e1543e16dd5 upstream.

There is UAF issue under cocurrent smb2 tree disconnect. This patch introduce TREE_CONN_EXPIRE flags for tcon to avoid cocurrent access.

---
 fs/ksmbd/mgmt/tree_connect.c |   10 +++++++++-
 fs/ksmbd/mgmt/tree_connect.h |    3 +++
 fs/ksmbd/smb2pdu.c           |    3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)
fs/ksmbd/mgmt/tree_connect.c +9 -1
@@ -109,7 +109,15 @@ int ksmbd_tree_conn_disconnect(struct ks
 struct ksmbd_tree_connect *ksmbd_tree_conn_lookup(struct ksmbd_session *sess,
 						  unsigned int id)
 {
-	return xa_load(&sess->tree_conns, id);
+	struct ksmbd_tree_connect *tcon;
+
+	tcon = xa_load(&sess->tree_conns, id);
+	if (tcon) {
+		if (test_bit(TREE_CONN_EXPIRE, &tcon->status))
+			tcon = NULL;
+	}
+
+	return tcon;
 }
 
 struct ksmbd_share_config *ksmbd_tree_conn_share(struct ksmbd_session *sess,
fs/ksmbd/mgmt/tree_connect.h +3 -0
@@ -14,6 +14,8 @@ struct ksmbd_share_config;
 struct ksmbd_user;
 struct ksmbd_conn;
 
+#define TREE_CONN_EXPIRE		1
+
 struct ksmbd_tree_connect {
 	int				id;
 
@@ -25,6 +27,7 @@ struct ksmbd_tree_connect {
 
 	int				maximal_access;
 	bool				posix_extensions;
+	unsigned long			status;
 };
 
 struct ksmbd_tree_conn_status {
fs/ksmbd/smb2pdu.c +2 -1
@@ -2055,11 +2055,12 @@ int smb2_tree_disconnect(struct ksmbd_wo
 
 	ksmbd_debug(SMB, "request\n");
 
-	if (!tcon) {
+	if (!tcon || test_and_set_bit(TREE_CONN_EXPIRE, &tcon->status)) {
 		struct smb2_tree_disconnect_req *req =
 			smb2_get_msg(work->request_buf);
 
 		ksmbd_debug(SMB, "Invalid tid %d\n", req->hdr.Id.SyncId.TreeId);
+
 		rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
 		smb2_set_err_rsp(work);
 		return 0;
author maintainer
#91 lore raw

PATCH 91/663 ksmbd: call rcu_barrier() in ksmbd_server_exit()

In reply to Greg Kroah-Hartman

From: Namjae Jeon <[email protected]>

commit eb307d09fe15844fdaebeb8cc8c9b9e925430aa5 upstream.

racy issue is triggered the bug by racing between closing a connection and rmmod. In ksmbd, rcu_barrier() is not called at module unload time, so nothing prevents ksmbd from getting unloaded while it still has RCU callbacks pending. It leads to trigger unintended execution of kernel code locally and use to defeat protections such as Kernel Lockdown

---
 fs/ksmbd/server.c |    1 +
 1 file changed, 1 insertion(+)
fs/ksmbd/server.c +1 -0
@@ -606,6 +606,7 @@ err_unregister:
 static void __exit ksmbd_server_exit(void)
 {
 	ksmbd_server_shutdown();
+	rcu_barrier();
 	ksmbd_release_inode_hash();
 }
 
author maintainer
#92 lore raw

PATCH 92/663 ksmbd: fix NULL pointer dereference in smb2_get_info_filesystem()

In reply to Greg Kroah-Hartman

From: Namjae Jeon <[email protected]>

commit 3ac00a2ab69b34189942afa9e862d5170cdcb018 upstream.

If share is , share->path is NULL and it cause NULL pointer dereference issue.

---
 fs/ksmbd/smb2pdu.c |    3 +++
 1 file changed, 3 insertions(+)
fs/ksmbd/smb2pdu.c +3 -0
@@ -4915,6 +4915,9 @@ static int smb2_get_info_filesystem(stru
 	int rc = 0, len;
 	int fs_infoclass_size = 0;
 
+	if (!share->path)
+		return -EIO;
+
 	rc = kern_path(share->path, LOOKUP_NO_SYMLINKS, &path);
 	if (rc) {
 		pr_err("cannot create vfs path\n");
author maintainer
#66 lore raw

PATCH 66/663 pinctrl: qcom: lpass-lpi: set output value before enabling output

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

commit 163bfb0cb1f6fbf961cf912cbde57399ea1ae0e8 upstream.

As per Hardware Programming Guide, when configuring pin as output, set the pin value before setting output-enable (OE). Similar approach is in main SoC TLMM pin controller.

---
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +9 -5
@@ -221,6 +221,15 @@ static int lpi_config_set(struct pinctrl
 		}
 	}
 
+	/*
+	 * As per Hardware Programming Guide, when configuring pin as output,
+	 * set the pin value before setting output-enable (OE).
+	 */
+	if (output_enabled) {
+		val = u32_encode_bits(value ? 1 : 0, LPI_GPIO_VALUE_OUT_MASK);
+		lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val);
+	}
+
 	val = lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG);
 
 	u32p_replace_bits(&val, pullup, LPI_GPIO_PULL_MASK);
@@ -230,11 +239,6 @@ static int lpi_config_set(struct pinctrl
 
 	lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val);
 
-	if (output_enabled) {
-		val = u32_encode_bits(value ? 1 : 0, LPI_GPIO_VALUE_OUT_MASK);
-		lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val);
-	}
-
 	return 0;
 }
 
author maintainer
#93 lore raw

PATCH 93/663 ksmbd: fix memleak in session setup

In reply to Greg Kroah-Hartman

From: Namjae Jeon <[email protected]>

commit 6d7cb549c2ca20e1f07593f15e936fd54b763028 upstream.

If client send session setup request with unknown NTLMSSP message type, session that does not included channel can be created. It will cause session memleak. because ksmbd_sessions_deregister() does not destroy session if channel is not included. This patch return error response if client send the request unknown NTLMSSP message type.

---
 fs/ksmbd/smb2pdu.c |    4 ++++
 1 file changed, 4 insertions(+)
fs/ksmbd/smb2pdu.c +4 -0
@@ -1801,6 +1801,10 @@ int smb2_sess_setup(struct ksmbd_work *w
 				}
 				kfree(sess->Preauth_HashValue);
 				sess->Preauth_HashValue = NULL;
+			} else {
+				pr_info_ratelimited("Unknown NTLMSSP message type : 0x%x\n",
+						le32_to_cpu(negblob->MessageType));
+				rc = -EINVAL;
 			}
 		} else {
 			/* TODO: need one more negotiation */
author maintainer
#94 lore raw

PATCH 94/663 ksmbd: not allow guest user on multichannel

In reply to Greg Kroah-Hartman

From: Namjae Jeon <[email protected]>

commit 3353ab2df5f68dab7da8d5ebb427a2d265a1f2b2 upstream.

This patch return STATUS_NOT_SUPPORTED if binding session is guest.

---
 fs/ksmbd/smb2pdu.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ksmbd/smb2pdu.c +9 -2
@@ -1456,7 +1456,7 @@ static int ntlm_authenticate(struct ksmb
 		 * Reuse session if anonymous try to connect
 		 * on reauthetication.
 		 */
-		if (ksmbd_anonymous_user(user)) {
+		if (conn->binding == false && ksmbd_anonymous_user(user)) {
 			ksmbd_free_user(user);
 			return 0;
 		}
@@ -1470,7 +1470,7 @@ static int ntlm_authenticate(struct ksmb
 		sess->user = user;
 	}
 
-	if (user_guest(sess->user)) {
+	if (conn->binding == false && user_guest(sess->user)) {
 		rsp->SessionFlags = SMB2_SESSION_FLAG_IS_GUEST_LE;
 	} else {
 		struct authenticate_message *authblob;
@@ -1715,6 +1715,11 @@ int smb2_sess_setup(struct ksmbd_work *w
 			goto out_err;
 		}
 
+		if (user_guest(sess->user)) {
+			rc = -EOPNOTSUPP;
+			goto out_err;
+		}
+
 		conn->binding = true;
 	} else if ((conn->dialect < SMB30_PROT_ID ||
 		    server_conf.flags & KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL) &&
@@ -1827,6 +1832,8 @@ out_err:
 		rsp->hdr.Status = STATUS_NETWORK_SESSION_EXPIRED;
 	else if (rc == -ENOMEM)
 		rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
+	else if (rc == -EOPNOTSUPP)
+		rsp->hdr.Status = STATUS_NOT_SUPPORTED;
 	else if (rc)
 		rsp->hdr.Status = STATUS_LOGON_FAILURE;
 
author maintainer
#67 lore raw

PATCH 67/663 ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset_online_cpus

In reply to Greg Kroah-Hartman

From: Tze-nan Wu <[email protected]>

commit 7c339fb4d8577792378136c15fde773cfb863cb8 upstream.

In ring_buffer_reset_online_cpus, the buffer_size_kb write operation may permanently fail if the cpu_online_mask changes between two for_each_online_buffer_cpu loops. The number of increases and decreases on both cpu_buffer->resize_disabled and cpu_buffer->record_disabled may be inconsistent, causing some CPUs to have non-zero values for these atomic variables after the function returns.

This issue can be reproduced by "echo 0 > trace" while hotplugging cpu. After reproducing success, we can find out buffer_size_kb will not be functional anymore.

To prevent leaving 'resize_disabled' and 'record_disabled' non-zero after ring_buffer_reset_online_cpus returns, we ensure that each atomic variable has been set up before atomic_sub() to it.

Fixes b23d7a5f4a07 ("ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU")
---
 kernel/trace/ring_buffer.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
kernel/trace/ring_buffer.c +13 -3
@@ -5349,6 +5349,9 @@ void ring_buffer_reset_cpu(struct trace_
 }
 EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu);
 
+/* Flag to ensure proper resetting of atomic variables */
+#define RESET_BIT	(1 << 30)
+
 /**
  * ring_buffer_reset_online_cpus - reset a ring buffer per CPU buffer
  * @buffer: The ring buffer to reset a per cpu buffer of
@@ -5365,20 +5368,27 @@ void ring_buffer_reset_online_cpus(struc
 	for_each_online_buffer_cpu(buffer, cpu) {
 		cpu_buffer = buffer->buffers[cpu];
 
-		atomic_inc(&cpu_buffer->resize_disabled);
+		atomic_add(RESET_BIT, &cpu_buffer->resize_disabled);
 		atomic_inc(&cpu_buffer->record_disabled);
 	}
 
 	/* Make sure all commits have finished */
 	synchronize_rcu();
 
-	for_each_online_buffer_cpu(buffer, cpu) {
+	for_each_buffer_cpu(buffer, cpu) {
 		cpu_buffer = buffer->buffers[cpu];
 
+		/*
+		 * If a CPU came online during the synchronize_rcu(), then
+		 * ignore it.
+		 */
+		if (!(atomic_read(&cpu_buffer->resize_disabled) & RESET_BIT))
+			continue;
+
 		reset_disabled_cpu_buffer(cpu_buffer);
 
 		atomic_dec(&cpu_buffer->record_disabled);
-		atomic_dec(&cpu_buffer->resize_disabled);
+		atomic_sub(RESET_BIT, &cpu_buffer->resize_disabled);
 	}
 
 	mutex_unlock(&buffer->mutex);
author maintainer
#68 lore raw

PATCH 68/663 ring-buffer: Sync IRQ works before buffer destruction

In reply to Greg Kroah-Hartman

From: Johannes Berg <[email protected]>

commit 675751bb20634f981498c7d66161584080cc061e upstream.

If something was written to the buffer just before destruction, it may be possible (maybe not in a real system, but it did happen in ARCH=um with time-travel) to destroy the ringbuffer before the IRQ work ran, leading this KASAN report (or a crash without KASAN):

    BUG: KASAN: slab-use-after-free in irq_work_run_list+0x11a/0x13a
    Read of size 8 at addr 000000006d640a48 by task swapper/0

    CPU: 0 PID: 0 Comm: swapper Tainted: G        W  O       6.3.0-rc1 #7
    Stack:
     60c4f20f 0c203d48 41b58ab3 60f224fc
     600477fa 60f35687 60c4f20f 601273dd
     00000008 6101eb00 6101eab0 615be548
    Call Trace:
     [<60047a58>] show_stack+0x25e/0x282
     [<60c609e0>] dump_stack_lvl+0x96/0xfd
     [<60c50d4c>] print_report+0x1a7/0x5a8
     [<603078d3>] kasan_report+0xc1/0xe9
     [<60308950>] __asan_report_load8_noabort+0x1b/0x1d
     [<60232844>] irq_work_run_list+0x11a/0x13a
     [<602328b4>] irq_work_tick+0x24/0x34
     [<6017f9dc>] update_process_times+0x162/0x196
     [<6019f335>] tick_sched_handle+0x1a4/0x1c3
     [<6019fd9e>] tick_sched_timer+0x79/0x10c
     [<601812b9>] __hrtimer_run_queues.constprop.0+0x425/0x695
     [<60182913>] hrtimer_interrupt+0x16c/0x2c4
     [<600486a3>] um_timer+0x164/0x183
     [...]

    Allocated by task 411:
     save_stack_trace+0x99/0xb5
     stack_trace_save+0x81/0x9b
     kasan_save_stack+0x2d/0x54
     kasan_set_track+0x34/0x3e
     kasan_save_alloc_info+0x25/0x28
     ____kasan_kmalloc+0x8b/0x97
     __kasan_kmalloc+0x10/0x12
     __kmalloc+0xb2/0xe8
     load_elf_phdrs+0xee/0x182
     [...]

    The buggy address belongs to the object at 000000006d640800
     which belongs to the cache kmalloc-1k of size 1024
    The buggy address is located 584 bytes inside of
     freed 1024-byte region [000000006d640800, 000000006d640c00)

Add the appropriate irq_work_sync() so the work finishes before the buffers are destroyed.

Prior to the commit in the Fixes tag below, there was only a single global IRQ work, so this issue didn't exist.

Cc Masami Hiramatsu <[email protected]>
Fixes 15693458c4bc ("tracing/ring-buffer: Move poll wake ups into ring buffer code")
---
 kernel/trace/ring_buffer.c |    4 ++++
 1 file changed, 4 insertions(+)
kernel/trace/ring_buffer.c +4 -0
@@ -1778,6 +1778,8 @@ static void rb_free_cpu_buffer(struct ri
 	struct list_head *head = cpu_buffer->pages;
 	struct buffer_page *bpage, *tmp;
 
+	irq_work_sync(&cpu_buffer->irq_work.work);
+
 	free_buffer_page(cpu_buffer->reader_page);
 
 	if (head) {
@@ -1884,6 +1886,8 @@ ring_buffer_free(struct trace_buffer *bu
 
 	cpuhp_state_remove_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node);
 
+	irq_work_sync(&buffer->irq_work.work);
+
 	for_each_buffer_cpu(buffer, cpu)
 		rb_free_cpu_buffer(buffer->buffers[cpu]);
 
author maintainer
#69 lore raw

PATCH 69/663 crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()

In reply to Greg Kroah-Hartman

From: Toke Høiland-Jørgensen <[email protected]>

commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream.

The crypto_unregister_alg() function expects callers to ensure that any algorithm that is unregistered has a refcnt of exactly 1, and issues a BUG_ON() if this is not the case. However, there are in fact drivers that will call crypto_unregister_alg() without ensuring that the refcnt has been lowered first, most notably on system shutdown. This causes the BUG_ON() to trigger, which prevents a clean shutdown and hangs the system.

To avoid such hangs on shutdown, demote the BUG_ON() in crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because this problem was observed on a 6.2 kernel, cf the link below.

---
 crypto/algapi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
crypto/algapi.c +3 -1
@@ -493,7 +493,9 @@ void crypto_unregister_alg(struct crypto
 	if (WARN(ret, "Algorithm %s is not registered", alg->cra_driver_name))
 		return;
 
-	BUG_ON(refcount_read(&alg->cra_refcnt) != 1);
+	if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1))
+		return;
+
 	if (alg->cra_destroy)
 		alg->cra_destroy(alg);
 
author maintainer
#70 lore raw

PATCH 70/663 crypto: safexcel - Cleanup ring IRQ workqueues on load failure

In reply to Greg Kroah-Hartman

From: Jonathan McDowell <[email protected]>

commit ca25c00ccbc5f942c63897ed23584cfc66e8ec81 upstream.

A failure loading the safexcel driver results in the following warning on boot, because the IRQ affinity has not been correctly cleaned up. Ensure we clean up the affinity and workqueues on a failure to load the driver.

crypto-safexcel: probe of f2800000.crypto failed with error -2

------------[ cut here ]------------
WARNING: CPU: 1 PID: 232 at kernel/irq/manage.c:1913 free_irq+0x300/0x340
Modules linked in: hwmon mdio_i2c crypto_safexcel(+) md5 sha256_generic libsha256 authenc libdes omap_rng rng_core nft_masq nft_nat nft_chain_nat nf_nat nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables libcrc32c nfnetlink fuse autofs4
CPU: 1 PID: 232 Comm: systemd-udevd Tainted: G        W          6.1.6-00002-g9d4898824677 #3
Hardware name: MikroTik RB5009 (DT)
pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : free_irq+0x300/0x340
lr : free_irq+0x2e0/0x340

sp : ffff800008fa3890
x29: ffff800008fa3890 x28: 0000000000000000 x27: 0000000000000000
x26: ffff8000008e6dc0 x25: ffff000009034cac x24: ffff000009034d50
x23: 0000000000000000 x22: 000000000000004a x21: ffff0000093e0d80
x20: ffff000009034c00 x19: ffff00000615fc00 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 000075f5c1584c5e
x14: 0000000000000017 x13: 0000000000000000 x12: 0000000000000040
x11: ffff000000579b60 x10: ffff000000579b62 x9 : ffff800008bbe370 x8 : ffff000000579dd0 x7 : 0000000000000000 x6 : ffff000000579e18 x5 : ffff000000579da8 x4 : ffff800008ca0000 x3 : ffff800008ca0188 x2 : 0000000013033204 x1 : ffff000009034c00 x0 : ffff8000087eadf0

Call trace:
 free_irq+0x300/0x340
 devm_irq_release+0x14/0x20
 devres_release_all+0xa0/0x100
 device_unbind_cleanup+0x14/0x60
 really_probe+0x198/0x2d4
 __driver_probe_device+0x74/0xdc
 driver_probe_device+0x3c/0x110
 __driver_attach+0x8c/0x190
 bus_for_each_dev+0x6c/0xc0
 driver_attach+0x20/0x30
 bus_add_driver+0x148/0x1fc
 driver_register+0x74/0x120
 __platform_driver_register+0x24/0x30
 safexcel_init+0x48/0x1000 [crypto_safexcel]
 do_one_initcall+0x4c/0x1b0
 do_init_module+0x44/0x1cc
 load_module+0x1724/0x1be4
 __do_sys_finit_module+0xbc/0x110
 __arm64_sys_finit_module+0x1c/0x24
 invoke_syscall+0x44/0x110
 el0_svc_common.constprop.0+0xc0/0xe0
 do_el0_svc+0x20/0x80
 el0_svc+0x14/0x4c
 el0t_64_sync_handler+0xb0/0xb4
 el0t_64_sync+0x148/0x14c
---[ end trace 0000000000000000 ]---
Fixes 1b44c5a60c13 ("inside-secure - add SafeXcel EIP197 crypto engine driver")
---
 drivers/crypto/inside-secure/safexcel.c |   37 +++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/crypto/inside-secure/safexcel.c +27 -10
@@ -1639,19 +1639,23 @@ static int safexcel_probe_generic(void *
 						     &priv->ring[i].rdr);
 		if (ret) {
 			dev_err(dev, "Failed to initialize rings\n");
-			return ret;
+			goto err_cleanup_rings;
 		}
 
 		priv->ring[i].rdr_req = devm_kcalloc(dev,
 			EIP197_DEFAULT_RING_SIZE,
 			sizeof(*priv->ring[i].rdr_req),
 			GFP_KERNEL);
-		if (!priv->ring[i].rdr_req)
-			return -ENOMEM;
+		if (!priv->ring[i].rdr_req) {
+			ret = -ENOMEM;
+			goto err_cleanup_rings;
+		}
 
 		ring_irq = devm_kzalloc(dev, sizeof(*ring_irq), GFP_KERNEL);
-		if (!ring_irq)
-			return -ENOMEM;
+		if (!ring_irq) {
+			ret = -ENOMEM;
+			goto err_cleanup_rings;
+		}
 
 		ring_irq->priv = priv;
 		ring_irq->ring = i;
@@ -1665,7 +1669,8 @@ static int safexcel_probe_generic(void *
 						ring_irq);
 		if (irq < 0) {
 			dev_err(dev, "Failed to get IRQ ID for ring %d\n", i);
-			return irq;
+			ret = irq;
+			goto err_cleanup_rings;
 		}
 
 		priv->ring[i].irq = irq;
@@ -1677,8 +1682,10 @@ static int safexcel_probe_generic(void *
 		snprintf(wq_name, 9, "wq_ring%d", i);
 		priv->ring[i].workqueue =
 			create_singlethread_workqueue(wq_name);
-		if (!priv->ring[i].workqueue)
-			return -ENOMEM;
+		if (!priv->ring[i].workqueue) {
+			ret = -ENOMEM;
+			goto err_cleanup_rings;
+		}
 
 		priv->ring[i].requests = 0;
 		priv->ring[i].busy = false;
@@ -1695,16 +1702,26 @@ static int safexcel_probe_generic(void *
 	ret = safexcel_hw_init(priv);
 	if (ret) {
 		dev_err(dev, "HW init failed (%d)\n", ret);
-		return ret;
+		goto err_cleanup_rings;
 	}
 
 	ret = safexcel_register_algorithms(priv);
 	if (ret) {
 		dev_err(dev, "Failed to register algorithms (%d)\n", ret);
-		return ret;
+		goto err_cleanup_rings;
 	}
 
 	return 0;
+
+err_cleanup_rings:
+	for (i = 0; i < priv->config.rings; i++) {
+		if (priv->ring[i].irq)
+			irq_set_affinity_hint(priv->ring[i].irq, NULL);
+		if (priv->ring[i].workqueue)
+			destroy_workqueue(priv->ring[i].workqueue);
+	}
+
+	return ret;
 }
 
 static void safexcel_hw_reset_rings(struct safexcel_crypto_priv *priv)
author maintainer
#71 lore raw

PATCH 71/663 crypto: arm64/aes-neonbs - fix crash with CFI enabled

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

commit 47446d7cd42358ca7d7a544f2f7823db03f616ff upstream.

aesbs_ecb_encrypt(), aesbs_ecb_decrypt(), aesbs_xts_encrypt(), and aesbs_xts_decrypt() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure if the compiler doesn't happen to optimize out the indirect calls.

Fixes c50d32859e70 ("arm64: Add types to indirect called assembly functions")
---
 arch/arm64/crypto/aes-neonbs-core.S |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/crypto/aes-neonbs-core.S +5 -4
@@ -15,6 +15,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/cfi_types.h>
 #include <asm/assembler.h>
 
 	.text
@@ -620,12 +621,12 @@ SYM_FUNC_END(aesbs_decrypt8)
 	.endm
 
 	.align		4
-SYM_FUNC_START(aesbs_ecb_encrypt)
+SYM_TYPED_FUNC_START(aesbs_ecb_encrypt)
 	__ecb_crypt	aesbs_encrypt8, v0, v1, v4, v6, v3, v7, v2, v5
 SYM_FUNC_END(aesbs_ecb_encrypt)
 
 	.align		4
-SYM_FUNC_START(aesbs_ecb_decrypt)
+SYM_TYPED_FUNC_START(aesbs_ecb_decrypt)
 	__ecb_crypt	aesbs_decrypt8, v0, v1, v6, v4, v2, v7, v3, v5
 SYM_FUNC_END(aesbs_ecb_decrypt)
 
@@ -799,11 +800,11 @@ SYM_FUNC_END(__xts_crypt8)
 	ret
 	.endm
 
-SYM_FUNC_START(aesbs_xts_encrypt)
+SYM_TYPED_FUNC_START(aesbs_xts_encrypt)
 	__xts_crypt	aesbs_encrypt8, v0, v1, v4, v6, v3, v7, v2, v5
 SYM_FUNC_END(aesbs_xts_encrypt)
 
-SYM_FUNC_START(aesbs_xts_decrypt)
+SYM_TYPED_FUNC_START(aesbs_xts_decrypt)
 	__xts_crypt	aesbs_decrypt8, v0, v1, v6, v4, v2, v7, v3, v5
 SYM_FUNC_END(aesbs_xts_decrypt)
 
author maintainer
#72 lore raw

PATCH 72/663 crypto: testmgr - fix RNG performance in fuzz tests

In reply to Greg Kroah-Hartman

From: Eric Biggers <[email protected]>

commit f900fde28883602b6c5e1027a6c912b673382aaf upstream.

The performance of the crypto fuzz tests has greatly regressed since v5.18. When booting a kernel on an arm64 dev board with all software crypto algorithms and CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled, the fuzz tests now take about 200 seconds to run, or about 325 seconds with lockdep enabled, compared to about 5 seconds before.

The root cause is that the random number generation has become much slower due to commit d4150779e60f ("random32: use real rng for non-deterministic randomness"). On my same arm64 dev board, at the time the fuzz tests are run, get_random_u8() is about 345x slower than prandom_u32_state(), or about 469x if lockdep is enabled.

Lockdep makes a big difference, but much of the rest comes from the get_random_*() functions taking a *very* slow path when the CRNG is not yet initialized. Since the crypto self-tests run early during boot, even having a hardware RNG driver enabled (CONFIG_CRYPTO_DEV_QCOM_RNG in my case) doesn't prevent this. x86 systems don't have this issue, but they still see a significant regression if lockdep is enabled.

Converting the "Fully random bytes" case in generate_random_bytes() to use get_random_bytes() helps significantly, improving the test time to about 27 seconds. But that's still over 5x slower than before.

This is all a bit silly, though, since the fuzz tests don't actually need cryptographically secure random numbers. So let's just make them use a non-cryptographically-secure RNG as they did before. The original prandom_u32() is gone now, so let's use prandom_u32_state() instead, with an explicitly managed state, like various other self-tests in the kernel source tree (rbtree_test.c, test_scanf.c, etc.) already do. This also has the benefit that no locking is required anymore, so performance should be even better than the original version that used prandom_u32().

Fixes d4150779e60f ("random32: use real rng for non-deterministic randomness")
---
 crypto/testmgr.c |  266 ++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 169 insertions(+), 97 deletions(-)
crypto/testmgr.c +169 -97
@@ -852,12 +852,50 @@ static int prepare_keybuf(const u8 *key,
 
 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 
+/*
+ * The fuzz tests use prandom instead of the normal Linux RNG since they don't
+ * need cryptographically secure random numbers.  This greatly improves the
+ * performance of these tests, especially if they are run before the Linux RNG
+ * has been initialized or if they are run on a lockdep-enabled kernel.
+ */
+
+static inline void init_rnd_state(struct rnd_state *rng)
+{
+	prandom_seed_state(rng, get_random_u64());
+}
+
+static inline u8 prandom_u8(struct rnd_state *rng)
+{
+	return prandom_u32_state(rng);
+}
+
+static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
+{
+	/*
+	 * This is slightly biased for non-power-of-2 values of 'ceil', but this
+	 * isn't important here.
+	 */
+	return prandom_u32_state(rng) % ceil;
+}
+
+static inline bool prandom_bool(struct rnd_state *rng)
+{
+	return prandom_u32_below(rng, 2);
+}
+
+static inline u32 prandom_u32_inclusive(struct rnd_state *rng,
+					u32 floor, u32 ceil)
+{
+	return floor + prandom_u32_below(rng, ceil - floor + 1);
+}
+
 /* Generate a random length in range [0, max_len], but prefer smaller values */
-static unsigned int generate_random_length(unsigned int max_len)
+static unsigned int generate_random_length(struct rnd_state *rng,
+					   unsigned int max_len)
 {
-	unsigned int len = get_random_u32_below(max_len + 1);
+	unsigned int len = prandom_u32_below(rng, max_len + 1);
 
-	switch (get_random_u32_below(4)) {
+	switch (prandom_u32_below(rng, 4)) {
 	case 0:
 		return len % 64;
 	case 1:
@@ -870,43 +908,44 @@ static unsigned int generate_random_leng
 }
 
 /* Flip a random bit in the given nonempty data buffer */
-static void flip_random_bit(u8 *buf, size_t size)
+static void flip_random_bit(struct rnd_state *rng, u8 *buf, size_t size)
 {
 	size_t bitpos;
 
-	bitpos = get_random_u32_below(size * 8);
+	bitpos = prandom_u32_below(rng, size * 8);
 	buf[bitpos / 8] ^= 1 << (bitpos % 8);
 }
 
 /* Flip a random byte in the given nonempty data buffer */
-static void flip_random_byte(u8 *buf, size_t size)
+static void flip_random_byte(struct rnd_state *rng, u8 *buf, size_t size)
 {
-	buf[get_random_u32_below(size)] ^= 0xff;
+	buf[prandom_u32_below(rng, size)] ^= 0xff;
 }
 
 /* Sometimes make some random changes to the given nonempty data buffer */
-static void mutate_buffer(u8 *buf, size_t size)
+static void mutate_buffer(struct rnd_state *rng, u8 *buf, size_t size)
 {
 	size_t num_flips;
 	size_t i;
 
 	/* Sometimes flip some bits */
-	if (get_random_u32_below(4) == 0) {
-		num_flips = min_t(size_t, 1 << get_random_u32_below(8), size * 8);
+	if (prandom_u32_below(rng, 4) == 0) {
+		num_flips = min_t(size_t, 1 << prandom_u32_below(rng, 8),
+				  size * 8);
 		for (i = 0; i < num_flips; i++)
-			flip_random_bit(buf, size);
+			flip_random_bit(rng, buf, size);
 	}
 
 	/* Sometimes flip some bytes */
-	if (get_random_u32_below(4) == 0) {
-		num_flips = min_t(size_t, 1 << get_random_u32_below(8), size);
+	if (prandom_u32_below(rng, 4) == 0) {
+		num_flips = min_t(size_t, 1 << prandom_u32_below(rng, 8), size);
 		for (i = 0; i < num_flips; i++)
-			flip_random_byte(buf, size);
+			flip_random_byte(rng, buf, size);
 	}
 }
 
 /* Randomly generate 'count' bytes, but sometimes make them "interesting" */
-static void generate_random_bytes(u8 *buf, size_t count)
+static void generate_random_bytes(struct rnd_state *rng, u8 *buf, size_t count)
 {
 	u8 b;
 	u8 increment;
@@ -915,11 +954,11 @@ static void generate_random_bytes(u8 *bu
 	if (count == 0)
 		return;
 
-	switch (get_random_u32_below(8)) { /* Choose a generation strategy */
+	switch (prandom_u32_below(rng, 8)) { /* Choose a generation strategy */
 	case 0:
 	case 1:
 		/* All the same byte, plus optional mutations */
-		switch (get_random_u32_below(4)) {
+		switch (prandom_u32_below(rng, 4)) {
 		case 0:
 			b = 0x00;
 			break;
@@ -927,28 +966,28 @@ static void generate_random_bytes(u8 *bu
 			b = 0xff;
 			break;
 		default:
-			b = get_random_u8();
+			b = prandom_u8(rng);
 			break;
 		}
 		memset(buf, b, count);
-		mutate_buffer(buf, count);
+		mutate_buffer(rng, buf, count);
 		break;
 	case 2:
 		/* Ascending or descending bytes, plus optional mutations */
-		increment = get_random_u8();
-		b = get_random_u8();
+		increment = prandom_u8(rng);
+		b = prandom_u8(rng);
 		for (i = 0; i < count; i++, b += increment)
 			buf[i] = b;
-		mutate_buffer(buf, count);
+		mutate_buffer(rng, buf, count);
 		break;
 	default:
 		/* Fully random bytes */
-		for (i = 0; i < count; i++)
-			buf[i] = get_random_u8();
+		prandom_bytes_state(rng, buf, count);
 	}
 }
 
-static char *generate_random_sgl_divisions(struct test_sg_division *divs,
+static char *generate_random_sgl_divisions(struct rnd_state *rng,
+					   struct test_sg_division *divs,
 					   size_t max_divs, char *p, char *end,
 					   bool gen_flushes, u32 req_flags)
 {
@@ -959,24 +998,26 @@ static char *generate_random_sgl_divisio
 		unsigned int this_len;
 		const char *flushtype_str;
 
-		if (div == &divs[max_divs - 1] || get_random_u32_below(2) == 0)
+		if (div == &divs[max_divs - 1] || prandom_bool(rng))
 			this_len = remaining;
 		else
-			this_len = get_random_u32_inclusive(1, remaining);
+			this_len = prandom_u32_inclusive(rng, 1, remaining);
 		div->proportion_of_total = this_len;
 
-		if (get_random_u32_below(4) == 0)
-			div->offset = get_random_u32_inclusive(PAGE_SIZE - 128, PAGE_SIZE - 1);
-		else if (get_random_u32_below(2) == 0)
-			div->offset = get_random_u32_below(32);
+		if (prandom_u32_below(rng, 4) == 0)
+			div->offset = prandom_u32_inclusive(rng,
+							    PAGE_SIZE - 128,
+							    PAGE_SIZE - 1);
+		else if (prandom_bool(rng))
+			div->offset = prandom_u32_below(rng, 32);
 		else
-			div->offset = get_random_u32_below(PAGE_SIZE);
-		if (get_random_u32_below(8) == 0)
+			div->offset = prandom_u32_below(rng, PAGE_SIZE);
+		if (prandom_u32_below(rng, 8) == 0)
 			div->offset_relative_to_alignmask = true;
 
 		div->flush_type = FLUSH_TYPE_NONE;
 		if (gen_flushes) {
-			switch (get_random_u32_below(4)) {
+			switch (prandom_u32_below(rng, 4)) {
 			case 0:
 				div->flush_type = FLUSH_TYPE_REIMPORT;
 				break;
@@ -988,7 +1029,7 @@ static char *generate_random_sgl_divisio
 
 		if (div->flush_type != FLUSH_TYPE_NONE &&
 		    !(req_flags & CRYPTO_TFM_REQ_MAY_SLEEP) &&
-		    get_random_u32_below(2) == 0)
+		    prandom_bool(rng))
 			div->nosimd = true;
 
 		switch (div->flush_type) {
@@ -1023,7 +1064,8 @@ static char *generate_random_sgl_divisio
 }
 
 /* Generate a random testvec_config for fuzz testing */
-static void generate_random_testvec_config(struct testvec_config *cfg,
+static void generate_random_testvec_config(struct rnd_state *rng,
+					   struct testvec_config *cfg,
 					   char *name, size_t max_namelen)
 {
 	char *p = name;
@@ -1035,7 +1077,7 @@ static void generate_random_testvec_conf
 
 	p += scnprintf(p, end - p, "random:");
 
-	switch (get_random_u32_below(4)) {
+	switch (prandom_u32_below(rng, 4)) {
 	case 0:
 	case 1:
 		cfg->inplace_mode = OUT_OF_PLACE;
@@ -1050,12 +1092,12 @@ static void generate_random_testvec_conf
 		break;
 	}
 
-	if (get_random_u32_below(2) == 0) {
+	if (prandom_bool(rng)) {
 		cfg->req_flags |= CRYPTO_TFM_REQ_MAY_SLEEP;
 		p += scnprintf(p, end - p, " may_sleep");
 	}
 
-	switch (get_random_u32_below(4)) {
+	switch (prandom_u32_below(rng, 4)) {
 	case 0:
 		cfg->finalization_type = FINALIZATION_TYPE_FINAL;
 		p += scnprintf(p, end - p, " use_final");
@@ -1070,36 +1112,37 @@ static void generate_random_testvec_conf
 		break;
 	}
 
-	if (!(cfg->req_flags & CRYPTO_TFM_REQ_MAY_SLEEP) &&
-	    get_random_u32_below(2) == 0) {
+	if (!(cfg->req_flags & CRYPTO_TFM_REQ_MAY_SLEEP) && prandom_bool(rng)) {
 		cfg->nosimd = true;
 		p += scnprintf(p, end - p, " nosimd");
 	}
 
 	p += scnprintf(p, end - p, " src_divs=[");
-	p = generate_random_sgl_divisions(cfg->src_divs,
+	p = generate_random_sgl_divisions(rng, cfg->src_divs,
 					  ARRAY_SIZE(cfg->src_divs), p, end,
 					  (cfg->finalization_type !=
 					   FINALIZATION_TYPE_DIGEST),
 					  cfg->req_flags);
 	p += scnprintf(p, end - p, "]");
 
-	if (cfg->inplace_mode == OUT_OF_PLACE && get_random_u32_below(2) == 0) {
+	if (cfg->inplace_mode == OUT_OF_PLACE && prandom_bool(rng)) {
 		p += scnprintf(p, end - p, " dst_divs=[");
-		p = generate_random_sgl_divisions(cfg->dst_divs,
+		p = generate_random_sgl_divisions(rng, cfg->dst_divs,
 						  ARRAY_SIZE(cfg->dst_divs),
 						  p, end, false,
 						  cfg->req_flags);
 		p += scnprintf(p, end - p, "]");
 	}
 
-	if (get_random_u32_below(2) == 0) {
-		cfg->iv_offset = get_random_u32_inclusive(1, MAX_ALGAPI_ALIGNMASK);
+	if (prandom_bool(rng)) {
+		cfg->iv_offset = prandom_u32_inclusive(rng, 1,
+						       MAX_ALGAPI_ALIGNMASK);
 		p += scnprintf(p, end - p, " iv_offset=%u", cfg->iv_offset);
 	}
 
-	if (get_random_u32_below(2) == 0) {
-		cfg->key_offset = get_random_u32_inclusive(1, MAX_ALGAPI_ALIGNMASK);
+	if (prandom_bool(rng)) {
+		cfg->key_offset = prandom_u32_inclusive(rng, 1,
+							MAX_ALGAPI_ALIGNMASK);
 		p += scnprintf(p, end - p, " key_offset=%u", cfg->key_offset);
 	}
 
@@ -1612,11 +1655,14 @@ static int test_hash_vec(const struct ha
 
 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 	if (!noextratests) {
+		struct rnd_state rng;
 		struct testvec_config cfg;
 		char cfgname[TESTVEC_CONFIG_NAMELEN];
 
+		init_rnd_state(&rng);
+
 		for (i = 0; i < fuzz_iterations; i++) {
-			generate_random_testvec_config(&cfg, cfgname,
+			generate_random_testvec_config(&rng, &cfg, cfgname,
 						       sizeof(cfgname));
 			err = test_hash_vec_cfg(vec, vec_name, &cfg,
 						req, desc, tsgl, hashstate);
@@ -1634,15 +1680,16 @@ static int test_hash_vec(const struct ha
  * Generate a hash test vector from the given implementation.
  * Assumes the buffers in 'vec' were already allocated.
  */
-static void generate_random_hash_testvec(struct shash_desc *desc,
+static void generate_random_hash_testvec(struct rnd_state *rng,
+					 struct shash_desc *desc,
 					 struct hash_testvec *vec,
 					 unsigned int maxkeysize,
 					 unsigned int maxdatasize,
 					 char *name, size_t max_namelen)
 {
 	/* Data */
-	vec->psize = generate_random_length(maxdatasize);
-	generate_random_bytes((u8 *)vec->plaintext, vec->psize);
+	vec->psize = generate_random_length(rng, maxdatasize);
+	generate_random_bytes(rng, (u8 *)vec->plaintext, vec->psize);
 
 	/*
 	 * Key: length in range [1, maxkeysize], but usually choose maxkeysize.
@@ -1652,9 +1699,9 @@ static void generate_random_hash_testvec
 	vec->ksize = 0;
 	if (maxkeysize) {
 		vec->ksize = maxkeysize;
-		if (get_random_u32_below(4) == 0)
-			vec->ksize = get_random_u32_inclusive(1, maxkeysize);
-		generate_random_bytes((u8 *)vec->key, vec->ksize);
+		if (prandom_u32_below(rng, 4) == 0)
+			vec->ksize = prandom_u32_inclusive(rng, 1, maxkeysize);
+		generate_random_bytes(rng, (u8 *)vec->key, vec->ksize);
 
 		vec->setkey_error = crypto_shash_setkey(desc->tfm, vec->key,
 							vec->ksize);
@@ -1688,6 +1735,7 @@ static int test_hash_vs_generic_impl(con
 	const unsigned int maxdatasize = (2 * PAGE_SIZE) - TESTMGR_POISON_LEN;
 	const char *algname = crypto_hash_alg_common(tfm)->base.cra_name;
 	const char *driver = crypto_ahash_driver_name(tfm);
+	struct rnd_state rng;
 	char _generic_driver[CRYPTO_MAX_ALG_NAME];
 	struct crypto_shash *generic_tfm = NULL;
 	struct shash_desc *generic_desc = NULL;
@@ -1701,6 +1749,8 @@ static int test_hash_vs_generic_impl(con
 	if (noextratests)
 		return 0;
 
+	init_rnd_state(&rng);
+
 	if (!generic_driver) { /* Use default naming convention? */
 		err = build_generic_driver_name(algname, _generic_driver);
 		if (err)
@@ -1769,10 +1819,11 @@ static int test_hash_vs_generic_impl(con
 	}
 
 	for (i = 0; i < fuzz_iterations * 8; i++) {
-		generate_random_hash_testvec(generic_desc, &vec,
+		generate_random_hash_testvec(&rng, generic_desc, &vec,
 					     maxkeysize, maxdatasize,
 					     vec_name, sizeof(vec_name));
-		generate_random_testvec_config(cfg, cfgname, sizeof(cfgname));
+		generate_random_testvec_config(&rng, cfg, cfgname,
+					       sizeof(cfgname));
 
 		err = test_hash_vec_cfg(&vec, vec_name, cfg,
 					req, desc, tsgl, hashstate);
@@ -2174,11 +2225,14 @@ static int test_aead_vec(int enc, const
 
 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 	if (!noextratests) {
+		struct rnd_state rng;
 		struct testvec_config cfg;
 		char cfgname[TESTVEC_CONFIG_NAMELEN];
 
+		init_rnd_state(&rng);
+
 		for (i = 0; i < fuzz_iterations; i++) {
-			generate_random_testvec_config(&cfg, cfgname,
+			generate_random_testvec_config(&rng, &cfg, cfgname,
 						       sizeof(cfgname));
 			err = test_aead_vec_cfg(enc, vec, vec_name,
 						&cfg, req, tsgls);
@@ -2194,6 +2248,7 @@ static int test_aead_vec(int enc, const
 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 
 struct aead_extra_tests_ctx {
+	struct rnd_state rng;
 	struct aead_request *req;
 	struct crypto_aead *tfm;
 	const struct alg_test_desc *test_desc;
@@ -2212,24 +2267,26 @@ struct aead_extra_tests_ctx {
  * here means the full ciphertext including the authentication tag.  The
  * authentication tag (and hence also the ciphertext) is assumed to be nonempty.
  */
-static void mutate_aead_message(struct aead_testvec *vec, bool aad_iv,
+static void mutate_aead_message(struct rnd_state *rng,
+				struct aead_testvec *vec, bool aad_iv,
 				unsigned int ivsize)
 {
 	const unsigned int aad_tail_size = aad_iv ? ivsize : 0;
 	const unsigned int authsize = vec->clen - vec->plen;
 
-	if (get_random_u32_below(2) == 0 && vec->alen > aad_tail_size) {
+	if (prandom_bool(rng) && vec->alen > aad_tail_size) {
 		 /* Mutate the AAD */
-		flip_random_bit((u8 *)vec->assoc, vec->alen - aad_tail_size);
-		if (get_random_u32_below(2) == 0)
+		flip_random_bit(rng, (u8 *)vec->assoc,
+				vec->alen - aad_tail_size);
+		if (prandom_bool(rng))
 			return;
 	}
-	if (get_random_u32_below(2) == 0) {
+	if (prandom_bool(rng)) {
 		/* Mutate auth tag (assuming it's at the end of ciphertext) */
-		flip_random_bit((u8 *)vec->ctext + vec->plen, authsize);
+		flip_random_bit(rng, (u8 *)vec->ctext + vec->plen, authsize);
 	} else {
 		/* Mutate any part of the ciphertext */
-		flip_random_bit((u8 *)vec->ctext, vec->clen);
+		flip_random_bit(rng, (u8 *)vec->ctext, vec->clen);
 	}
 }
 
@@ -2240,7 +2297,8 @@ static void mutate_aead_message(struct a
  */
 #define MIN_COLLISION_FREE_AUTHSIZE 8
 
-static void generate_aead_message(struct aead_request *req,
+static void generate_aead_message(struct rnd_state *rng,
+				  struct aead_request *req,
 				  const struct aead_test_suite *suite,
 				  struct aead_testvec *vec,
 				  bool prefer_inauthentic)
@@ -2249,17 +2307,18 @@ static void generate_aead_message(struct
 	const unsigned int ivsize = crypto_aead_ivsize(tfm);
 	const unsigned int authsize = vec->clen - vec->plen;
 	const bool inauthentic = (authsize >= MIN_COLLISION_FREE_AUTHSIZE) &&
-				 (prefer_inauthentic || get_random_u32_below(4) == 0);
+				 (prefer_inauthentic ||
+				  prandom_u32_below(rng, 4) == 0);
 
 	/* Generate the AAD. */
-	generate_random_bytes((u8 *)vec->assoc, vec->alen);
+	generate_random_bytes(rng, (u8 *)vec->assoc, vec->alen);
 	if (suite->aad_iv && vec->alen >= ivsize)
 		/* Avoid implementation-defined behavior. */
 		memcpy((u8 *)vec->assoc + vec->alen - ivsize, vec->iv, ivsize);
 
-	if (inauthentic && get_random_u32_below(2) == 0) {
+	if (inauthentic && prandom_bool(rng)) {
 		/* Generate a random ciphertext. */
-		generate_random_bytes((u8 *)vec->ctext, vec->clen);
+		generate_random_bytes(rng, (u8 *)vec->ctext, vec->clen);
 	} else {
 		int i = 0;
 		struct scatterlist src[2], dst;
@@ -2271,7 +2330,7 @@ static void generate_aead_message(struct
 		if (vec->alen)
 			sg_set_buf(&src[i++], vec->assoc, vec->alen);
 		if (vec->plen) {
-			generate_random_bytes((u8 *)vec->ptext, vec->plen);
+			generate_random_bytes(rng, (u8 *)vec->ptext, vec->plen);
 			sg_set_buf(&src[i++], vec->ptext, vec->plen);
 		}
 		sg_init_one(&dst, vec->ctext, vec->alen + vec->clen);
@@ -2291,7 +2350,7 @@ static void generate_aead_message(struct
 		 * Mutate the authentic (ciphertext, AAD) pair to get an
 		 * inauthentic one.
 		 */
-		mutate_aead_message(vec, suite->aad_iv, ivsize);
+		mutate_aead_message(rng, vec, suite->aad_iv, ivsize);
 	}
 	vec->novrfy = 1;
 	if (suite->einval_allowed)
@@ -2305,7 +2364,8 @@ static void generate_aead_message(struct
  * If 'prefer_inauthentic' is true, then this function will generate inauthentic
  * test vectors (i.e. vectors with 'vec->novrfy=1') more often.
  */
-static void generate_random_aead_testvec(struct aead_request *req,
+static void generate_random_aead_testvec(struct rnd_state *rng,
+					 struct aead_request *req,
 					 struct aead_testvec *vec,
 					 const struct aead_test_suite *suite,
 					 unsigned int maxkeysize,
@@ -2321,18 +2381,18 @@ static void generate_random_aead_testvec
 
 	/* Key: length in [0, maxkeysize], but usually choose maxkeysize */
 	vec->klen = maxkeysize;
-	if (get_random_u32_below(4) == 0)
-		vec->klen = get_random_u32_below(maxkeysize + 1);
-	generate_random_bytes((u8 *)vec->key, vec->klen);
+	if (prandom_u32_below(rng, 4) == 0)
+		vec->klen = prandom_u32_below(rng, maxkeysize + 1);
+	generate_random_bytes(rng, (u8 *)vec->key, vec->klen);
 	vec->setkey_error = crypto_aead_setkey(tfm, vec->key, vec->klen);
 
 	/* IV */
-	generate_random_bytes((u8 *)vec->iv, ivsize);
+	generate_random_bytes(rng, (u8 *)vec->iv, ivsize);
 
 	/* Tag length: in [0, maxauthsize], but usually choose maxauthsize */
 	authsize = maxauthsize;
-	if (get_random_u32_below(4) == 0)
-		authsize = get_random_u32_below(maxauthsize + 1);
+	if (prandom_u32_below(rng, 4) == 0)
+		authsize = prandom_u32_below(rng, maxauthsize + 1);
 	if (prefer_inauthentic && authsize < MIN_COLLISION_FREE_AUTHSIZE)
 		authsize = MIN_COLLISION_FREE_AUTHSIZE;
 	if (WARN_ON(authsize > maxdatasize))
@@ -2341,11 +2401,11 @@ static void generate_random_aead_testvec
 	vec->setauthsize_error = crypto_aead_setauthsize(tfm, authsize);
 
 	/* AAD, plaintext, and ciphertext lengths */
-	total_len = generate_random_length(maxdatasize);
-	if (get_random_u32_below(4) == 0)
+	total_len = generate_random_length(rng, maxdatasize);
+	if (prandom_u32_below(rng, 4) == 0)
 		vec->alen = 0;
 	else
-		vec->alen = generate_random_length(total_len);
+		vec->alen = generate_random_length(rng, total_len);
 	vec->plen = total_len - vec->alen;
 	vec->clen = vec->plen + authsize;
 
@@ -2356,7 +2416,7 @@ static void generate_random_aead_testvec
 	vec->novrfy = 0;
 	vec->crypt_error = 0;
 	if (vec->setkey_error == 0 && vec->setauthsize_error == 0)
-		generate_aead_message(req, suite, vec, prefer_inauthentic);
+		generate_aead_message(rng, req, suite, vec, prefer_inauthentic);
 	snprintf(name, max_namelen,
 		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"",
 		 vec->alen, vec->plen, authsize, vec->klen, vec->novrfy);
@@ -2368,7 +2428,7 @@ static void try_to_generate_inauthentic_
 	int i;
 
 	for (i = 0; i < 10; i++) {
-		generate_random_aead_testvec(ctx->req, &ctx->vec,
+		generate_random_aead_testvec(&ctx->rng, ctx->req, &ctx->vec,
 					     &ctx->test_desc->suite.aead,
 					     ctx->maxkeysize, ctx->maxdatasize,
 					     ctx->vec_name,
@@ -2399,7 +2459,8 @@ static int test_aead_inauthentic_inputs(
 		 */
 		try_to_generate_inauthentic_testvec(ctx);
 		if (ctx->vec.novrfy) {
-			generate_random_testvec_config(&ctx->cfg, ctx->cfgname,
+			generate_random_testvec_config(&ctx->rng, &ctx->cfg,
+						       ctx->cfgname,
 						       sizeof(ctx->cfgname));
 			err = test_aead_vec_cfg(DECRYPT, &ctx->vec,
 						ctx->vec_name, &ctx->cfg,
@@ -2489,12 +2550,13 @@ static int test_aead_vs_generic_impl(str
 	 * the other implementation against them.
 	 */
 	for (i = 0; i < fuzz_iterations * 8; i++) {
-		generate_random_aead_testvec(generic_req, &ctx->vec,
+		generate_random_aead_testvec(&ctx->rng, generic_req, &ctx->vec,
 					     &ctx->test_desc->suite.aead,
 					     ctx->maxkeysize, ctx->maxdatasize,
 					     ctx->vec_name,
 					     sizeof(ctx->vec_name), false);
-		generate_random_testvec_config(&ctx->cfg, ctx->cfgname,
+		generate_random_testvec_config(&ctx->rng, &ctx->cfg,
+					       ctx->cfgname,
 					       sizeof(ctx->cfgname));
 		if (!ctx->vec.novrfy) {
 			err = test_aead_vec_cfg(ENCRYPT, &ctx->vec,
@@ -2533,6 +2595,7 @@ static int test_aead_extra(const struct
 	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
+	init_rnd_state(&ctx->rng);
 	ctx->req = req;
 	ctx->tfm = crypto_aead_reqtfm(req);
 	ctx->test_desc = test_desc;
@@ -2922,11 +2985,14 @@ static int test_skcipher_vec(int enc, co
 
 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 	if (!noextratests) {
+		struct rnd_state rng;
 		struct testvec_config cfg;
 		char cfgname[TESTVEC_CONFIG_NAMELEN];
 
+		init_rnd_state(&rng);
+
 		for (i = 0; i < fuzz_iterations; i++) {
-			generate_random_testvec_config(&cfg, cfgname,
+			generate_random_testvec_config(&rng, &cfg, cfgname,
 						       sizeof(cfgname));
 			err = test_skcipher_vec_cfg(enc, vec, vec_name,
 						    &cfg, req, tsgls);
@@ -2944,7 +3010,8 @@ static int test_skcipher_vec(int enc, co
  * Generate a symmetric cipher test vector from the given implementation.
  * Assumes the buffers in 'vec' were already allocated.
  */
-static void generate_random_cipher_testvec(struct skcipher_request *req,
+static void generate_random_cipher_testvec(struct rnd_state *rng,
+					   struct skcipher_request *req,
 					   struct cipher_testvec *vec,
 					   unsigned int maxdatasize,
 					   char *name, size_t max_namelen)
@@ -2958,17 +3025,17 @@ static void generate_random_cipher_testv
 
 	/* Key: length in [0, maxkeysize], but usually choose maxkeysize */
 	vec->klen = maxkeysize;
-	if (get_random_u32_below(4) == 0)
-		vec->klen = get_random_u32_below(maxkeysize + 1);
-	generate_random_bytes((u8 *)vec->key, vec->klen);
+	if (prandom_u32_below(rng, 4) == 0)
+		vec->klen = prandom_u32_below(rng, maxkeysize + 1);
+	generate_random_bytes(rng, (u8 *)vec->key, vec->klen);
 	vec->setkey_error = crypto_skcipher_setkey(tfm, vec->key, vec->klen);
 
 	/* IV */
-	generate_random_bytes((u8 *)vec->iv, ivsize);
+	generate_random_bytes(rng, (u8 *)vec->iv, ivsize);
 
 	/* Plaintext */
-	vec->len = generate_random_length(maxdatasize);
-	generate_random_bytes((u8 *)vec->ptext, vec->len);
+	vec->len = generate_random_length(rng, maxdatasize);
+	generate_random_bytes(rng, (u8 *)vec->ptext, vec->len);
 
 	/* If the key couldn't be set, no need to continue to encrypt. */
 	if (vec->setkey_error)
@@ -3010,6 +3077,7 @@ static int test_skcipher_vs_generic_impl
 	const unsigned int maxdatasize = (2 * PAGE_SIZE) - TESTMGR_POISON_LEN;
 	const char *algname = crypto_skcipher_alg(tfm)->base.cra_name;
 	const char *driver = crypto_skcipher_driver_name(tfm);
+	struct rnd_state rng;
 	char _generic_driver[CRYPTO_MAX_ALG_NAME];
 	struct crypto_skcipher *generic_tfm = NULL;
 	struct skcipher_request *generic_req = NULL;
@@ -3027,6 +3095,8 @@ static int test_skcipher_vs_generic_impl
 	if (strncmp(algname, "kw(", 3) == 0)
 		return 0;
 
+	init_rnd_state(&rng);
+
 	if (!generic_driver) { /* Use default naming convention? */
 		err = build_generic_driver_name(algname, _generic_driver);
 		if (err)
@@ -3111,9 +3181,11 @@ static int test_skcipher_vs_generic_impl
 	}
 
 	for (i = 0; i < fuzz_iterations * 8; i++) {
-		generate_random_cipher_testvec(generic_req, &vec, maxdatasize,
+		generate_random_cipher_testvec(&rng, generic_req, &vec,
+					       maxdatasize,
 					       vec_name, sizeof(vec_name));
-		generate_random_testvec_config(cfg, cfgname, sizeof(cfgname));
+		generate_random_testvec_config(&rng, cfg, cfgname,
+					       sizeof(cfgname));
 
 		err = test_skcipher_vec_cfg(ENCRYPT, &vec, vec_name,
 					    cfg, req, tsgls);
author maintainer
#63 lore raw

PATCH 63/663 pwm: meson: Fix axg ao mux parents

In reply to Greg Kroah-Hartman

From: Heiner Kallweit <[email protected]>

commit eb411c0cf59ae6344b34bc6f0d298a22b300627e upstream.

This fix is basically the same as 9bce02ef0dfa ("pwm: meson: Fix the G12A AO clock parents order"). Vendor driver referenced there has xtal as first parent also for axg ao. In addition fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the axg clock driver.

Fixes bccaa3f917c9 ("pwm: meson: Add clock source configuration for Meson-AXG")
---
 drivers/pwm/pwm-meson.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-meson.c +1 -1
@@ -418,7 +418,7 @@ static const struct meson_pwm_data pwm_a
 };
 
 static const char * const pwm_axg_ao_parent_names[] = {
-	"aoclk81", "xtal", "fclk_div4", "fclk_div5"
+	"xtal", "axg_ao_clk81", "fclk_div4", "fclk_div5"
 };
 
 static const struct meson_pwm_data pwm_axg_ao_data = {
author maintainer
#96 lore raw

PATCH 96/663 ACPI: video: Remove acpi_backlight=video quirk for Lenovo ThinkPad W530

In reply to Greg Kroah-Hartman

From: Hans de Goede <[email protected]>

commit 3db66620ea90b0fd4134b31eabfec16d7b07d7e3 upstream.

Remove the acpi_backlight=video quirk for Lenovo ThinkPad W530.

This was intended to help users of the (unsupported) Nvidia binary driver, but this has been reported to cause backlight control issues for users who have the gfx configured in hybrid (dual-GPU) mode, so drop this.

The Nvidia binary driver should call acpi_video_register_backlight() when necessary and this has been reported to Nvidia.

Until this is fixed Nvidia binary driver users can work around this by passing "acpi_backlight=video" on the kernel commandline (with the latest 6.1.y or newer stable series, kernels < 6.1.y don't need this).

---
 drivers/acpi/video_detect.c |   14 --------------
 1 file changed, 14 deletions(-)
drivers/acpi/video_detect.c +0 -14
@@ -300,20 +300,6 @@ static const struct dmi_system_id video_
 	},
 
 	/*
-	 * Older models with nvidia GPU which need acpi_video backlight
-	 * control and where the old nvidia binary driver series does not
-	 * call acpi_video_register_backlight().
-	 */
-	{
-	 .callback = video_detect_force_video,
-	 /* ThinkPad W530 */
-	 .matches = {
-		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W530"),
-		},
-	},
-
-	/*
 	 * These models have a working acpi_video backlight control, and using
 	 * native backlight causes a regression where backlight does not work
 	 * when userspace is not handling brightness key events. Disable
author maintainer
#105 lore raw

PATCH 105/663 ubi: Fix return value overwrite issue in try_write_vid_and_data()

In reply to Greg Kroah-Hartman

From: Wang YanQing <[email protected]>

commit 31a149d5c13c4cbcf97de3435817263a2d8c9d6e upstream.

The commit 2d78aee426d8 ("UBI: simplify LEB write and atomic LEB change code") adds helper function, try_write_vid_and_data(), to simplify the code, but this helper function has bug, it will return 0 (success) when ubi_io_write_vid_hdr() or the ubi_io_write_data() return error number (-EIO, etc), because the return value of ubi_wl_put_peb() will overwrite the original return value.

This issue will cause unexpected data loss issue, because the caller of this function and UBIFS willn't know the data is lost.

Fixes 2d78aee426d8 ("UBI: simplify LEB write and atomic LEB change code")
---
 drivers/mtd/ubi/eba.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/mtd/ubi/eba.c +14 -5
@@ -946,7 +946,7 @@ static int try_write_vid_and_data(struct
 				  int offset, int len)
 {
 	struct ubi_device *ubi = vol->ubi;
-	int pnum, opnum, err, vol_id = vol->vol_id;
+	int pnum, opnum, err, err2, vol_id = vol->vol_id;
 
 	pnum = ubi_wl_get_peb(ubi);
 	if (pnum < 0) {
@@ -981,10 +981,19 @@ static int try_write_vid_and_data(struct
 out_put:
 	up_read(&ubi->fm_eba_sem);
 
-	if (err && pnum >= 0)
-		err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1);
-	else if (!err && opnum >= 0)
-		err = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0);
+	if (err && pnum >= 0) {
+		err2 = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1);
+		if (err2) {
+			ubi_warn(ubi, "failed to return physical eraseblock %d, error %d",
+				 pnum, err2);
+		}
+	} else if (!err && opnum >= 0) {
+		err2 = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0);
+		if (err2) {
+			ubi_warn(ubi, "failed to return physical eraseblock %d, error %d",
+				 opnum, err2);
+		}
+	}
 
 	return err;
 }
author maintainer
#106 lore raw

PATCH 106/663 ubifs: Free memory for tmpfile name

In reply to Greg Kroah-Hartman

From: Mårten Lindahl <[email protected]>

commit 1fb815b38bb31d6af9bd0540b8652a0d6fe6cfd3 upstream.

When opening a ubifs tmpfile on an encrypted directory, function fscrypt_setup_filename allocates memory for the name that is to be stored in the directory entry, but after the name has been copied to the directory entry inode, the memory is not freed.

When running kmemleak on it we see that it is registered as a leak. The report below is triggered by a simple program 'tmpfile' just opening a tmpfile:

unreferenced object 0xffff88810178f380 (size 32):

    comm "tmpfile", pid 509, jiffies 4294934744 (age 1524.742s)
    backtrace:
      __kmem_cache_alloc_node
      __kmalloc
      fscrypt_setup_filename
      ubifs_tmpfile
      vfs_tmpfile
      path_openat

Free this memory after it has been copied to the inode.

---
 fs/ubifs/dir.c |    1 +
 1 file changed, 1 insertion(+)
fs/ubifs/dir.c +1 -0
@@ -492,6 +492,7 @@ static int ubifs_tmpfile(struct user_nam
 	unlock_2_inodes(dir, inode);
 
 	ubifs_release_budget(c, &req);
+	fscrypt_free_filename(&nm);
 
 	return finish_open_simple(file, 0);
 
author maintainer
#107 lore raw

PATCH 107/663 ubifs: Fix memory leak in do_rename

In reply to Greg Kroah-Hartman

From: Mårten Lindahl <[email protected]>

commit 3a36d20e012903f45714df2731261fdefac900cb upstream.

If renaming a file in an encrypted directory, function fscrypt_setup_filename allocates memory for a file name. This name is never used, and before returning to the caller the memory for it is not freed.

When running kmemleak on it we see that it is registered as a leak. The report below is triggered by a simple program 'rename' that renames a file in an encrypted directory:

unreferenced object 0xffff888101502840 (size 32):

    comm "rename", pid 9404, jiffies 4302582475 (age 435.735s)
    backtrace:
      __kmem_cache_alloc_node
      __kmalloc
      fscrypt_setup_filename
      do_rename
      ubifs_rename
      vfs_rename
      do_renameat2

To fix this we can remove the call to fscrypt_setup_filename as it's not needed.

---
 fs/ubifs/dir.c |    6 ------
 1 file changed, 6 deletions(-)
fs/ubifs/dir.c +0 -6
@@ -358,7 +358,6 @@ static struct inode *create_whiteout(str
 	umode_t mode = S_IFCHR | WHITEOUT_MODE;
 	struct inode *inode;
 	struct ubifs_info *c = dir->i_sb->s_fs_info;
-	struct fscrypt_name nm;
 
 	/*
 	 * Create an inode('nlink = 1') for whiteout without updating journal,
@@ -369,10 +368,6 @@ static struct inode *create_whiteout(str
 	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
 		dentry, mode, dir->i_ino);
 
-	err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
-	if (err)
-		return ERR_PTR(err);
-
 	inode = ubifs_new_inode(c, dir, mode, false);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
@@ -395,7 +390,6 @@ out_inode:
 	make_bad_inode(inode);
 	iput(inode);
 out_free:
-	fscrypt_free_filename(&nm);
 	ubifs_err(c, "cannot create whiteout file, error %d", err);
 	return ERR_PTR(err);
 }
author maintainer
#108 lore raw

PATCH 108/663 ceph: fix potential use-after-free bug when trimming caps

In reply to Greg Kroah-Hartman

From: Xiubo Li <[email protected]>

commit aaf67de78807c59c35bafb5003d4fb457c764800 upstream.

When trimming the caps and just after the 'session->s_cap_lock' is released in ceph_iterate_session_caps() the cap maybe removed by another thread, and when using the stale cap memory in the callbacks it will trigger use-after-free crash.

We need to check the existence of the cap just after the 'ci->i_ceph_lock' being acquired. And do nothing if it's already removed.

---
 fs/ceph/caps.c       |    2 -
 fs/ceph/debugfs.c    |   16 +++++++----
 fs/ceph/mds_client.c |   72 ++++++++++++++++++++++++++++++++-------------------
 fs/ceph/mds_client.h |    3 --
 fs/ceph/super.h      |    2 +
 5 files changed, 61 insertions(+), 34 deletions(-)
fs/ceph/caps.c +1 -1
@@ -430,7 +430,7 @@ void ceph_reservation_status(struct ceph
  *
  * Called with i_ceph_lock held.
  */
-static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds)
+struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds)
 {
 	struct ceph_cap *cap;
 	struct rb_node *n = ci->i_caps.rb_node;
fs/ceph/debugfs.c +11 -5
@@ -248,14 +248,20 @@ static int metrics_caps_show(struct seq_
 	return 0;
 }
 
-static int caps_show_cb(struct inode *inode, struct ceph_cap *cap, void *p)
+static int caps_show_cb(struct inode *inode, int mds, void *p)
 {
+	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct seq_file *s = p;
+	struct ceph_cap *cap;
 
-	seq_printf(s, "0x%-17llx%-3d%-17s%-17s\n", ceph_ino(inode),
-		   cap->session->s_mds,
-		   ceph_cap_string(cap->issued),
-		   ceph_cap_string(cap->implemented));
+	spin_lock(&ci->i_ceph_lock);
+	cap = __get_cap_for_mds(ci, mds);
+	if (cap)
+		seq_printf(s, "0x%-17llx%-3d%-17s%-17s\n", ceph_ino(inode),
+			   cap->session->s_mds,
+			   ceph_cap_string(cap->issued),
+			   ceph_cap_string(cap->implemented));
+	spin_unlock(&ci->i_ceph_lock);
 	return 0;
 }
 
fs/ceph/mds_client.c +46 -26

161 lines not on this page · raw message

fs/ceph/mds_client.h +1 -2
@@ -541,8 +541,7 @@ extern void ceph_flush_cap_releases(stru
 extern void ceph_queue_cap_reclaim_work(struct ceph_mds_client *mdsc);
 extern void ceph_reclaim_caps_nr(struct ceph_mds_client *mdsc, int nr);
 extern int ceph_iterate_session_caps(struct ceph_mds_session *session,
-				     int (*cb)(struct inode *,
-					       struct ceph_cap *, void *),
+				     int (*cb)(struct inode *, int mds, void *),
 				     void *arg);
 extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
 
fs/ceph/super.h +2 -0
@@ -1192,6 +1192,8 @@ extern void ceph_kick_flushing_caps(stru
 				    struct ceph_mds_session *session);
 void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,
 				   struct ceph_inode_info *ci);
+extern struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci,
+					  int mds);
 extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci,
 					     int mds);
 extern void ceph_take_cap_refs(struct ceph_inode_info *ci, int caps,
author maintainer
#109 lore raw

PATCH 109/663 fs: dlm: fix DLM_IFL_CB_PENDING gets overwritten

In reply to Greg Kroah-Hartman

From: Alexander Aring <[email protected]>

commit a034c1370ded2ae6cbdc73a78241b3ed98c86d3d upstream.

This patch introduce a new internal flag per lkb value to handle internal flags which are handled not on wire. The current lkb internal flags stored as lkb->lkb_flags are split in upper and lower bits, the lower bits are used to share internal flags over wire for other cluster wide lkb copies on other nodes.

In commit 61bed0baa4db ("fs: dlm: use a non-static queue for callbacks") we introduced a new internal flag for pending callbacks for the dlm callback queue. This flag is protected by the lkb->lkb_cb_lock lock. This patch overlooked that on dlm receive path and the mentioned upper and lower bits, that dlm will read the flags, mask it and write it back. As example receive_flags() in fs/dlm/lock.c. This flag manipulation is not done atomically and is not protected by lkb->lkb_cb_lock. This has unknown side effects of the current callback handling.

In future we should move to set/clear/test bit functionality and avoid read, mask and writing back flag values. In later patches we will move the upper parts to the new introduced internal lkb flags which are not shared between other cluster nodes to the new non shared internal flag field to avoid similar issues.

Fixes 61bed0baa4db ("fs: dlm: use a non-static queue for callbacks")
---
 fs/dlm/ast.c          | 9 ++++-----
 fs/dlm/dlm_internal.h | 5 ++++-
 fs/dlm/user.c         | 2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)
fs/dlm/ast.c +4 -5
index 26fef9945cc9..39805aea3336 100644
@@ -45,7 +45,7 @@ void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb)
 		kref_put(&cb->ref, dlm_release_callback);
 	}
 
-	lkb->lkb_flags &= ~DLM_IFL_CB_PENDING;
+	clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
 
 	/* invalidate */
 	dlm_callback_set_last_ptr(&lkb->lkb_last_cast, NULL);
@@ -103,10 +103,9 @@ int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode,
 	cb->sb_status = status;
 	cb->sb_flags = (sbflags & 0x000000FF);
 	kref_init(&cb->ref);
-	if (!(lkb->lkb_flags & DLM_IFL_CB_PENDING)) {
-		lkb->lkb_flags |= DLM_IFL_CB_PENDING;
+	if (!test_and_set_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags))
 		rv = DLM_ENQUEUE_CALLBACK_NEED_SCHED;
-	}
+
 	list_add_tail(&cb->list, &lkb->lkb_callbacks);
 
 	if (flags & DLM_CB_CAST)
@@ -209,7 +208,7 @@ void dlm_callback_work(struct work_struct *work)
 		spin_lock(&lkb->lkb_cb_lock);
 		rv = dlm_dequeue_lkb_callback(lkb, &cb);
 		if (rv == DLM_DEQUEUE_CALLBACK_EMPTY) {
-			lkb->lkb_flags &= ~DLM_IFL_CB_PENDING;
+			clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
 			spin_unlock(&lkb->lkb_cb_lock);
 			break;
 		}
fs/dlm/dlm_internal.h +4 -1
index ab1a55337a6e..9bf70962bc49 100644
@@ -211,7 +211,9 @@ struct dlm_args {
 #endif
 #define DLM_IFL_DEADLOCK_CANCEL	0x01000000
 #define DLM_IFL_STUB_MS		0x02000000 /* magic number for m_flags */
-#define DLM_IFL_CB_PENDING	0x04000000
+
+#define DLM_IFL_CB_PENDING_BIT	0
+
 /* least significant 2 bytes are message changed, they are full transmitted
  * but at receive side only the 2 bytes LSB will be set.
  *
@@ -246,6 +248,7 @@ struct dlm_lkb {
 	uint32_t		lkb_exflags;	/* external flags from caller */
 	uint32_t		lkb_sbflags;	/* lksb flags */
 	uint32_t		lkb_flags;	/* internal flags */
+	unsigned long		lkb_iflags;	/* internal flags */
 	uint32_t		lkb_lvbseq;	/* lvb sequence number */
 
 	int8_t			lkb_status;     /* granted, waiting, convert */
fs/dlm/user.c +1 -1
index 35129505ddda..688a480879e4 100644
@@ -884,7 +884,7 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
 		goto try_another;
 	case DLM_DEQUEUE_CALLBACK_LAST:
 		list_del_init(&lkb->lkb_cb_list);
-		lkb->lkb_flags &= ~DLM_IFL_CB_PENDING;
+		clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
 		break;
 	case DLM_DEQUEUE_CALLBACK_SUCCESS:
 		break;
Signature · 1 line
2.40.1
author maintainer
#110 lore raw

PATCH 110/663 xfs: dont consider future format versions valid

In reply to Greg Kroah-Hartman

From: Dave Chinner <[email protected]>

commit aa88019851a85df80cb77f143758b13aee09e3d9 upstream.

In commit fe08cc504448 we reworked the valid superblock version checks. If it is a V5 filesystem, it is always valid, then we checked if the version was less than V4 (reject) and then checked feature fields in the V4 flags to determine if it was valid.

What we missed was that if the version is not V4 at this point, we shoudl reject the fs. i.e. the check current treats V6+ filesystems as if it was a v4 filesystem. Fix this.

Fixes fe08cc504448 ("xfs: open code sb verifier feature checks")
---
 fs/xfs/libxfs/xfs_sb.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/xfs/libxfs/xfs_sb.c +6 -5
@@ -72,7 +72,8 @@ xfs_sb_validate_v5_features(
 }
 
 /*
- * We support all XFS versions newer than a v4 superblock with V2 directories.
+ * We current support XFS v5 formats with known features and v4 superblocks with
+ * at least V2 directories.
  */
 bool
 xfs_sb_good_version(
@@ -86,16 +87,16 @@ xfs_sb_good_version(
 	if (xfs_sb_is_v5(sbp))
 		return xfs_sb_validate_v5_features(sbp);
 
+	/* versions prior to v4 are not supported */
+	if (XFS_SB_VERSION_NUM(sbp) != XFS_SB_VERSION_4)
+		return false;
+
 	/* We must not have any unknown v4 feature bits set */
 	if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
 	    ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
 	     (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
 		return false;
 
-	/* versions prior to v4 are not supported */
-	if (XFS_SB_VERSION_NUM(sbp) < XFS_SB_VERSION_4)
-		return false;
-
 	/* V4 filesystems need v2 directories and unwritten extents */
 	if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
 		return false;
author maintainer
#111 lore raw

PATCH 111/663 cxl/hdm: Fail upon detecting 0-sized decoders

In reply to Greg Kroah-Hartman

From: Dan Williams <[email protected]>

commit 7701c8bef4f14bd9f7940c6ed0e6a73584115a96 upstream.

Decoders committed with 0-size lead to later crashes on shutdown as __cxl_dpa_release() assumes a 'struct resource' has been established in the in 'cxlds->dpa_res'. Just fail the driver load in this instance since there are deeper problems with the enumeration or the setup when this happens.

---
 drivers/cxl/core/hdm.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/cxl/core/hdm.c +12 -3
@@ -219,8 +219,11 @@ static int __cxl_dpa_reserve(struct cxl_
 
 	lockdep_assert_held_write(&cxl_dpa_rwsem);
 
-	if (!len)
-		goto success;
+	if (!len) {
+		dev_warn(dev, "decoder%d.%d: empty reservation attempted\n",
+			 port->id, cxled->cxld.id);
+		return -EINVAL;
+	}
 
 	if (cxled->dpa_res) {
 		dev_dbg(dev, "decoder%d.%d: existing allocation %pr assigned\n",
@@ -273,7 +276,6 @@ static int __cxl_dpa_reserve(struct cxl_
 		cxled->mode = CXL_DECODER_MIXED;
 	}
 
-success:
 	port->hdm_end++;
 	get_device(&cxled->cxld.dev);
 	return 0;
@@ -732,6 +734,13 @@ static int init_hdm_decoder(struct cxl_p
 				 port->id, cxld->id);
 			return -ENXIO;
 		}
+
+		if (size == 0) {
+			dev_warn(&port->dev,
+				 "decoder%d.%d: Committed with zero size\n",
+				 port->id, cxld->id);
+			return -ENXIO;
+		}
 		port->commit_end = cxld->id;
 	} else {
 		/* unless / until type-2 drivers arrive, assume type-3 */
author maintainer
#112 lore raw

PATCH 112/663 bus: mhi: host: Remove duplicate ee check for syserr

In reply to Greg Kroah-Hartman

From: Jeffrey Hugo <[email protected]>

commit d469d9448a0f1a33c175d3280b1542fa0158ad7a upstream.

If we detect a system error via intvec, we only process the syserr if the current ee is different than the last observed ee. The reason for this check is to prevent bhie from running multiple times, but with the single queue handling syserr, that is not possible.

The check can cause an issue with device recovery. If PBL loads a bad SBL via BHI, but that SBL hangs before notifying the host of an ee change, then issuing soc_reset to crash the device and retry (after supplying a fixed SBL) will not recover the device as the host will observe a PBL->PBL transition and not process the syserr. The device will be stuck until either the driver is reloaded, or the host is rebooted. Instead, remove the check so that we can attempt to recover the device.

---
 drivers/bus/mhi/host/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/main.c +1 -1
@@ -503,7 +503,7 @@ irqreturn_t mhi_intvec_threaded_handler(
 	}
 	write_unlock_irq(&mhi_cntrl->pm_lock);
 
-	if (pm_state != MHI_PM_SYS_ERR_DETECT || ee == mhi_cntrl->ee)
+	if (pm_state != MHI_PM_SYS_ERR_DETECT)
 		goto exit_intvec;
 
 	switch (ee) {
author maintainer
#113 lore raw

PATCH 113/663 bus: mhi: host: Use mhi_tryset_pm_state() for setting fw error state

In reply to Greg Kroah-Hartman

From: Jeffrey Hugo <[email protected]>

commit 1d1493bdc25f498468a606a4ece947d155cfa3a9 upstream.

If firmware loading fails, the controller's pm_state is updated to MHI_PM_FW_DL_ERR unconditionally. This can corrupt the pm_state as the update is not done under the proper lock, and also does not validate the state transition. The firmware loading can fail due to a detected syserr, but if MHI_PM_FW_DL_ERR is unconditionally set as the pm_state, the handling of the syserr can break when it attempts to transition from syserr detect, to syserr process.

By grabbing the lock, we ensure we don't race with some other pm_state update. By using mhi_try_set_pm_state(), we check that the transition to MHI_PM_FW_DL_ERR is valid via the state machine logic. If it is not valid, then some other transition is occurring like syserr processing, and we assume that will resolve the firmware loading error.

---
 drivers/bus/mhi/host/boot.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/bus/mhi/host/boot.c +12 -4
@@ -391,6 +391,7 @@ void mhi_fw_load_handler(struct mhi_cont
 {
 	const struct firmware *firmware = NULL;
 	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	enum mhi_pm_state new_state;
 	const char *fw_name;
 	void *buf;
 	dma_addr_t dma_addr;
@@ -508,14 +509,18 @@ error_ready_state:
 	}
 
 error_fw_load:
-	mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR;
-	wake_up_all(&mhi_cntrl->state_event);
+	write_lock_irq(&mhi_cntrl->pm_lock);
+	new_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_FW_DL_ERR);
+	write_unlock_irq(&mhi_cntrl->pm_lock);
+	if (new_state == MHI_PM_FW_DL_ERR)
+		wake_up_all(&mhi_cntrl->state_event);
 }
 
 int mhi_download_amss_image(struct mhi_controller *mhi_cntrl)
 {
 	struct image_info *image_info = mhi_cntrl->fbc_image;
 	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	enum mhi_pm_state new_state;
 	int ret;
 
 	if (!image_info)
@@ -526,8 +531,11 @@ int mhi_download_amss_image(struct mhi_c
 			       &image_info->mhi_buf[image_info->entries - 1]);
 	if (ret) {
 		dev_err(dev, "MHI did not load AMSS, ret:%d\n", ret);
-		mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR;
-		wake_up_all(&mhi_cntrl->state_event);
+		write_lock_irq(&mhi_cntrl->pm_lock);
+		new_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_FW_DL_ERR);
+		write_unlock_irq(&mhi_cntrl->pm_lock);
+		if (new_state == MHI_PM_FW_DL_ERR)
+			wake_up_all(&mhi_cntrl->state_event);
 	}
 
 	return ret;
author maintainer
#114 lore raw

PATCH 114/663 bus: mhi: host: Range check CHDBOFF and ERDBOFF

In reply to Greg Kroah-Hartman

From: Jeffrey Hugo <[email protected]>

commit 6a0c637bfee69a74c104468544d9f2a6579626d0 upstream.

If the value read from the CHDBOFF and ERDBOFF registers is outside the range of the MHI register space then an invalid address might be computed which later causes a kernel panic. Range check the read value to prevent a crash due to bad data from the device.

---
 drivers/bus/mhi/host/init.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/bus/mhi/host/init.c +12 -0
@@ -516,6 +516,12 @@ int mhi_init_mmio(struct mhi_controller
 		return -EIO;
 	}
 
+	if (val >= mhi_cntrl->reg_len - (8 * MHI_DEV_WAKE_DB)) {
+		dev_err(dev, "CHDB offset: 0x%x is out of range: 0x%zx\n",
+			val, mhi_cntrl->reg_len - (8 * MHI_DEV_WAKE_DB));
+		return -ERANGE;
+	}
+
 	/* Setup wake db */
 	mhi_cntrl->wake_db = base + val + (8 * MHI_DEV_WAKE_DB);
 	mhi_cntrl->wake_set = false;
@@ -532,6 +538,12 @@ int mhi_init_mmio(struct mhi_controller
 		return -EIO;
 	}
 
+	if (val >= mhi_cntrl->reg_len - (8 * mhi_cntrl->total_ev_rings)) {
+		dev_err(dev, "ERDB offset: 0x%x is out of range: 0x%zx\n",
+			val, mhi_cntrl->reg_len - (8 * mhi_cntrl->total_ev_rings));
+		return -ERANGE;
+	}
+
 	/* Setup event db address for each ev_ring */
 	mhi_event = mhi_cntrl->mhi_event;
 	for (i = 0; i < mhi_cntrl->total_ev_rings; i++, val += 8, mhi_event++) {
author maintainer
#97 lore raw

PATCH 97/663 i2c: omap: Fix standard mode false ACK readings

In reply to Greg Kroah-Hartman

From: Reid Tonking <[email protected]>

commit c770657bd2611b077ec1e7b1fe6aa92f249399bd upstream.

Using standard mode, rare false ACK responses were appearing with i2cdetect tool. This was happening due to NACK interrupt triggering ISR thread before register access interrupt was ready. Removing the NACK interrupt's ability to trigger ISR thread lets register access ready interrupt do this instead.

Cc <[email protected]> # v3.7+
Fixes 3b2f8f82dad7 ("i2c: omap: switch to threaded IRQ support")
---
 drivers/i2c/busses/i2c-omap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -1058,7 +1058,7 @@ omap_i2c_isr(int irq, void *dev_id)
 	u16 stat;
 
 	stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
-	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
+	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG) & ~OMAP_I2C_STAT_NACK;
 
 	if (stat & mask)
 		ret = IRQ_WAKE_THREAD;
author maintainer
#115 lore raw

PATCH 115/663 ASoC: dt-bindings: qcom,lpass-rx-macro: correct minItems for clocks

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

commit 59257015ac8813d2430988aa01c2f4609a60e8e7 upstream.

The RX macro codec comes on some platforms in two variants - ADSP and ADSP bypassed - thus the clock-names varies from 3 to 5. The clocks must vary as well:

sc7280-idp.dtb: codec@3200000: clocks: [[202, 8], [202, 7], [203]] is too short

Fixes 852fda58d99a ("ASoC: qcom: dt-bindings: Update bindings for clocks in lpass digital codes")
---
 Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml |    1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +1 -0
@@ -30,6 +30,7 @@ properties:
     const: 0
 
   clocks:
+    minItems: 3
     maxItems: 5
 
   clock-names:
author maintainer
#116 lore raw

PATCH 116/663 kunit: fix bug in the order of lines in debugfs logs

In reply to Greg Kroah-Hartman

From: Rae Moar <[email protected]>

[ Upstream commit f9a301c3317daa921375da0aec82462ddf019928 ]

Fix bug in debugfs logs that causes an incorrect order of lines in the debugfs log.

Currently, the test counts lines that show the number of tests passed, failed, and skipped, as well as any suite diagnostic lines, appear prior to the individual results, which is a bug.

Ensure the order of printing for the debugfs log is correct. Additionally, add a KTAP header to so the debugfs logs can be valid KTAP.

This is an example of a log prior to these fixes:

KTAP version 1

# Subtest: kunit_status
1..2
# kunit_status: pass:2 fail:0 skip:0 total:2
# Totals: pass:2 fail:0 skip:0 total:2
ok 1 kunit_status_set_failure_test
ok 2 kunit_status_mark_skipped_test
ok 1 kunit_status

Note the two lines with stats are out of order. This is the same debugfs log after the fixes (in combination with the third patch to remove the extra line):

KTAP version 1
1..1
KTAP version 1
# Subtest: kunit_status
1..2
ok 1 kunit_status_set_failure_test
ok 2 kunit_status_mark_skipped_test
# kunit_status: pass:2 fail:0 skip:0 total:2
# Totals: pass:2 fail:0 skip:0 total:2
ok 1 kunit_status

---
 lib/kunit/debugfs.c | 14 ++++++++++++--
 lib/kunit/test.c    | 21 ++++++++++++++-------
 2 files changed, 26 insertions(+), 9 deletions(-)
lib/kunit/debugfs.c +12 -2
index de0ee2e03ed60..b08bb1fba106d 100644
@@ -55,14 +55,24 @@ static int debugfs_print_results(struct seq_file *seq, void *v)
 	enum kunit_status success = kunit_suite_has_succeeded(suite);
 	struct kunit_case *test_case;
 
-	if (!suite || !suite->log)
+	if (!suite)
 		return 0;
 
-	seq_printf(seq, "%s", suite->log);
+	/* Print KTAP header so the debugfs log can be parsed as valid KTAP. */
+	seq_puts(seq, "KTAP version 1\n");
+	seq_puts(seq, "1..1\n");
+
+	/* Print suite header because it is not stored in the test logs. */
+	seq_puts(seq, KUNIT_SUBTEST_INDENT "KTAP version 1\n");
+	seq_printf(seq, KUNIT_SUBTEST_INDENT "# Subtest: %s\n", suite->name);
+	seq_printf(seq, KUNIT_SUBTEST_INDENT "1..%zd\n", kunit_suite_num_test_cases(suite));
 
 	kunit_suite_for_each_test_case(suite, test_case)
 		debugfs_print_result(seq, suite, test_case);
 
+	if (suite->log)
+		seq_printf(seq, "%s", suite->log);
+
 	seq_printf(seq, "%s %d %s\n",
 		   kunit_status_to_ok_not_ok(success), 1, suite->name);
 	return 0;
lib/kunit/test.c +14 -7
index 890ba5b3a9819..820f867e35f40 100644
@@ -152,10 +152,18 @@ EXPORT_SYMBOL_GPL(kunit_suite_num_test_cases);
 
 static void kunit_print_suite_start(struct kunit_suite *suite)
 {
-	kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "KTAP version 1\n");
-	kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "# Subtest: %s",
+	/*
+	 * We do not log the test suite header as doing so would
+	 * mean debugfs display would consist of the test suite
+	 * header prior to individual test results.
+	 * Hence directly printk the suite status, and we will
+	 * separately seq_printf() the suite header for the debugfs
+	 * representation.
+	 */
+	pr_info(KUNIT_SUBTEST_INDENT "KTAP version 1\n");
+	pr_info(KUNIT_SUBTEST_INDENT "# Subtest: %s\n",
 		  suite->name);
-	kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "1..%zd",
+	pr_info(KUNIT_SUBTEST_INDENT "1..%zd\n",
 		  kunit_suite_num_test_cases(suite));
 }
 
@@ -172,10 +180,9 @@ static void kunit_print_ok_not_ok(void *test_or_suite,
 
 	/*
 	 * We do not log the test suite results as doing so would
-	 * mean debugfs display would consist of the test suite
-	 * description and status prior to individual test results.
-	 * Hence directly printk the suite status, and we will
-	 * separately seq_printf() the suite status for the debugfs
+	 * mean debugfs display would consist of an incorrect test
+	 * number. Hence directly printk the suite result, and we will
+	 * separately seq_printf() the suite results for the debugfs
 	 * representation.
 	 */
 	if (suite)
Signature · 1 line
2.39.2
author maintainer
#117 lore raw

PATCH 117/663 rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check

In reply to Greg Kroah-Hartman

From: Zqiang <[email protected]>

[ Upstream commit db7b464df9d820186e98a65aa6a10f0d51fbf8ce ]

This commit adds checks for the TICK_DEP_MASK_RCU_EXP bit, thus enabling RCU expedited grace periods to actually force-enable scheduling-clock interrupts on holdout CPUs.

Fixes df1e849ae455 ("rcu: Enable tick for nohz_full CPUs slow to provide expedited QS")
Cc Steven Rostedt <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Anna-Maria Behnsen <[email protected]>
---
 include/trace/events/timer.h | 3 ++-
 kernel/time/tick-sched.c     | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)
include/trace/events/timer.h +2 -1
index 2e713a7d9aa3a..3e8619c72f774 100644
@@ -371,7 +371,8 @@ TRACE_EVENT(itimer_expire,
 		tick_dep_name(PERF_EVENTS)		\
 		tick_dep_name(SCHED)			\
 		tick_dep_name(CLOCK_UNSTABLE)		\
-		tick_dep_name_end(RCU)
+		tick_dep_name(RCU)			\
+		tick_dep_name_end(RCU_EXP)
 
 #undef tick_dep_name
 #undef tick_dep_mask_name
kernel/time/tick-sched.c +5 -0
index 68d81a4283c89..a46506f7ec6d0 100644
@@ -281,6 +281,11 @@ static bool check_tick_dependency(atomic_t *dep)
 		return true;
 	}
 
+	if (val & TICK_DEP_MASK_RCU_EXP) {
+		trace_tick_stop(0, TICK_DEP_MASK_RCU_EXP);
+		return true;
+	}
+
 	return false;
 }
 
Signature · 1 line
2.39.2
author maintainer
#118 lore raw

PATCH 118/663 selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

[ Upstream commit 22a8be280383812235131dda18a8212a59fadd2d ]

malloc_and_init_memory() in fill_buf isn't checking if memalign() successfully allocated memory or not before accessing the memory.

Check the return value of memalign() and return NULL if allocating aligned memory fails.

Fixes a2561b12fe39 ("selftests/resctrl: Add built in benchmark")
---
 tools/testing/selftests/resctrl/fill_buf.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/resctrl/fill_buf.c +2 -0
index 56ccbeae0638d..c20d0a7ecbe63 100644
@@ -68,6 +68,8 @@ static void *malloc_and_init_memory(size_t s)
 	size_t s64;
 
 	void *p = memalign(PAGE_SIZE, s);
+	if (!p)
+		return NULL;
 
 	p64 = (uint64_t *)p;
 	s64 = s / sizeof(uint64_t);
Signature · 1 line
2.39.2
author maintainer
#119 lore raw

PATCH 119/663 selftests/resctrl: Move ->setup() call outside of test specific branches

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

[ Upstream commit c90b3b588e369c20087699316259fa5ebbb16f2d ]

resctrl_val() function is called only by MBM, MBA, and CMT tests which means the else branch is never used.

Both test branches call param->setup().

Remove the unused else branch and place the ->setup() call outside of the test specific branches reducing code duplication.

Stable-dep-of: fa10366cc6f4 ("selftests/resctrl: Allow ->setup() to return errors")

---
 tools/testing/selftests/resctrl/resctrl_val.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
tools/testing/selftests/resctrl/resctrl_val.c +6 -13
index b32b96356ec70..787546a528493 100644
@@ -734,29 +734,22 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
 
 	/* Test runs until the callback setup() tells the test to stop. */
 	while (1) {
+		ret = param->setup(1, param);
+		if (ret) {
+			ret = 0;
+			break;
+		}
+
 		if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR)) ||
 		    !strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) {
-			ret = param->setup(1, param);
-			if (ret) {
-				ret = 0;
-				break;
-			}
-
 			ret = measure_vals(param, &bw_resc_start);
 			if (ret)
 				break;
 		} else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
-			ret = param->setup(1, param);
-			if (ret) {
-				ret = 0;
-				break;
-			}
 			sleep(1);
 			ret = measure_cache_vals(param, bm_pid);
 			if (ret)
 				break;
-		} else {
-			break;
 		}
 	}
 
Signature · 1 line
2.39.2
author maintainer
#120 lore raw

PATCH 120/663 selftests/resctrl: Allow ->setup() to return errors

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

[ Upstream commit fa10366cc6f4cc862871f8938426d85c2481f084 ]

resctrl_val() assumes ->setup() always returns either 0 to continue tests or < 0 in case of the normal termination of tests after x runs. The latter overlaps with normal error returns.

Define END_OF_TESTS (=1) to differentiate the normal termination of tests and return errors as negative values. Alter callers of ->setup() to handle errors properly.

Fixes 790bf585b0ee ("selftests/resctrl: Add Cache Allocation Technology (CAT) selftest")
Fixes ecdbb911f22d ("selftests/resctrl: Add MBM test")
---
 tools/testing/selftests/resctrl/cache.c       | 4 +++-
 tools/testing/selftests/resctrl/cat_test.c    | 2 +-
 tools/testing/selftests/resctrl/cmt_test.c    | 2 +-
 tools/testing/selftests/resctrl/mba_test.c    | 2 +-
 tools/testing/selftests/resctrl/mbm_test.c    | 2 +-
 tools/testing/selftests/resctrl/resctrl.h     | 2 ++
 tools/testing/selftests/resctrl/resctrl_val.c | 4 +++-
 7 files changed, 12 insertions(+), 6 deletions(-)
tools/testing/selftests/resctrl/cache.c +3 -1
index 68ff856d36f0b..0485863a169f2 100644
@@ -244,10 +244,12 @@ int cat_val(struct resctrl_val_param *param)
 	while (1) {
 		if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) {
 			ret = param->setup(1, param);
-			if (ret) {
+			if (ret == END_OF_TESTS) {
 				ret = 0;
 				break;
 			}
+			if (ret < 0)
+				break;
 			ret = reset_enable_llc_perf(bm_pid, param->cpu_no);
 			if (ret)
 				break;
tools/testing/selftests/resctrl/cat_test.c +1 -1
index 1c5e90c632548..2d3c7c77ab6cb 100644
@@ -40,7 +40,7 @@ static int cat_setup(int num, ...)
 
 	/* Run NUM_OF_RUNS times */
 	if (p->num_of_runs >= NUM_OF_RUNS)
-		return -1;
+		return END_OF_TESTS;
 
 	if (p->num_of_runs == 0) {
 		sprintf(schemata, "%lx", p->mask);
tools/testing/selftests/resctrl/cmt_test.c +1 -1
index 8968e36db99d7..3b0454e7fc826 100644
@@ -32,7 +32,7 @@ static int cmt_setup(int num, ...)
 
 	/* Run NUM_OF_RUNS times */
 	if (p->num_of_runs >= NUM_OF_RUNS)
-		return -1;
+		return END_OF_TESTS;
 
 	p->num_of_runs++;
 
tools/testing/selftests/resctrl/mba_test.c +1 -1
index 1a1bdb6180cf2..f32289ae17aeb 100644
@@ -41,7 +41,7 @@ static int mba_setup(int num, ...)
 		return 0;
 
 	if (allocation < ALLOCATION_MIN || allocation > ALLOCATION_MAX)
-		return -1;
+		return END_OF_TESTS;
 
 	sprintf(allocation_str, "%d", allocation);
 
tools/testing/selftests/resctrl/mbm_test.c +1 -1
index 8392e5c55ed02..280187628054d 100644
@@ -95,7 +95,7 @@ static int mbm_setup(int num, ...)
 
 	/* Run NUM_OF_RUNS times */
 	if (num_of_runs++ >= NUM_OF_RUNS)
-		return -1;
+		return END_OF_TESTS;
 
 	va_start(param, num);
 	p = va_arg(param, struct resctrl_val_param *);
tools/testing/selftests/resctrl/resctrl.h +2 -0
index f0ded31fb3c7c..f44fa2de4d986 100644
@@ -37,6 +37,8 @@
 #define ARCH_INTEL     1
 #define ARCH_AMD       2
 
+#define END_OF_TESTS	1
+
 #define PARENT_EXIT(err_msg)			\
 	do {					\
 		perror(err_msg);		\
tools/testing/selftests/resctrl/resctrl_val.c +3 -1
index 787546a528493..00864242d76c6 100644
@@ -735,10 +735,12 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
 	/* Test runs until the callback setup() tells the test to stop. */
 	while (1) {
 		ret = param->setup(1, param);
-		if (ret) {
+		if (ret == END_OF_TESTS) {
 			ret = 0;
 			break;
 		}
+		if (ret < 0)
+			break;
 
 		if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR)) ||
 		    !strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) {
Signature · 1 line
2.39.2