Skip to contentSkip to conversation

5.15.111-rc1 review

PATCH In review Greg Kroah-Hartman 8 participants 385 messages May 8, 2023 – Jul 16, 2023 Page 1 of 3

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

PATCH 1/371 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 2d53a707aff9c..089b6c7994f9a 100644
@@ -212,6 +212,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/371 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
@@ -218,6 +218,7 @@ static int mt7921_pci_probe(struct pci_d
 	struct mt7921_dev *dev;
 	struct mt76_dev *mdev;
 	int ret;
+	u16 cmd;
 
 	ret = pcim_enable_device(pdev);
 	if (ret)
@@ -227,6 +228,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
#11 lore raw

PATCH 11/371 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
@@ -9,15 +9,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
@@ -272,7 +272,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
@@ -855,7 +855,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
@@ -409,7 +409,7 @@ SYM_FUNC_END(__create_page_tables)
 	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_CPU]
author maintainer
#12 lore raw

PATCH 12/371 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
@@ -883,19 +883,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
 
 	/*
@@ -904,9 +904,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
#13 lore raw

PATCH 13/371 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
#14 lore raw

PATCH 14/371 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
@@ -1228,11 +1228,9 @@ static int qcom_pcie_init_2_7_0(struct q
 	val |= BIT(4);
 	writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_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
#15 lore raw

PATCH 15/371 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
#16 lore raw

PATCH 16/371 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
@@ -1642,13 +1642,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);
 
@@ -1707,12 +1705,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:
 	clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks);
 assert_reset:
author maintainer
#17 lore raw

PATCH 17/371 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
@@ -1732,6 +1732,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
#18 lore raw

PATCH 18/371 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)
 
 #define ZEN_SVI_BASE				0x0005A000
 
@@ -175,7 +176,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
#19 lore raw

PATCH 19/371 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
@@ -1515,9 +1515,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
#2 lore raw

PATCH 2/371 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 3b673477f6215..6f616ac4490f0 100644
@@ -1554,10 +1554,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
#20 lore raw

PATCH 20/371 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>
 #include <linux/task_work.h>
@@ -63,16 +64,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,
@@ -136,10 +139,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
#21 lore raw

PATCH 21/371 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-core.c            |    7 +++++++
 block/blk-crypto-internal.h |   25 +++++++++++++++++++++----
 block/blk-crypto.c          |   24 ++++++++++++------------
 block/blk-merge.c           |    2 ++
 block/blk-mq.c              |    2 +-
 5 files changed, 43 insertions(+), 17 deletions(-)
block/blk-core.c +7 -0
@@ -1421,6 +1421,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)))
 		print_req_error(req, error, __func__);
block/blk-crypto-internal.h +21 -4
@@ -60,6 +60,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;
+}
+
 #else /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 static inline bool bio_crypt_rq_ctx_compatible(struct request *rq,
@@ -93,6 +98,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);
@@ -127,14 +137,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)
 {
@@ -173,7 +190,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
@@ -216,26 +216,26 @@ 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_ksm_get_slot_for_key(rq->q->ksm, 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_ksm_put_slot(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
@@ -818,6 +818,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 +1 -1
@@ -2228,7 +2228,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *b
 
 	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
#22 lore raw

PATCH 22/371 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         |   22 ++++++++++------------
 drivers/md/dm-table.c      |   19 +++++--------------
 include/linux/blk-crypto.h |    4 ++--
 3 files changed, 17 insertions(+), 28 deletions(-)
block/blk-crypto.c +10 -12
@@ -13,6 +13,7 @@
 #include <linux/blkdev.h>
 #include <linux/keyslot-manager.h>
 #include <linux/module.h>
+#include <linux/ratelimit.h>
 #include <linux/slab.h>
 
 #include "blk-crypto-internal.h"
@@ -393,20 +394,17 @@ int blk_crypto_start_using_key(const str
  * 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 key is not present in the q's ksm, -err on error.
  */
-int blk_crypto_evict_key(struct request_queue *q,
-			 const struct blk_crypto_key *key)
+void blk_crypto_evict_key(struct request_queue *q,
+			  const struct blk_crypto_key *key)
 {
-	if (blk_ksm_crypto_cfg_supported(q->ksm, &key->crypto_cfg))
-		return blk_ksm_evict_key(q->ksm, key);
+	int err;
 
-	/*
-	 * If the request queue's associated inline encryption hardware didn't
-	 * have support for the key, then the key might have been programmed
-	 * into the fallback keyslot manager, so try to evict from there.
-	 */
-	return blk_crypto_fallback_evict_key(key);
+	if (blk_ksm_crypto_cfg_supported(q->ksm, &key->crypto_cfg))
+		err = blk_ksm_evict_key(q->ksm, key);
+	else
+		err = blk_crypto_fallback_evict_key(key);
+	if (err)
+		pr_warn_ratelimited("error %d evicting key\n", err);
 }
 EXPORT_SYMBOL_GPL(blk_crypto_evict_key);
drivers/md/dm-table.c +5 -14
@@ -1191,21 +1191,12 @@ struct dm_keyslot_manager {
 	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(bdev_get_queue(dev->bdev), args->key);
-	if (!args->err)
-		args->err = err;
-	/* Always try to evict the key from all devices. */
+	blk_crypto_evict_key(bdev_get_queue(dev->bdev), key);
 	return 0;
 }
 
@@ -1220,7 +1211,6 @@ static int dm_keyslot_evict(struct blk_k
 						       struct dm_keyslot_manager,
 						       ksm);
 	struct mapped_device *md = dksm->md;
-	struct dm_keyslot_evict_args args = { key };
 	struct dm_table *t;
 	int srcu_idx;
 	int i;
@@ -1233,10 +1223,11 @@ static int dm_keyslot_evict(struct blk_k
 		ti = dm_table_get_target(t, i);
 		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 const struct blk_ksm_ll_ops dm_ksm_ll_ops = {
include/linux/blk-crypto.h +2 -2
@@ -97,8 +97,8 @@ int blk_crypto_init_key(struct blk_crypt
 int blk_crypto_start_using_key(const struct blk_crypto_key *key,
 			       struct request_queue *q);
 
-int blk_crypto_evict_key(struct request_queue *q,
-			 const struct blk_crypto_key *key);
+void blk_crypto_evict_key(struct request_queue *q,
+			  const struct blk_crypto_key *key);
 
 bool blk_crypto_config_supported(struct request_queue *q,
 				 const struct blk_crypto_config *cfg);
author maintainer
#23 lore raw

PATCH 23/371 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.c      |   29 +++++++++++++++++++++--------
 block/keyslot-manager.c |   43 +++++++++++++++++++++----------------------
 2 files changed, 42 insertions(+), 30 deletions(-)
block/blk-crypto.c +21 -8
@@ -385,15 +385,20 @@ int blk_crypto_start_using_key(const str
 }
 
 /**
- * blk_crypto_evict_key() - Evict a key from any inline encryption hardware
- *			    it may have been programmed into
- * @q: The request queue 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 request_queue
+ * @q: a request_queue 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 request_queue, 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 request_queue 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 request_queue *q,
 			  const struct blk_crypto_key *key)
@@ -404,6 +409,14 @@ void blk_crypto_evict_key(struct request
 		err = blk_ksm_evict_key(q->ksm, 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("error %d evicting key\n", err);
 }
block/keyslot-manager.c +21 -22

68 lines not on this page · raw message

author maintainer
#24 lore raw

PATCH 24/371 ext4: use ext4_journal_start/stop for fast commit transactions

In reply to Greg Kroah-Hartman

From: Harshad Shirwadkar <[email protected]>

commit 2729cfdcfa1cc49bef5a90d046fa4a187fdfcc69 upstream.

This patch drops all calls to ext4_fc_start_update() and ext4_fc_stop_update(). To ensure that there are no ongoing journal updates during fast commit, we also make jbd2_fc_begin_commit() lock journal for updates. This way we don't have to maintain two different transaction start stop APIs for fast commit and full commit. This patch doesn't remove the functions altogether since in future we want to have inode level locking for fast commits.

---
 fs/ext4/acl.c     |    2 --
 fs/ext4/extents.c |    3 ---
 fs/ext4/file.c    |    4 ----
 fs/ext4/inode.c   |    7 +------
 fs/ext4/ioctl.c   |   10 +---------
 fs/jbd2/journal.c |    2 ++
 6 files changed, 4 insertions(+), 24 deletions(-)
fs/ext4/acl.c +0 -2
@@ -246,7 +246,6 @@ retry:
 	handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits);
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
-	ext4_fc_start_update(inode);
 
 	if ((type == ACL_TYPE_ACCESS) && acl) {
 		error = posix_acl_update_mode(mnt_userns, inode, &mode, &acl);
@@ -264,7 +263,6 @@ retry:
 	}
 out_stop:
 	ext4_journal_stop(handle);
-	ext4_fc_stop_update(inode);
 	if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
 		goto retry;
 	return error;
fs/ext4/extents.c +0 -3
@@ -4701,8 +4701,6 @@ long ext4_fallocate(struct file *file, i
 		     FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
-	ext4_fc_start_update(inode);
-
 	inode_lock(inode);
 	ret = ext4_convert_inline_data(inode);
 	inode_unlock(inode);
@@ -4772,7 +4770,6 @@ out:
 	inode_unlock(inode);
 	trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
 exit:
-	ext4_fc_stop_update(inode);
 	return ret;
 }
 
fs/ext4/file.c +0 -4
@@ -259,7 +259,6 @@ static ssize_t ext4_buffered_write_iter(
 	if (iocb->ki_flags & IOCB_NOWAIT)
 		return -EOPNOTSUPP;
 
-	ext4_fc_start_update(inode);
 	inode_lock(inode);
 	ret = ext4_write_checks(iocb, from);
 	if (ret <= 0)
@@ -271,7 +270,6 @@ static ssize_t ext4_buffered_write_iter(
 
 out:
 	inode_unlock(inode);
-	ext4_fc_stop_update(inode);
 	if (likely(ret > 0)) {
 		iocb->ki_pos += ret;
 		ret = generic_write_sync(iocb, ret);
@@ -558,9 +556,7 @@ static ssize_t ext4_dio_write_iter(struc
 			goto out;
 		}
 
-		ext4_fc_start_update(inode);
 		ret = ext4_orphan_add(handle, inode);
-		ext4_fc_stop_update(inode);
 		if (ret) {
 			ext4_journal_stop(handle);
 			goto out;
fs/ext4/inode.c +1 -6
@@ -5366,7 +5366,7 @@ int ext4_setattr(struct user_namespace *
 		if (error)
 			return error;
 	}
-	ext4_fc_start_update(inode);
+
 	if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)) ||
 	    (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid))) {
 		handle_t *handle;
@@ -5390,7 +5390,6 @@ int ext4_setattr(struct user_namespace *
 
 		if (error) {
 			ext4_journal_stop(handle);
-			ext4_fc_stop_update(inode);
 			return error;
 		}
 		/* Update corresponding info in inode so that everything is in
@@ -5402,7 +5401,6 @@ int ext4_setattr(struct user_namespace *
 		error = ext4_mark_inode_dirty(handle, inode);
 		ext4_journal_stop(handle);
 		if (unlikely(error)) {
-			ext4_fc_stop_update(inode);
 			return error;
 		}
 	}
@@ -5417,12 +5415,10 @@ int ext4_setattr(struct user_namespace *
 			struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
 
 			if (attr->ia_size > sbi->s_bitmap_maxbytes) {
-				ext4_fc_stop_update(inode);
 				return -EFBIG;
 			}
 		}
 		if (!S_ISREG(inode->i_mode)) {
-			ext4_fc_stop_update(inode);
 			return -EINVAL;
 		}
 
@@ -5548,7 +5544,6 @@ err_out:
 		ext4_std_error(inode->i_sb, error);
 	if (!error)
 		error = rc;
-	ext4_fc_stop_update(inode);
 	return error;
 }
 
fs/ext4/ioctl.c +1 -9
@@ -744,7 +744,6 @@ int ext4_fileattr_set(struct user_namesp
 	u32 flags = fa->flags;
 	int err = -EOPNOTSUPP;
 
-	ext4_fc_start_update(inode);
 	if (flags & ~EXT4_FL_USER_VISIBLE)
 		goto out;
 
@@ -765,7 +764,6 @@ int ext4_fileattr_set(struct user_namesp
 		goto out;
 	err = ext4_ioctl_setproject(inode, fa->fsx_projid);
 out:
-	ext4_fc_stop_update(inode);
 	return err;
 }
 
@@ -1272,13 +1270,7 @@ resizefs_out:
 
 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-	long ret;
-
-	ext4_fc_start_update(file_inode(filp));
-	ret = __ext4_ioctl(filp, cmd, arg);
-	ext4_fc_stop_update(file_inode(filp));
-
-	return ret;
+	return __ext4_ioctl(filp, cmd, arg);
 }
 
 #ifdef CONFIG_COMPAT
fs/jbd2/journal.c +2 -0
@@ -757,6 +757,7 @@ int jbd2_fc_begin_commit(journal_t *jour
 	}
 	journal->j_flags |= JBD2_FAST_COMMIT_ONGOING;
 	write_unlock(&journal->j_state_lock);
+	jbd2_journal_lock_updates(journal);
 
 	return 0;
 }
@@ -768,6 +769,7 @@ EXPORT_SYMBOL(jbd2_fc_begin_commit);
  */
 static int __jbd2_fc_end_commit(journal_t *journal, tid_t tid, bool fallback)
 {
+	jbd2_journal_unlock_updates(journal);
 	if (journal->j_fc_cleanup_callback)
 		journal->j_fc_cleanup_callback(journal, 0, tid);
 	write_lock(&journal->j_state_lock);
author maintainer
#25 lore raw

PATCH 25/371 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
#26 lore raw

PATCH 26/371 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
@@ -950,13 +950,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
#27 lore raw

PATCH 27/371 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
#28 lore raw

PATCH 28/371 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
@@ -510,7 +510,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
@@ -518,8 +518,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
#29 lore raw

PATCH 29/371 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
#3 lore raw

PATCH 3/371 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 ba0efc30fac52..8d3c649a1769b 100644
@@ -289,12 +289,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
#4 lore raw

PATCH 4/371 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 f9c8385c72d3d..496aab94570a1 100644
@@ -638,7 +638,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
#5 lore raw

PATCH 5/371 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 5f6e2bb324406..4df1be8170bb6 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
#6 lore raw

PATCH 6/371 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
#7 lore raw

PATCH 7/371 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 98954dda57344..82f2c01accbb9 100644
@@ -190,7 +190,7 @@ static inline u64 readq(const volatile void __iomem *addr)
 	u64 val;
 
 	__io_br();
-	val = __le64_to_cpu(__raw_readq(addr));
+	val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
 	__io_ar(val);
 	return val;
 }
@@ -233,7 +233,7 @@ static inline void writel(u32 value, volatile void __iomem *addr)
 static inline void writeq(u64 value, volatile void __iomem *addr)
 {
 	__io_bw();
-	__raw_writeq(__cpu_to_le64(value), addr);
+	__raw_writeq((u64 __force)__cpu_to_le64(value), addr);
 	__io_aw();
 }
 #endif
Signature · 1 line
2.39.2
author maintainer
#8 lore raw

PATCH 8/371 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
index b8e7ea9e71e20..fc12d970a07c0 100644
@@ -115,6 +115,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 */
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH 9/371 wireguard: timers: cast enum limits members to int in prints

In reply to Greg Kroah-Hartman

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

commit 2d4ee16d969c97996e80e4c9cb6de0acaff22c9f upstream.

Since gcc13, each member of an enum has the same type as the enum. And that is inherited from its members. Provided "REKEY_AFTER_MESSAGES = 1ULL << 60", the named type is unsigned long.

This generates warnings with gcc-13:
error: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int'

Cast those particular enum members to int when printing them.

---
 drivers/net/wireguard/timers.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireguard/timers.c +4 -4
@@ -46,7 +46,7 @@ static void wg_expired_retransmit_handsh
 	if (peer->timer_handshake_attempts > MAX_TIMER_HANDSHAKES) {
 		pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d attempts, giving up\n",
 			 peer->device->dev->name, peer->internal_id,
-			 &peer->endpoint.addr, MAX_TIMER_HANDSHAKES + 2);
+			 &peer->endpoint.addr, (int)MAX_TIMER_HANDSHAKES + 2);
 
 		del_timer(&peer->timer_send_keepalive);
 		/* We drop all packets without a keypair and don't try again,
@@ -64,7 +64,7 @@ static void wg_expired_retransmit_handsh
 		++peer->timer_handshake_attempts;
 		pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n",
 			 peer->device->dev->name, peer->internal_id,
-			 &peer->endpoint.addr, REKEY_TIMEOUT,
+			 &peer->endpoint.addr, (int)REKEY_TIMEOUT,
 			 peer->timer_handshake_attempts + 1);
 
 		/* We clear the endpoint address src address, in case this is
@@ -94,7 +94,7 @@ static void wg_expired_new_handshake(str
 
 	pr_debug("%s: Retrying handshake with peer %llu (%pISpfsc) because we stopped hearing back after %d seconds\n",
 		 peer->device->dev->name, peer->internal_id,
-		 &peer->endpoint.addr, KEEPALIVE_TIMEOUT + REKEY_TIMEOUT);
+		 &peer->endpoint.addr, (int)(KEEPALIVE_TIMEOUT + REKEY_TIMEOUT));
 	/* We clear the endpoint address src address, in case this is the cause
 	 * of trouble.
 	 */
@@ -126,7 +126,7 @@ static void wg_queued_expired_zero_key_m
 
 	pr_debug("%s: Zeroing out all keys for peer %llu (%pISpfsc), since we haven't received a new one in %d seconds\n",
 		 peer->device->dev->name, peer->internal_id,
-		 &peer->endpoint.addr, REJECT_AFTER_TIME * 3);
+		 &peer->endpoint.addr, (int)REJECT_AFTER_TIME * 3);
 	wg_noise_handshake_clear(&peer->handshake);
 	wg_noise_keypairs_clear(&peer->keypairs);
 	wg_peer_put(peer);

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 5.15.111-rc1 review

This is the start of the stable review cycle for the 5.15.111 release. There are 371 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:47:07 +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/v5.x/stable-review/patch-5.15.111-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-5.15.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 5.15.111-rc1

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

Miles Chen <[email protected]>
sound/oss/dmasound: fix 'dmasound_setup' defined but not used

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tudor Ambarus <[email protected]>
dmaengine: at_xdmac: Fix race for the tx desc callback

Tudor Ambarus <[email protected]>
dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie

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

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

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.

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

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

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

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

Dmitry Baryshkov <[email protected]>
clk: qcom: regmap: add PHY clock source implementation

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

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

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

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

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

Imran Khan <[email protected]>
workqueue: Introduce show_one_worker_pool and show_one_workqueue.

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

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

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

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

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

Yafang Shao <[email protected]>
sched: Make struct sched_statistics independent of fair sched class

Yafang Shao <[email protected]>
sched/fair: Use __schedstat_set() in set_next_entity()

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

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

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

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: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path

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

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

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

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

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

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

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

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

Minghao Chi <[email protected]>
spi: spi-imx: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

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

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

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

Erwan Le Ray <[email protected]>
serial: stm32: re-introduce an irq flag condition in usart_receive_chars

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()

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"

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"

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

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

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

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

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

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

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

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

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

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

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

Yu Kuai <[email protected]>
md/raid10: factor out code from wait_barrier() to stop_waiting_barrier()

Vishal Verma <[email protected]>
md: raid10 add nowait support

Mariusz Tkaczyk <[email protected]>
md: drop queue limitation for RAID1 and RAID10

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

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

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

Michael Kelley <[email protected]>
nvme: handle the persistent internal error AER

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()

Christoph Hellwig <[email protected]>
nvmet: move the call to nvmet_ns_changed out of nvmet_ns_revalidate

Chaitanya Kulkarni <[email protected]>
nvmet: use i_size_read() to set size for file-ns

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

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

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

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

Nicolai Stange <[email protected]>
crypto: drbg - make drbg_prepare_hrng() handle jent instantiation errors

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: Disable IPv6 on VETH1

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

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

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

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

Jaegeuk Kim <[email protected]>
f2fs: enforce single zone capacity

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

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

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

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

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

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

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

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

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

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

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

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

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

Tang Bin <[email protected]>
media: rcar_fdp1: Fix the correct variable assignments

Cai Huoqing <[email protected]>
media: rcar_fdp1: Make use of the helper function devm_platform_ioremap_resource()

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

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

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

Christian König <[email protected]>
drm/ttm: optimize pool allocations a bit v2

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: sc7180-trogdor-lazor: correct trackpad supply

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

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

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

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

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()

Rob Clark <[email protected]>
drm/msm/adreno: Defer enabling runpm until hw_init()

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()

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: ipq8064: Fix the PCI I/O port range

Christian Marangi <[email protected]>
ARM: dts: qcom: ipq8064: reduce pci IO size to 64K

Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq4019: 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

Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: ipq8074: 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

Dmitry Baryshkov <[email protected]>
arm64: dts: qcom: sdm845: correct dynamic power coefficients

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 NAND interrupt name

William Zhang <[email protected]>
arm64: dts: Move BCM4908 dts to bcmbca folder

Rafał Miłecki <[email protected]>
arm64: dts: Add base DTS file for bcmbca device Asus GT-AX6000

Anand Gore <[email protected]>
ARM64: dts: Add DTS files for bcmbca SoC BCM6858

William Zhang <[email protected]>
arm64: dts: Add DTS files for bcmbca SoC BCM4912

William Zhang <[email protected]>
arm64: dts: Add DTS files for bcmbca SoC BCM63158

Rafał Miłecki <[email protected]>
arm64: dts: broadcom: bcm4908: add DT for Netgear RAXE500

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

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

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

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

Terry Bowman <[email protected]>

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

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

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

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

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

Shaopeng Tan <[email protected]>
selftests/resctrl: Extend CPU vendor detection

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

Randy Dunlap <[email protected]>
sound/oss/dmasound: fix build when drivers are mixed =y/=m

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

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"

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

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

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()

Baokun Li <[email protected]>
writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs

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

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

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

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

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

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

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

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

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

Harshad Shirwadkar <[email protected]>
ext4: use ext4_journal_start/stop for fast commit transactions

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

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

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

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

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

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

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

Jiri Slaby (SUSE) <[email protected]>
wireguard: timers: cast enum limits members to int in prints

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 readq() and writeq()

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

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

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: sof_sdw: add quirk for Intel 'Rooks County' NUC M15

-------------

Diffstat:

 Makefile                                           |   4 +-
 arch/arm/boot/dts/omap3-gta04.dtsi                 |  16 +
 arch/arm/boot/dts/qcom-ipq4019.dtsi                |   4 +-
 arch/arm/boot/dts/qcom-ipq8064.dtsi                |  12 +-
 arch/arm64/boot/dts/broadcom/Makefile              |   2 +-
 arch/arm64/boot/dts/broadcom/bcm4908/Makefile      |   4 -
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile       |  10 +
 .../{bcm4908 => bcmbca}/bcm4906-netgear-r8000p.dts |   0
 .../bcm4906-tplink-archer-c2300-v1.dts             |   0
 .../dts/broadcom/{bcm4908 => bcmbca}/bcm4906.dtsi  |   0
 .../{bcm4908 => bcmbca}/bcm4908-asus-gt-ac5300.dts |   0
 .../broadcom/bcmbca/bcm4908-netgear-raxe500.dts    |  50 ++
 .../dts/broadcom/{bcm4908 => bcmbca}/bcm4908.dtsi  |   4 +-
 .../dts/broadcom/bcmbca/bcm4912-asus-gt-ax6000.dts |  19 +
 arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi   | 128 +++++
 arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi  | 128 +++++
 arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi   | 121 +++++
 arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts   |  30 ++
 arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts  |  30 ++
 arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts   |  30 ++
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |   6 +-
 arch/arm64/boot/dts/qcom/ipq8074.dtsi              |  12 +-
 .../boot/dts/qcom/msm8994-msft-lumia-octagon.dtsi  |   3 +-
 .../dts/qcom/msm8994-sony-xperia-kitakami.dtsi     |   3 +-
 arch/arm64/boot/dts/qcom/msm8996.dtsi              |  12 +-
 arch/arm64/boot/dts/qcom/msm8998.dtsi              |   4 +-
 .../qcom/sc7180-trogdor-lazor-limozeen-nots-r4.dts |   2 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi               |  30 +-
 arch/arm64/boot/dts/qcom/sm8250.dtsi               |   8 +-
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi          |   3 -
 arch/arm64/boot/dts/renesas/r8a77990.dtsi          |   3 -
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi          |   1 -
 arch/arm64/include/asm/debug-monitors.h            |   1 +
 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/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/real2.S                         |   5 +-
 arch/powerpc/kernel/rtas.c                         |   2 +-
 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/mm/init.c                               |   6 +-
 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                             |  15 +
 block/blk-core.c                                   |   7 +
 block/blk-crypto-internal.h                        |  25 +-
 block/blk-crypto.c                                 |  69 ++-
 block/blk-merge.c                                  |   2 +
 block/blk-mq.c                                     |   2 +-
 block/keyslot-manager.c                            |  43 +-
 crypto/algapi.c                                    |   4 +-
 crypto/drbg.c                                      |  16 +-
 drivers/acpi/processor_pdc.c                       |  11 +
 drivers/acpi/viot.c                                |   5 +-
 drivers/base/cpu.c                                 |   3 +-
 drivers/base/platform.c                            |   4 +-
 drivers/bluetooth/btsdio.c                         |   1 -
 drivers/char/ipmi/Kconfig                          |   3 +-
 drivers/char/ipmi/ipmi_ssif.c                      |   8 +-
 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/qcom/Makefile                          |   1 +
 drivers/clk/qcom/clk-regmap-phy-mux.c              |  62 +++
 drivers/clk/qcom/clk-regmap-phy-mux.h              |  33 ++
 drivers/clk/qcom/gcc-sm6115.c                      |  50 +-
 drivers/clk/qcom/gcc-sm8350.c                      |  47 +-
 drivers/clk/rockchip/clk-rk3399.c                  |   2 +-
 drivers/clocksource/timer-davinci.c                |  30 +-
 drivers/cpufreq/cpufreq.c                          |   2 +-
 drivers/crypto/Kconfig                             |   1 +
 drivers/crypto/caam/ctrl.c                         |   6 +-
 drivers/crypto/inside-secure/safexcel.c            |  37 +-
 drivers/dma/at_xdmac.c                             |  33 +-
 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/display/amdgpu_dm/amdgpu_dm.c  |   3 +-
 drivers/gpu/drm/amd/display/dc/dce60/Makefile      |   2 +-
 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/msm/adreno/a5xx_gpu.c              |   8 +-
 drivers/gpu/drm/msm/adreno/adreno_device.c         |   7 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.c            |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c        |   2 +-
 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                     | 161 ++++--
 drivers/gpu/drm/vgem/vgem_fence.c                  |   1 +
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c             |   9 +
 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/iio/adc/palmas_gpadc.c                     |   2 +-
 drivers/iio/light/max44009.c                       |  13 +-
 drivers/infiniband/core/cm.c                       |   3 +-
 drivers/infiniband/hw/hfi1/ipoib_tx.c              |   1 +
 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/sw/rdmavt/qp.c                  |   2 -
 drivers/infiniband/sw/siw/siw_main.c               |   3 -
 drivers/infiniband/sw/siw/siw_qp_tx.c              |   2 +-
 drivers/infiniband/ulp/srpt/ib_srpt.c              |  23 +-
 drivers/input/touchscreen/raspberrypi-ts.c         |   3 +-
 drivers/iommu/amd/amd_iommu_types.h                |   4 +-
 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/raid1-10.c                              |   6 -
 drivers/md/raid1.c                                 |   7 -
 drivers/md/raid10.c                                | 221 +++++---
 drivers/media/i2c/max9286.c                        |   1 +
 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/qcom/venus/vdec.c           |   8 +
 drivers/media/platform/rcar_fdp1.c                 |  28 +-
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c      |   2 +
 drivers/media/rc/gpio-ir-recv.c                    |   2 +
 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/ubi/eba.c                              |  19 +-
 drivers/net/ethernet/amd/nmclan_cs.c               |   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c   |  23 +-
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |   2 -
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     |  14 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  12 +-
 drivers/net/pcs/pcs-xpcs.c                         |  13 +-
 drivers/net/wireguard/timers.c                     |   8 +-
 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/mvm/d3.c        |   1 +
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |  10 +
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c    |   3 +-
 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_mcu.c   |  13 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c   |   5 +-
 drivers/net/wireless/mediatek/mt76/mt7921/dma.c    |  40 +-
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c    |   6 +
 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 +
 drivers/net/wireless/realtek/rtlwifi/debug.c       |  12 +-
 drivers/net/wireless/realtek/rtw88/mac.c           |   8 +-
 drivers/nvme/host/core.c                           |  34 +-
 drivers/nvme/host/trace.h                          |  15 +-
 drivers/nvme/target/admin-cmd.c                    |  51 +-
 drivers/nvme/target/configfs.c                     |   3 +-
 drivers/nvme/target/core.c                         |   5 +-
 drivers/nvme/target/fcloop.c                       |  48 +-
 drivers/nvme/target/io-cmd-file.c                  |  17 +-
 drivers/nvme/target/nvmet.h                        |   6 +-
 drivers/nvme/target/zns.c                          |  16 +-
 drivers/of/device.c                                |   7 +-
 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/phy/tegra/xusb.c                           |   2 +
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c           |  14 +-
 drivers/pinctrl/renesas/pfc-r8a779a0.c             |   8 -
 drivers/power/supply/generic-adc-battery.c         |   3 +
 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/rtc/rtc-meson-vrtc.c                       |   4 +-
 drivers/rtc/rtc-omap.c                             |   1 +
 drivers/s390/block/dasd.c                          |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                      |  10 +-
 drivers/scsi/megaraid.c                            |   1 +
 drivers/soc/ti/pm33xx.c                            |   5 +-
 drivers/soundwire/qcom.c                           |   2 +-
 drivers/spi/spi-bcm63xx.c                          |   2 -
 drivers/spi/spi-cadence-quadspi.c                  |  19 +-
 drivers/spi/spi-fsl-spi.c                          |  12 +-
 drivers/spi/spi-imx.c                              |  14 +-
 drivers/spi/spi-qup.c                              |  22 +-
 drivers/spmi/spmi.c                                |   3 +-
 drivers/staging/iio/resolver/ad2s1210.c            |   2 +-
 drivers/staging/media/av7110/av7110_av.c           |   4 +-
 drivers/staging/media/rkvdec/rkvdec.c              |   2 +
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |   1 +
 drivers/staging/rtl8723bs/core/rtw_mlme.c          |   8 +-
 drivers/target/iscsi/iscsi_target.c                |  16 +-
 drivers/target/target_core_device.c                |   1 +
 drivers/target/target_core_tmr.c                   |  26 +-
 drivers/thermal/mtk_thermal.c                      |  14 +-
 drivers/tty/serial/8250/8250_bcm7271.c             |  18 +-
 drivers/tty/serial/8250/8250_port.c                |   4 +
 drivers/tty/serial/fsl_lpuart.c                    |   2 +-
 drivers/tty/serial/stm32-usart.c                   |  26 +-
 drivers/tty/sysrq.c                                |   2 +-
 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                          |  11 +-
 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/virtio/virtio_ring.c                       |  22 +-
 drivers/xen/pcpu.c                                 |  20 +
 fs/afs/inode.c                                     |   1 +
 fs/btrfs/ioctl.c                                   |   5 +
 fs/cifs/file.c                                     |  16 +
 fs/cifs/misc.c                                     |   8 +-
 fs/erofs/internal.h                                |   2 +-
 fs/erofs/zmap.c                                    |   4 +
 fs/ext4/acl.c                                      |   2 -
 fs/ext4/extents.c                                  |   6 +-
 fs/ext4/file.c                                     |   4 -
 fs/ext4/inode.c                                    |  10 +-
 fs/ext4/ioctl.c                                    |  10 +-
 fs/f2fs/compress.c                                 |   6 +
 fs/f2fs/data.c                                     |   5 +-
 fs/f2fs/f2fs.h                                     |   2 +-
 fs/f2fs/file.c                                     |  15 +-
 fs/f2fs/segment.c                                  |  76 +--
 fs/f2fs/segment.h                                  |   6 +
 fs/f2fs/super.c                                    |  33 +-
 fs/fs-writeback.c                                  |  17 +-
 fs/jbd2/journal.c                                  |   2 +
 fs/jbd2/transaction.c                              |   3 +
 fs/ksmbd/server.c                                  |   1 +
 fs/ksmbd/smb2pdu.c                                 |   7 +
 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                                     |   1 +
 fs/ubifs/tnc.c                                     | 142 +++--
 fs/xfs/libxfs/xfs_sb.c                             |  11 +-
 include/asm-generic/io.h                           |   4 +-
 include/linux/blk-crypto.h                         |   4 +-
 include/linux/mailbox/zynqmp-ipi-message.h         |   2 +-
 include/linux/mlx5/mlx5_ifc.h                      |   3 +-
 include/linux/netfilter/nfnetlink.h                |   1 -
 include/linux/nvme.h                               |   4 +
 include/linux/platform_device.h                    |  11 +
 include/linux/posix-timers.h                       |  17 +-
 include/linux/sched.h                              |   6 +-
 include/linux/sunrpc/sched.h                       |   3 +-
 include/linux/tick.h                               |   2 +
 include/linux/vt_buffer.h                          |   2 +-
 include/linux/workqueue.h                          |   3 +-
 include/net/scm.h                                  |  13 +-
 include/net/xsk_buff_pool.h                        |   9 +-
 include/target/target_core_base.h                  |   1 +
 include/trace/events/qrtr.h                        |  33 +-
 include/trace/events/timer.h                       |   3 +-
 include/uapi/linux/btrfs.h                         |   1 +
 include/uapi/linux/const.h                         |   2 +-
 include/xen/xen.h                                  |  11 +
 kernel/bpf/cgroup.c                                |   9 +-
 kernel/bpf/verifier.c                              |  26 +-
 kernel/events/core.c                               |   4 +-
 kernel/kheaders.c                                  |  10 +-
 kernel/power/process.c                             |   2 +-
 kernel/rcu/tree.c                                  |   1 +
 kernel/relay.c                                     |   3 +-
 kernel/sched/core.c                                |  25 +-
 kernel/sched/deadline.c                            |   5 +-
 kernel/sched/debug.c                               |  92 ++--
 kernel/sched/fair.c                                |  93 ++--
 kernel/sched/rt.c                                  |   8 +-
 kernel/sched/stats.h                               |  19 +
 kernel/sched/stop_task.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                         |   4 +
 kernel/trace/trace.c                               |   2 +-
 kernel/workqueue.c                                 | 176 +++---
 lib/debugobjects.c                                 | 146 ++---
 mm/backing-dev.c                                   |  12 +-
 net/8021q/vlan_dev.c                               |   2 +-
 net/core/skbuff.c                                  |   3 +
 net/ipv4/ip_output.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/sched/sch_fq.c                                 |   6 +-
 net/sunrpc/clnt.c                                  |   3 -
 net/sunrpc/sched.c                                 |   1 -
 net/xdp/xsk_queue.h                                |   1 +
 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/oss/dmasound/dmasound.h                      |   6 -
 sound/oss/dmasound/dmasound_core.c                 |  26 +-
 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/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/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 +-
 .../selftests/bpf/prog_tests/cg_storage_multi.c    |   8 +-
 .../bpf/prog_tests/get_stackid_cannot_attach.c     |   1 +
 tools/testing/selftests/bpf/test_xsk.sh            |   1 +
 .../selftests/mount_setattr/mount_setattr_test.c   |   1 +
 tools/testing/selftests/resctrl/cache.c            |   4 +-
 tools/testing/selftests/resctrl/cat_test.c         |   4 +-
 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          |   7 +-
 tools/testing/selftests/resctrl/resctrl_tests.c    |  41 +-
 tools/testing/selftests/resctrl/resctrl_val.c      |  21 +-
 tools/testing/selftests/resctrl/resctrlfs.c        |   2 +-
 395 files changed, 3860 insertions(+), 2108 deletions(-)
author maintainer
#31 lore raw

PATCH 31/371 ipmi: fix SSIF not responding under certain cond.

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
#40 lore raw

PATCH 40/371 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
@@ -1631,19 +1631,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;
@@ -1657,7 +1661,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;
@@ -1669,8 +1674,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;
@@ -1687,16 +1694,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
#41 lore raw

PATCH 41/371 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
@@ -975,6 +975,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
#42 lore raw

PATCH 42/371 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
#43 lore raw

PATCH 43/371 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
@@ -7493,6 +7493,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
#44 lore raw

PATCH 44/371 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
@@ -992,7 +992,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
#45 lore raw

PATCH 45/371 writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs

In reply to Greg Kroah-Hartman

From: Baokun Li <[email protected]>

[ Upstream commit 1ba1199ec5747f475538c0d25a32804e5ba1dfde ]

KASAN report null-ptr-deref:
==================================================================

BUG: KASAN: null-ptr-deref in bdi_split_work_to_wbs+0x5c5/0x7b0
Write of size 8 at addr 0000000000000000 by task sync/943
CPU: 5 PID: 943 Comm: sync Tainted: 6.3.0-rc5-next-20230406-dirty #461
Call Trace:
 <TASK>
 dump_stack_lvl+0x7f/0xc0
 print_report+0x2ba/0x340
 kasan_report+0xc4/0x120
 kasan_check_range+0x1b7/0x2e0
 __kasan_check_write+0x24/0x40
 bdi_split_work_to_wbs+0x5c5/0x7b0
 sync_inodes_sb+0x195/0x630
 sync_inodes_one_sb+0x3a/0x50
 iterate_supers+0x106/0x1b0
 ksys_sync+0x98/0x160

[...]
==================================================================

The race that causes the above issue is as follows:

cpu1 cpu2
-------------------------|------------------------- inode_switch_wbs
INIT_WORK(&isw->work, inode_switch_wbs_work_fn) queue_rcu_work(isw_wq, &isw->work)
// queue_work async
inode_switch_wbs_work_fn
wb_put_many(old_wb, nr_switched)

    percpu_ref_put_many
     ref->data->release(ref)
     cgwb_release
      queue_work(cgwb_release_wq, &wb->release_work)
      // queue_work async
       &wb->release_work
       cgwb_release_workfn
                            ksys_sync
                             iterate_supers
                              sync_inodes_one_sb
                               sync_inodes_sb
                                bdi_split_work_to_wbs
                                 kmalloc(sizeof(*work), GFP_ATOMIC)
                                 // alloc memory failed
        percpu_ref_exit
         ref->data = NULL
         kfree(data)
                                 wb_get(wb)
                                  percpu_ref_get(&wb->refcnt)
                                   percpu_ref_get_many(ref, 1)
                                    atomic_long_add(nr, &ref->data->count)
                                     atomic64_add(i, v)
                                     // trigger null-ptr-deref

bdi_split_work_to_wbs() traverses &bdi->wb_list to split work into all wbs. If the allocation of new work fails, the on-stack fallback will be used and the reference count of the current wb is increased afterwards. If cgroup writeback membership switches occur before getting the reference count and the current wb is released as old_wd, then calling wb_get() or wb_put() will trigger the null pointer dereference above.

This issue was introduced in v4.3-rc7 (see fix tag1). Both sync_inodes_sb() and __writeback_inodes_sb_nr() calls to bdi_split_work_to_wbs() can trigger this issue. For scenarios called via sync_inodes_sb(), originally commit 7fc5854f8c6e ("writeback: synchronize sync(2) against cgroup writeback membership switches") reduced the possibility of the issue by adding wb_switch_rwsem, but in v5.14-rc1 (see fix tag2) removed the "inode_io_list_del_locked(inode, old_wb)" from inode_switch_wbs_work_fn() so that wb->state contains WB_has_dirty_io, thus old_wb is not skipped when traversing wbs in bdi_split_work_to_wbs(), and the issue becomes easily reproducible again.

To solve this problem, percpu_ref_exit() is called under RCU protection to avoid race between cgwb_release_workfn() and bdi_split_work_to_wbs(). Moreover, replace wb_get() with wb_tryget() in bdi_split_work_to_wbs(), and skip the current wb if wb_tryget() fails because the wb has already been shutdown.

Fixes b817525a4a80 ("writeback: bdi_writeback iteration must not skip dying ones")
Cc Alexander Viro <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Dennis Zhou <[email protected]>
Cc Hou Tao <[email protected]>
Cc yangerkun <[email protected]>
Cc Zhang Yi <[email protected]>
Cc Jens Axboe <[email protected]>
---
 fs/fs-writeback.c |   17 ++++++++++-------
 mm/backing-dev.c  |   12 ++++++++++--
 2 files changed, 20 insertions(+), 9 deletions(-)
fs/fs-writeback.c +10 -7
@@ -1009,6 +1009,16 @@ restart:
 			continue;
 		}
 
+		/*
+		 * If wb_tryget fails, the wb has been shutdown, skip it.
+		 *
+		 * Pin @wb so that it stays on @bdi->wb_list.  This allows
+		 * continuing iteration from @wb after dropping and
+		 * regrabbing rcu read lock.
+		 */
+		if (!wb_tryget(wb))
+			continue;
+
 		/* alloc failed, execute synchronously using on-stack fallback */
 		work = &fallback_work;
 		*work = *base_work;
@@ -1017,13 +1027,6 @@ restart:
 		work->done = &fallback_work_done;
 
 		wb_queue_work(wb, work);
-
-		/*
-		 * Pin @wb so that it stays on @bdi->wb_list.  This allows
-		 * continuing iteration from @wb after dropping and
-		 * regrabbing rcu read lock.
-		 */
-		wb_get(wb);
 		last_wb = wb;
 
 		rcu_read_unlock();
mm/backing-dev.c +10 -2
@@ -385,6 +385,15 @@ static LIST_HEAD(offline_cgwbs);
 static void cleanup_offline_cgwbs_workfn(struct work_struct *work);
 static DECLARE_WORK(cleanup_offline_cgwbs_work, cleanup_offline_cgwbs_workfn);
 
+static void cgwb_free_rcu(struct rcu_head *rcu_head)
+{
+	struct bdi_writeback *wb = container_of(rcu_head,
+			struct bdi_writeback, rcu);
+
+	percpu_ref_exit(&wb->refcnt);
+	kfree(wb);
+}
+
 static void cgwb_release_workfn(struct work_struct *work)
 {
 	struct bdi_writeback *wb = container_of(work, struct bdi_writeback,
@@ -407,10 +416,9 @@ static void cgwb_release_workfn(struct w
 	list_del(&wb->offline_node);
 	spin_unlock_irq(&cgwb_lock);
 
-	percpu_ref_exit(&wb->refcnt);
 	wb_exit(wb);
 	WARN_ON_ONCE(!list_empty(&wb->b_attached));
-	kfree_rcu(wb, rcu);
+	call_rcu(&wb->rcu, cgwb_free_rcu);
 }
 
 static void cgwb_release(struct percpu_ref *refcnt)
author maintainer
#46 lore raw

PATCH 46/371 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
@@ -611,6 +611,7 @@ err_unregister:
 static void __exit ksmbd_server_exit(void)
 {
 	ksmbd_server_shutdown();
+	rcu_barrier();
 	ksmbd_release_inode_hash();
 }
 
author maintainer
#47 lore raw

PATCH 47/371 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
@@ -4879,6 +4879,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
#48 lore raw

PATCH 48/371 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
@@ -1786,6 +1786,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
#49 lore raw

PATCH 49/371 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
#32 lore raw

PATCH 32/371 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
#50 lore raw

PATCH 50/371 riscv: mm: remove redundant parameter of create_fdt_early_page_table

In reply to Greg Kroah-Hartman

From: Song Shuai <[email protected]>

commit e4ef93edd4e0b022529303db1915766ff9de450e upstream.

create_fdt_early_page_table() explicitly uses early_pg_dir for 32-bit fdt mapping and the pgdir parameter is redundant here. So remove it and its caller.

---
 arch/riscv/mm/init.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/riscv/mm/init.c +2 -4
@@ -569,8 +569,7 @@ static void __init create_kernel_page_ta
  * this means 2 PMD entries whereas for 32-bit kernel, this is only 1 PGDIR
  * entry.
  */
-static void __init create_fdt_early_page_table(pgd_t *pgdir,
-					       uintptr_t fix_fdt_va,
+static void __init create_fdt_early_page_table(uintptr_t fix_fdt_va,
 					       uintptr_t dtb_pa)
 {
 	uintptr_t pa = dtb_pa & ~(PMD_SIZE - 1);
@@ -678,8 +677,7 @@ asmlinkage void __init setup_vm(uintptr_
 	create_kernel_page_table(early_pg_dir, true);
 
 	/* Setup early mapping for FDT early scan */
-	create_fdt_early_page_table(early_pg_dir,
-				    __fix_to_virt(FIX_FDT), dtb_pa);
+	create_fdt_early_page_table(__fix_to_virt(FIX_FDT), dtb_pa);
 
 	/*
 	 * Bootime fixmap only can handle PMD_SIZE mapping. Thus, boot-ioremap
author maintainer
#51 lore raw

PATCH 51/371 tracing: Fix permissions for the buffer_percent file

In reply to Greg Kroah-Hartman

From: Ondrej Mosnacek <[email protected]>

commit 4f94559f40ad06d627c0fdfc3319cec778a2845b upstream.

This file defines both read and write operations, yet it is being created as read-only. This means that it can't be written to without the CAP_DAC_OVERRIDE capability. Fix the permissions to allow root to write to it without the need to override DAC perms.

Cc Masami Hiramatsu <[email protected]>
Fixes 03329f993978 ("tracing: Add tracefs file buffer_percentage")
---
 kernel/trace/trace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
@@ -9565,7 +9565,7 @@ init_tracer_tracefs(struct trace_array *
 
 	tr->buffer_percent = 50;
 
-	trace_create_file("buffer_percent", TRACE_MODE_READ, d_tracer,
+	trace_create_file("buffer_percent", TRACE_MODE_WRITE, d_tracer,
 			tr, &buffer_percent_fops);
 
 	create_trace_options_dir(tr);
author maintainer
#52 lore raw

PATCH 52/371 iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE

In reply to Greg Kroah-Hartman

From: Kishon Vijay Abraham I <[email protected]>

commit ccc62b827775915a9b82db42a29813d04f92df7a upstream.

commit b9c6ff94e43a ("iommu/amd: Re-factor guest virtual APIC (de-)activation code") while refactoring guest virtual APIC activation/de-activation code, stored information for activate/de-activate in "struct amd_ir_data". It used 32-bit integer data type for storing the "Guest Virtual APIC Table Root Pointer" (ga_root_ptr), though the "ga_root_ptr" is actually a 40-bit field in IRTE (Interrupt Remapping Table Entry).

This causes interrupts from PCIe devices to not reach the guest in the case of PCIe passthrough with SME (Secure Memory Encryption) enabled as _SME_ bit in the "ga_root_ptr" is lost before writing it to the IRTE.

Fix it by using 64-bit data type for storing the "ga_root_ptr". While at that also change the data type of "ga_tag" to u32 in order to match the IOMMU spec.

---
 drivers/iommu/amd/amd_iommu_types.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +2 -2
@@ -918,8 +918,8 @@ struct amd_ir_data {
 	 */
 	struct irq_cfg *cfg;
 	int ga_vector;
-	int ga_root_ptr;
-	int ga_tag;
+	u64 ga_root_ptr;
+	u32 ga_tag;
 };
 
 struct amd_irte_ops {
author maintainer
#53 lore raw

PATCH 53/371 Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"

In reply to Greg Kroah-Hartman

From: Zhihao Cheng <[email protected]>

commit 7d01cb27f6aebc54efbe28d8961a973b8f795b13 upstream.

This reverts commit 122deabfe1428 (ubifs: dirty_cow_znode: Fix memleak in error handling path).
After commit 122deabfe1428 applied, if insert_old_idx() failed, old index neither exists in TNC nor in old-index tree. Which means that old index node could be overwritten in layout_leb_in_gaps(), then ubifs image will be corrupted in power-cut.

Fixes 122deabfe1428 (ubifs: dirty_cow_znode: Fix memleak ... path)
---
 fs/ubifs/tnc.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
fs/ubifs/tnc.c +1 -8
@@ -267,18 +267,11 @@ static struct ubifs_znode *dirty_cow_zno
 	if (zbr->len) {
 		err = insert_old_idx(c, zbr->lnum, zbr->offs);
 		if (unlikely(err))
-			/*
-			 * Obsolete znodes will be freed by tnc_destroy_cnext()
-			 * or free_obsolete_znodes(), copied up znodes should
-			 * be added back to tnc and freed by
-			 * ubifs_destroy_tnc_subtree().
-			 */
-			goto out;
+			return ERR_PTR(err);
 		err = add_idx_dirt(c, zbr->lnum, zbr->len);
 	} else
 		err = 0;
 
-out:
 	zbr->znode = zn;
 	zbr->lnum = 0;
 	zbr->offs = 0;
author maintainer
#54 lore raw

PATCH 54/371 ubifs: Fix memleak when insert_old_idx() failed

In reply to Greg Kroah-Hartman

From: Zhihao Cheng <[email protected]>

commit b5fda08ef213352ac2df7447611eb4d383cce929 upstream.

Following process will cause a memleak for copied up znode:

dirty_cow_znode
zn = copy_znode(c, znode);
err = insert_old_idx(c, zbr->lnum, zbr->offs);
if (unlikely(err))
return ERR_PTR(err); // No one refers to zn.

Fetch a reproducer in [Link].

Function copy_znode() is split into 2 parts: resource allocation and znode replacement, insert_old_idx() is split in similar way, so resource cleanup could be done in error handling path without corrupting metadata(mem & disk).
It's okay that old index inserting is put behind of add_idx_dirt(), old index is used in layout_leb_in_gaps(), so the two processes do not depend on each other.

---
 fs/ubifs/tnc.c |  137 ++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 87 insertions(+), 50 deletions(-)
fs/ubifs/tnc.c +87 -50
@@ -44,6 +44,33 @@ enum {
 	NOT_ON_MEDIA = 3,
 };
 
+static void do_insert_old_idx(struct ubifs_info *c,
+			      struct ubifs_old_idx *old_idx)
+{
+	struct ubifs_old_idx *o;
+	struct rb_node **p, *parent = NULL;
+
+	p = &c->old_idx.rb_node;
+	while (*p) {
+		parent = *p;
+		o = rb_entry(parent, struct ubifs_old_idx, rb);
+		if (old_idx->lnum < o->lnum)
+			p = &(*p)->rb_left;
+		else if (old_idx->lnum > o->lnum)
+			p = &(*p)->rb_right;
+		else if (old_idx->offs < o->offs)
+			p = &(*p)->rb_left;
+		else if (old_idx->offs > o->offs)
+			p = &(*p)->rb_right;
+		else {
+			ubifs_err(c, "old idx added twice!");
+			kfree(old_idx);
+		}
+	}
+	rb_link_node(&old_idx->rb, parent, p);
+	rb_insert_color(&old_idx->rb, &c->old_idx);
+}
+
 /**
  * insert_old_idx - record an index node obsoleted since the last commit start.
  * @c: UBIFS file-system description object
@@ -69,35 +96,15 @@ enum {
  */
 static int insert_old_idx(struct ubifs_info *c, int lnum, int offs)
 {
-	struct ubifs_old_idx *old_idx, *o;
-	struct rb_node **p, *parent = NULL;
+	struct ubifs_old_idx *old_idx;
 
 	old_idx = kmalloc(sizeof(struct ubifs_old_idx), GFP_NOFS);
 	if (unlikely(!old_idx))
 		return -ENOMEM;
 	old_idx->lnum = lnum;
 	old_idx->offs = offs;
+	do_insert_old_idx(c, old_idx);
 
-	p = &c->old_idx.rb_node;
-	while (*p) {
-		parent = *p;
-		o = rb_entry(parent, struct ubifs_old_idx, rb);
-		if (lnum < o->lnum)
-			p = &(*p)->rb_left;
-		else if (lnum > o->lnum)
-			p = &(*p)->rb_right;
-		else if (offs < o->offs)
-			p = &(*p)->rb_left;
-		else if (offs > o->offs)
-			p = &(*p)->rb_right;
-		else {
-			ubifs_err(c, "old idx added twice!");
-			kfree(old_idx);
-			return 0;
-		}
-	}
-	rb_link_node(&old_idx->rb, parent, p);
-	rb_insert_color(&old_idx->rb, &c->old_idx);
 	return 0;
 }
 
@@ -199,23 +206,6 @@ static struct ubifs_znode *copy_znode(st
 	__set_bit(DIRTY_ZNODE, &zn->flags);
 	__clear_bit(COW_ZNODE, &zn->flags);
 
-	ubifs_assert(c, !ubifs_zn_obsolete(znode));
-	__set_bit(OBSOLETE_ZNODE, &znode->flags);
-
-	if (znode->level != 0) {
-		int i;
-		const int n = zn->child_cnt;
-
-		/* The children now have new parent */
-		for (i = 0; i < n; i++) {
-			struct ubifs_zbranch *zbr = &zn->zbranch[i];
-
-			if (zbr->znode)
-				zbr->znode->parent = zn;
-		}
-	}
-
-	atomic_long_inc(&c->dirty_zn_cnt);
 	return zn;
 }
 
@@ -234,6 +224,42 @@ static int add_idx_dirt(struct ubifs_inf
 }
 
 /**
+ * replace_znode - replace old znode with new znode.
+ * @c: UBIFS file-system description object
+ * @new_zn: new znode
+ * @old_zn: old znode
+ * @zbr: the branch of parent znode
+ *
+ * Replace old znode with new znode in TNC.
+ */
+static void replace_znode(struct ubifs_info *c, struct ubifs_znode *new_zn,
+			  struct ubifs_znode *old_zn, struct ubifs_zbranch *zbr)
+{
+	ubifs_assert(c, !ubifs_zn_obsolete(old_zn));
+	__set_bit(OBSOLETE_ZNODE, &old_zn->flags);
+
+	if (old_zn->level != 0) {
+		int i;
+		const int n = new_zn->child_cnt;
+
+		/* The children now have new parent */
+		for (i = 0; i < n; i++) {
+			struct ubifs_zbranch *child = &new_zn->zbranch[i];
+
+			if (child->znode)
+				child->znode->parent = new_zn;
+		}
+	}
+
+	zbr->znode = new_zn;
+	zbr->lnum = 0;
+	zbr->offs = 0;
+	zbr->len = 0;
+
+	atomic_long_inc(&c->dirty_zn_cnt);
+}
+
+/**
  * dirty_cow_znode - ensure a znode is not being committed.
  * @c: UBIFS file-system description object
  * @zbr: branch of znode to check
@@ -265,21 +291,32 @@ static struct ubifs_znode *dirty_cow_zno
 		return zn;
 
 	if (zbr->len) {
-		err = insert_old_idx(c, zbr->lnum, zbr->offs);
-		if (unlikely(err))
-			return ERR_PTR(err);
+		struct ubifs_old_idx *old_idx;
+
+		old_idx = kmalloc(sizeof(struct ubifs_old_idx), GFP_NOFS);
+		if (unlikely(!old_idx)) {
+			err = -ENOMEM;
+			goto out;
+		}
+		old_idx->lnum = zbr->lnum;
+		old_idx->offs = zbr->offs;
+
 		err = add_idx_dirt(c, zbr->lnum, zbr->len);
-	} else
-		err = 0;
+		if (err) {
+			kfree(old_idx);
+			goto out;
+		}
 
-	zbr->znode = zn;
-	zbr->lnum = 0;
-	zbr->offs = 0;
-	zbr->len = 0;
+		do_insert_old_idx(c, old_idx);
+	}
+
+	replace_znode(c, zn, znode, zbr);
 
-	if (unlikely(err))
-		return ERR_PTR(err);
 	return zn;
+
+out:
+	kfree(zn);
+	return ERR_PTR(err);
 }
 
 /**
author maintainer
#55 lore raw

PATCH 55/371 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
#56 lore raw

PATCH 56/371 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
@@ -488,6 +488,7 @@ static int ubifs_tmpfile(struct user_nam
 	unlock_2_inodes(dir, inode);
 
 	ubifs_release_budget(c, &req);
+	fscrypt_free_filename(&nm);
 
 	return 0;
 
author maintainer
#57 lore raw

PATCH 57/371 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
#58 lore raw

PATCH 58/371 sound/oss/dmasound: fix build when drivers are mixed =y/=m

In reply to Greg Kroah-Hartman

From: Randy Dunlap <[email protected]>

commit 9dd7c46346ca4390f84a7ea9933005eb1b175c15 upstream.

When CONFIG_DMASOUND_ATARI=m and CONFIG_DMASOUND_Q40=y (or vice versa), dmasound_core.o can be built without dmasound_deinit() being defined, causing a build error:

ERROR: modpost: "dmasound_deinit" [sound/oss/dmasound/dmasound_atari.ko] undefined!

Modify dmasound_core.c and dmasound.h so that dmasound_deinit() is always available.

The mixed modes (=y/=m) also mean that several variables and structs have to be declared in all cases.

---
 sound/oss/dmasound/dmasound.h      |    6 ------
 sound/oss/dmasound/dmasound_core.c |   24 +-----------------------
 2 files changed, 1 insertion(+), 29 deletions(-)
sound/oss/dmasound/dmasound.h +0 -6
@@ -88,11 +88,7 @@ static inline int ioctl_return(int __use
      */
 
 extern int dmasound_init(void);
-#ifdef MODULE
 extern void dmasound_deinit(void);
-#else
-#define dmasound_deinit()	do { } while (0)
-#endif
 
 /* description of the set-up applies to either hard or soft settings */
 
@@ -114,9 +110,7 @@ typedef struct {
     void *(*dma_alloc)(unsigned int, gfp_t);
     void (*dma_free)(void *, unsigned int);
     int (*irqinit)(void);
-#ifdef MODULE
     void (*irqcleanup)(void);
-#endif
     void (*init)(void);
     void (*silence)(void);
     int (*setFormat)(int);
sound/oss/dmasound/dmasound_core.c +1 -23
@@ -206,12 +206,10 @@ module_param(writeBufSize, int, 0);
 
 MODULE_LICENSE("GPL");
 
-#ifdef MODULE
 static int sq_unit = -1;
 static int mixer_unit = -1;
 static int state_unit = -1;
 static int irq_installed;
-#endif /* MODULE */
 
 /* control over who can modify resources shared between play/record */
 static fmode_t shared_resource_owner;
@@ -391,9 +389,6 @@ static const struct file_operations mixe
 
 static void mixer_init(void)
 {
-#ifndef MODULE
-	int mixer_unit;
-#endif
 	mixer_unit = register_sound_mixer(&mixer_fops, -1);
 	if (mixer_unit < 0)
 		return;
@@ -1171,9 +1166,6 @@ static const struct file_operations sq_f
 static int sq_init(void)
 {
 	const struct file_operations *fops = &sq_fops;
-#ifndef MODULE
-	int sq_unit;
-#endif
 
 	sq_unit = register_sound_dsp(fops, -1);
 	if (sq_unit < 0) {
@@ -1366,9 +1358,6 @@ static const struct file_operations stat
 
 static int state_init(void)
 {
-#ifndef MODULE
-	int state_unit;
-#endif
 	state_unit = register_sound_special(&state_fops, SND_DEV_STATUS);
 	if (state_unit < 0)
 		return state_unit ;
@@ -1386,10 +1375,9 @@ static int state_init(void)
 int dmasound_init(void)
 {
 	int res ;
-#ifdef MODULE
+
 	if (irq_installed)
 		return -EBUSY;
-#endif
 
 	/* Set up sound queue, /dev/audio and /dev/dsp. */
 
@@ -1408,9 +1396,7 @@ int dmasound_init(void)
 		printk(KERN_ERR "DMA sound driver: Interrupt initialization failed\n");
 		return -ENODEV;
 	}
-#ifdef MODULE
 	irq_installed = 1;
-#endif
 
 	printk(KERN_INFO "%s DMA sound driver rev %03d installed\n",
 		dmasound.mach.name, (DMASOUND_CORE_REVISION<<4) +
@@ -1424,8 +1410,6 @@ int dmasound_init(void)
 	return 0;
 }
 
-#ifdef MODULE
-
 void dmasound_deinit(void)
 {
 	if (irq_installed) {
@@ -1444,8 +1428,6 @@ void dmasound_deinit(void)
 		unregister_sound_dsp(sq_unit);
 }
 
-#else /* !MODULE */
-
 static int dmasound_setup(char *str)
 {
 	int ints[6], size;
@@ -1489,8 +1471,6 @@ static int dmasound_setup(char *str)
 
 __setup("dmasound=", dmasound_setup);
 
-#endif /* !MODULE */
-
     /*
      *  Conversion tables
      */
@@ -1577,9 +1557,7 @@ char dmasound_alaw2dma8[] = {
 
 EXPORT_SYMBOL(dmasound);
 EXPORT_SYMBOL(dmasound_init);
-#ifdef MODULE
 EXPORT_SYMBOL(dmasound_deinit);
-#endif
 EXPORT_SYMBOL(dmasound_write_sq);
 EXPORT_SYMBOL(dmasound_catchRadius);
 #ifdef HAS_8BIT_TABLES
author maintainer
#59 lore raw

PATCH 59/371 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 6ad031c71be74..1cf012de6442e 100644
@@ -368,7 +368,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 63e3e8ebcd643..e014927c82e76 100644
@@ -264,6 +264,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
#33 lore raw

PATCH 33/371 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
@@ -434,7 +434,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
@@ -1284,8 +1284,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
@@ -1496,8 +1496,11 @@ static void mt7615_mac_add_txs(struct mt
 	if (wcid->ext_phy && dev->mt76.phy2)
 		mphy = dev->mt76.phy2;
 
-	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
@@ -68,7 +68,9 @@ mt76_tx_status_unlock(struct mt76_dev *d
 			status.sta = wcid_to_sta(wcid);
 
 		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();
 }
@@ -229,7 +231,9 @@ void __mt76_tx_complete_skb(struct mt76_
 	if (!skb->prev) {
 		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
#60 lore raw

PATCH 60/371 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
#61 lore raw

PATCH 61/371 selftests/resctrl: Extend CPU vendor detection

In reply to Greg Kroah-Hartman

From: Shaopeng Tan <[email protected]>

[ Upstream commit 6220f69e72a534838cffd84dce6afd777777be03 ]

Currently, the resctrl_tests only has a function to detect AMD vendor. Since when the Intel Sub-NUMA Clustering feature is enabled, Intel CMT and MBM counters may not be accurate,
the resctrl_tests also need a function to detect Intel vendor. And in the future, resctrl_tests will need a function to detect different vendors, such as Arm.

Extend the function to detect Intel vendor as well. Also, this function can be easily extended to detect other vendors.

Stable-dep-of: fa10366cc6f4 ("selftests/resctrl: Allow ->setup() to return errors")

---
 tools/testing/selftests/resctrl/cat_test.c    |  2 +-
 tools/testing/selftests/resctrl/resctrl.h     |  5 ++-
 .../testing/selftests/resctrl/resctrl_tests.c | 41 ++++++++++++-------
 tools/testing/selftests/resctrl/resctrlfs.c   |  2 +-
 4 files changed, 33 insertions(+), 17 deletions(-)
tools/testing/selftests/resctrl/cat_test.c +1 -1
index cd4f68388e0f6..1c5e90c632548 100644
@@ -89,7 +89,7 @@ static int check_results(struct resctrl_val_param *param)
 
 	return show_cache_info(sum_llc_perf_miss, no_of_bits, param->span / 64,
 			       MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS,
-			       !is_amd, false);
+			       get_vendor() == ARCH_INTEL, false);
 }
 
 void cat_test_cleanup(void)
tools/testing/selftests/resctrl/resctrl.h +4 -1
index 1ad10c47e31d1..f0ded31fb3c7c 100644
@@ -34,6 +34,9 @@
 #define L3_MON_PATH		"/sys/fs/resctrl/info/L3_MON"
 #define L3_MON_FEATURES_PATH	"/sys/fs/resctrl/info/L3_MON/mon_features"
 
+#define ARCH_INTEL     1
+#define ARCH_AMD       2
+
 #define PARENT_EXIT(err_msg)			\
 	do {					\
 		perror(err_msg);		\
@@ -75,8 +78,8 @@ struct resctrl_val_param {
 extern pid_t bm_pid, ppid;
 
 extern char llc_occup_path[1024];
-extern bool is_amd;
 
+int get_vendor(void);
 bool check_resctrlfs_support(void);
 int filter_dmesg(void);
 int remount_resctrlfs(bool mum_resctrlfs);
tools/testing/selftests/resctrl/resctrl_tests.c +27 -14

71 lines not on this page · raw message

tools/testing/selftests/resctrl/resctrlfs.c +1 -1
index 5f5a166ade60a..6f543e470ad4a 100644
@@ -106,7 +106,7 @@ int get_resource_id(int cpu_no, int *resource_id)
 	char phys_pkg_path[1024];
 	FILE *fp;
 
-	if (is_amd)
+	if (get_vendor() == ARCH_AMD)
 		sprintf(phys_pkg_path, "%s%d/cache/index3/id",
 			PHYS_ID_PATH, cpu_no);
 	else
Signature · 1 line
2.39.2
author maintainer
#34 lore raw

PATCH 34/371 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
@@ -424,7 +424,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
#35 lore raw

PATCH 35/371 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
@@ -433,7 +433,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 = {
@@ -442,7 +442,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
#36 lore raw

PATCH 36/371 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
@@ -640,7 +640,7 @@ static int qcom_swrm_init(struct qcom_sw
 
 	ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
 	/* 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
#37 lore raw

PATCH 37/371 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
@@ -452,6 +452,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);
@@ -461,11 +470,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
#38 lore raw

PATCH 38/371 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
@@ -1742,6 +1742,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) {
@@ -1848,6 +1850,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
#39 lore raw

PATCH 39/371 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
@@ -456,7 +456,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
#30 lore raw

PATCH 30/371 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
#63 lore raw

PATCH 63/371 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 dd907809d0b29..02110e7ee6361 100644
@@ -734,10 +734,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
author maintainer
#81 lore raw

PATCH 72/371 tpm, tpm_tis: Claim locality when interrupts are reenabled on resume

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit 955df4f87760b3bb2af253d3fbb12fb712b3ffa6 ]

In tpm_tis_resume() make sure that the locality has been claimed when tpm_tis_reenable_interrupts() is called. Otherwise the writings to the register might not have any effect.

Fixes 45baa1d1fa39 ("tpm_tis: Re-enable interrupts upon (S3) resume")
---
 drivers/char/tpm/tpm_tis_core.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/char/tpm/tpm_tis_core.c +9 -10
index 3ea0fff30273e..d65fff4e2ebe9 100644
@@ -1173,28 +1173,27 @@ int tpm_tis_resume(struct device *dev)
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 	int ret;
 
+	ret = tpm_tis_request_locality(chip, 0);
+	if (ret < 0)
+		return ret;
+
 	if (chip->flags & TPM_CHIP_FLAG_IRQ)
 		tpm_tis_reenable_interrupts(chip);
 
 	ret = tpm_pm_resume(dev);
 	if (ret)
-		return ret;
+		goto out;
 
 	/*
 	 * TPM 1.2 requires self-test on resume. This function actually returns
 	 * an error code but for unknown reason it isn't handled.
 	 */
-	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
-		ret = tpm_tis_request_locality(chip, 0);
-		if (ret < 0)
-			return ret;
-
+	if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
 		tpm1_do_selftest(chip);
+out:
+	tpm_tis_relinquish_locality(chip, 0);
 
-		tpm_tis_relinquish_locality(chip, 0);
-	}
-
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(tpm_tis_resume);
 #endif
Signature · 1 line
2.39.2
author maintainer
#82 lore raw

PATCH 73/371 erofs: stop parsing non-compact HEAD index if clusterofs is invalid

In reply to Greg Kroah-Hartman

From: Gao Xiang <[email protected]>

[ Upstream commit cc4efd3dd2ac9f89143e5d881609747ecff04164 ]

Syzbot generated a crafted image [1] with a non-compact HEAD index of clusterofs 33024 while valid numbers should be 0 ~ lclustersize-1, which causes the following unexpected behavior as below:

 BUG: unable to handle page fault for address: fffff52101a3fff9
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 23ffed067 P4D 23ffed067 PUD 0
 Oops: 0000 [#1] PREEMPT SMP KASAN
 CPU: 1 PID: 4398 Comm: kworker/u5:1 Not tainted 6.3.0-rc6-syzkaller-g09a9639e56c0 #0
 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
 Workqueue: erofs_worker z_erofs_decompressqueue_work
 RIP: 0010:z_erofs_decompress_queue+0xb7e/0x2b40
 ...
 Call Trace:
  <TASK>
  z_erofs_decompressqueue_work+0x99/0xe0
  process_one_work+0x8f6/0x1170
  worker_thread+0xa63/0x1210
  kthread+0x270/0x300
  ret_from_fork+0x1f/0x30

Note that normal images or images using compact indexes are not impacted. Let's fix this now.

[1] https://lore.kernel.org/r/[email protected]

Reported-and-tested-by [email protected]
Fixes 02827e1796b3 ("staging: erofs: add erofs_map_blocks_iter")
Fixes 152a333a5895 ("staging: erofs: add compacted compression indexes support")
---
 fs/erofs/zmap.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/erofs/zmap.c +4 -0
index 73b86b5c1a75b..2c8575a8f6dae 100644
@@ -191,6 +191,10 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 	case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
 	case Z_EROFS_VLE_CLUSTER_TYPE_HEAD:
 		m->clusterofs = le16_to_cpu(di->di_clusterofs);
+		if (m->clusterofs >= 1 << vi->z_logical_clusterbits) {
+			DBG_BUGON(1);
+			return -EFSCORRUPTED;
+		}
 		m->pblk = le32_to_cpu(di->di_u.blkaddr);
 		break;
 	default:
Signature · 1 line
2.39.2
author maintainer
#83 lore raw

PATCH 74/371 erofs: fix potential overflow calculating xattr_isize

In reply to Greg Kroah-Hartman

From: Jingbo Xu <[email protected]>

[ Upstream commit 1b3567a1969b26f709d82a874498c0754ea841c3 ]

Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4).

Thus declare xattr_isize as unsigned int to avoid the potential overflow.

Fixes bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs")
---
 fs/erofs/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/internal.h +1 -1
index b77acf09726c6..beadb06d8feb9 100644
@@ -226,7 +226,7 @@ struct erofs_inode {
 
 	unsigned char datalayout;
 	unsigned char inode_isize;
-	unsigned short xattr_isize;
+	unsigned int xattr_isize;
 
 	unsigned int xattr_shared_count;
 	unsigned int *xattr_shared_xattrs;
Signature · 1 line
2.39.2
author maintainer
#84 lore raw

PATCH 75/371 drm/rockchip: Drop unbalanced obj unref

In reply to Greg Kroah-Hartman

From: Rob Clark <[email protected]>

[ Upstream commit 8ee3b0e85f6ccd9e6c527bc50eaba774c3bb18d0 ]

In the error path, rockchip_drm_gem_object_mmap() is dropping an obj reference that it doesn't own.

Fixes 41315b793e13 ("drm/rockchip: use drm_gem_mmap helpers")
---
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +0 -3
index 7971f57436dd7..3b18b6a7acd3e 100644
@@ -251,9 +251,6 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,
 	else
 		ret = rockchip_drm_gem_object_mmap_dma(obj, vma);
 
-	if (ret)
-		drm_gem_vm_close(vma);
-
 	return ret;
 }
 
Signature · 1 line
2.39.2
author maintainer
#85 lore raw

PATCH 76/371 drm/vgem: add missing mutex_destroy

In reply to Greg Kroah-Hartman

From: Maíra Canal <[email protected]>

[ Upstream commit 7c18189b14b33c1fbf76480b1bd217877c086e67 ]

vgem_fence_open() instantiates a mutex for a particular fence instance, but never destroys it by calling mutex_destroy() in vgem_fence_close().

So, add the missing mutex_destroy() to guarantee proper resource destruction.

Fixes 407779848445 ("drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl)")
---
 drivers/gpu/drm/vgem/vgem_fence.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/vgem/vgem_fence.c +1 -0
index bd6f75285fd95..43fc56d0c4a06 100644
@@ -248,4 +248,5 @@ void vgem_fence_close(struct vgem_file *vfile)
 {
 	idr_for_each(&vfile->fence_idr, __vgem_fence_idr_fini, vfile);
 	idr_destroy(&vfile->fence_idr);
+	mutex_destroy(&vfile->fence_mutex);
 }
Signature · 1 line
2.39.2
author maintainer
#86 lore raw

PATCH 77/371 drm/probe-helper: Cancel previous job before starting new one

In reply to Greg Kroah-Hartman

From: Dom Cobley <[email protected]>

[ Upstream commit a8e47884f1906cd7440fafa056adc8817568e73e ]

Currently we schedule a call to output_poll_execute from drm_kms_helper_poll_enable for 10s in future. Later we try to replace that in drm_helper_probe_single_connector_modes with a 0s schedule with delayed_event set.

But as there is already a job in the queue this fails, and the immediate job we wanted with delayed_event set doesn't occur until 10s later.

And that call acts as if connector state has changed, reprobing modes. This has a side effect of waking up a display that has been blanked.

Make sure we cancel the old job before submitting the immediate one.

Fixes 162b6a57ac50 ("drm/probe-helper: don't lose hotplug event")
[Maxime: Switched to mod_delayed_work]
---
 drivers/gpu/drm/drm_probe_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_probe_helper.c +3 -2
index 5606bca3caa83..f6b72e03688d4 100644
@@ -488,8 +488,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		 */
 		dev->mode_config.delayed_event = true;
 		if (dev->mode_config.poll_enabled)
-			schedule_delayed_work(&dev->mode_config.output_poll_work,
-					      0);
+			mod_delayed_work(system_wq,
+					 &dev->mode_config.output_poll_work,
+					 0);
 	}
 
 	/* Re-enable polling in case the global poll config changed. */
Signature · 1 line
2.39.2
author maintainer
#87 lore raw

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

In reply to Greg Kroah-Hartman

From: Terry Bowman <[email protected]>

[ Upstream commit 4e347bdf44c1fd4296a7b9657a2c0e1bd900fa50 ]

Leaf Fn00000007 contains avx512bw at bit 26 and avx512vl at bit 28. This is incorrect per the SDM. Correct avx512bw to be bit 30 and avx512lvl to be bit 31.

Fixes c6b2f240bf8d ("tools/x86: Add a kcpuid tool to show raw CPU features")
---
 tools/arch/x86/kcpuid/cpuid.csv | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/arch/x86/kcpuid/cpuid.csv +2 -2
index 4f1c4b0c29e98..9914bdf4fc9ec 100644
@@ -184,8 +184,8 @@
 	 7,    0,  EBX,     27, avx512er, AVX512 Exponent Reciproca instr
 	 7,    0,  EBX,     28, avx512cd, AVX512 Conflict Detection instr
 	 7,    0,  EBX,     29, sha, Intel Secure Hash Algorithm Extensions instr
-	 7,    0,  EBX,     26, avx512bw, AVX512 Byte & Word instr
-	 7,    0,  EBX,     28, avx512vl, AVX512 Vector Length Extentions (VL)
+	 7,    0,  EBX,     30, avx512bw, AVX512 Byte & Word instr
+	 7,    0,  EBX,     31, avx512vl, AVX512 Vector Length Extentions (VL)
 	 7,    0,  ECX,      0, prefetchwt1, X
 	 7,    0,  ECX,      1, avx512vbmi, AVX512 Vector Byte Manipulation Instructions
 	 7,    0,  ECX,      2, umip, User-mode Instruction Prevention
Signature · 1 line
2.39.2
author maintainer
#88 lore raw

PATCH 79/371 soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe

In reply to Greg Kroah-Hartman

From: Miaoqian Lin <[email protected]>

[ Upstream commit 8f3c307b580a4a6425896007325bddefc36e8d91 ]

wkup_m3_ipc_get() takes refcount, which should be freed by wkup_m3_ipc_put(). Add missing refcount release in the error paths.

Fixes 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add rtc_only with ddr in self-refresh support")
---
 drivers/soc/ti/pm33xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/ti/pm33xx.c +3 -2
index 7bab4bbaf02dc..285302bf3ef91 100644
@@ -527,7 +527,7 @@ static int am33xx_pm_probe(struct platform_device *pdev)
 
 	ret = am33xx_pm_alloc_sram();
 	if (ret)
-		return ret;
+		goto err_wkup_m3_ipc_put;
 
 	ret = am33xx_pm_rtc_setup();
 	if (ret)
@@ -574,13 +574,14 @@ static int am33xx_pm_probe(struct platform_device *pdev)
 	pm_runtime_put_sync(dev);
 err_pm_runtime_disable:
 	pm_runtime_disable(dev);
-	wkup_m3_ipc_put(m3_ipc);
 err_unsetup_rtc:
 	iounmap(rtc_base_virt);
 	clk_put(rtc_fck);
 err_free_sram:
 	am33xx_pm_free_sram();
 	pm33xx_dev = NULL;
+err_wkup_m3_ipc_put:
+	wkup_m3_ipc_put(m3_ipc);
 	return ret;
 }
 
Signature · 1 line
2.39.2
author maintainer
#89 lore raw

PATCH 80/371 arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table

In reply to Greg Kroah-Hartman

From: Geert Uytterhoeven <[email protected]>

[ Upstream commit fb76b0fae3ca880363214e1dcd6513ab8bd529e7 ]

According to the R-Car Series, 3rd Generation Hardware User’s Manual Rev. 2.30, the System CPU cores on R-Car E3 do not have their own power supply, but use the common internal power supply (typical 1.03V).

Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.

---
 arch/arm64/boot/dts/renesas/r8a77990.dtsi | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +0 -3
index 9e616b0f04d46..adcb03fa23148 100644
@@ -60,17 +60,14 @@
 		opp-shared;
 		opp-800000000 {
 			opp-hz = /bits/ 64 <800000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 		};
 		opp-1000000000 {
 			opp-hz = /bits/ 64 <1000000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 		};
 		opp-1200000000 {
 			opp-hz = /bits/ 64 <1200000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 			opp-suspend;
 		};
Signature · 1 line
2.39.2
author maintainer
#90 lore raw

PATCH 81/371 arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table

In reply to Greg Kroah-Hartman

From: Geert Uytterhoeven <[email protected]>

[ Upstream commit 554edc3e9239bb81e61be9f0f5dbbeb528a69e72 ]

According to the RZ/G Series, 2nd Generation Hardware User’s Manual Rev. 1.11, the System CPU cores on RZ/G2E do not have their own power supply, but use the common internal power supply (typical 1.03V).

Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.

---
 arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a774c0.dtsi +0 -3
index 9eb08be3b98e2..50189209b6605 100644
@@ -49,17 +49,14 @@
 		opp-shared;
 		opp-800000000 {
 			opp-hz = /bits/ 64 <800000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 		};
 		opp-1000000000 {
 			opp-hz = /bits/ 64 <1000000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 		};
 		opp-1200000000 {
 			opp-hz = /bits/ 64 <1200000000>;
-			opp-microvolt = <820000>;
 			clock-latency-ns = <300000>;
 			opp-suspend;
 		};
Signature · 1 line
2.39.2
author maintainer
#64 lore raw

PATCH 64/371 selftests/resctrl: Check for return value after write_schemata()

In reply to Greg Kroah-Hartman

From: Ilpo Järvinen <[email protected]>

[ Upstream commit 0d45c83b95da414e98ad333e723141a94f6e2c64 ]

MBA test case writes schemata but it does not check if the write is successful or not.

Add the error check and return error properly.

Fixes 01fee6b4d1f9 ("selftests/resctrl: Add MBA test")
---
 tools/testing/selftests/resctrl/mba_test.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/resctrl/mba_test.c +6 -1
index f32289ae17aeb..97dc98c0c9497 100644
@@ -28,6 +28,7 @@ static int mba_setup(int num, ...)
 	struct resctrl_val_param *p;
 	char allocation_str[64];
 	va_list param;
+	int ret;
 
 	va_start(param, num);
 	p = va_arg(param, struct resctrl_val_param *);
@@ -45,7 +46,11 @@ static int mba_setup(int num, ...)
 
 	sprintf(allocation_str, "%d", allocation);
 
-	write_schemata(p->ctrlgrp, allocation_str, p->cpu_no, p->resctrl_val);
+	ret = write_schemata(p->ctrlgrp, allocation_str, p->cpu_no,
+			     p->resctrl_val);
+	if (ret < 0)
+		return ret;
+
 	allocation -= ALLOCATION_STEP;
 
 	return 0;
Signature · 1 line
2.39.2
author maintainer
#91 lore raw

PATCH 82/371 drm/msm/disp/dpu: check for crtc enable rather than crtc active to release shared resources

In reply to Greg Kroah-Hartman

From: Vinod Polimera <[email protected]>

[ Upstream commit b6975693846b562c4d3e0e60cc884affc5bdac00 ]

According to KMS documentation, The driver must not release any shared resources if active is set to false but enable still true.

Fixes ccc862b957c6 ("drm/msm/dpu: Fix reservation failures in modeset")

Patchwork: https://patchwork.freedesktop.org/patch/524726/

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
index 5f236395677e6..03bddd904d1a1 100644
@@ -637,7 +637,7 @@ static int dpu_encoder_virt_atomic_check(
 		if (drm_atomic_crtc_needs_modeset(crtc_state)) {
 			dpu_rm_release(global_state, drm_enc);
 
-			if (!crtc_state->active_changed || crtc_state->active)
+			if (!crtc_state->active_changed || crtc_state->enable)
 				ret = dpu_rm_reserve(&dpu_kms->rm, global_state,
 						drm_enc, crtc_state, topology);
 		}
Signature · 1 line
2.39.2
author maintainer
#92 lore raw

PATCH 83/371 EDAC/skx: Fix overflows on the DRAM row address mapping arrays

In reply to Greg Kroah-Hartman

From: Qiuxu Zhuo <[email protected]>

[ Upstream commit 71b1e3ba3fed5a34c5fac6d3a15c2634b04c1eb7 ]

The current DRAM row address mapping arrays skx_{open,close}_row[] only support ranks with sizes up to 16G. Decoding a rank address to a DRAM row address for a 32G rank by using either one of the above arrays by the skx_edac driver, will result in an overflow on the array.

For a 32G rank, the most significant DRAM row address bit (the bit17) is mapped from the bit34 of the rank address. Add this new mapping item to both arrays to fix the overflow issue.

Fixes 4ec656bdf43a ("EDAC, skx_edac: Add EDAC driver for Skylake")
---
 drivers/edac/skx_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/skx_base.c +2 -2
index 1abc020d49ab6..984c93c8825f0 100644
@@ -510,7 +510,7 @@ static bool skx_rir_decode(struct decoded_addr *res)
 }
 
 static u8 skx_close_row[] = {
-	15, 16, 17, 18, 20, 21, 22, 28, 10, 11, 12, 13, 29, 30, 31, 32, 33
+	15, 16, 17, 18, 20, 21, 22, 28, 10, 11, 12, 13, 29, 30, 31, 32, 33, 34
 };
 
 static u8 skx_close_column[] = {
@@ -518,7 +518,7 @@ static u8 skx_close_column[] = {
 };
 
 static u8 skx_open_row[] = {
-	14, 15, 16, 20, 28, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33
+	14, 15, 16, 20, 28, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34
 };
 
 static u8 skx_open_column[] = {
Signature · 1 line
2.39.2
author maintainer
#93 lore raw

PATCH 84/371 regulator: core: Shorten off-on-delay-us for always-on/boot-on by time since booted

In reply to Greg Kroah-Hartman

From: Douglas Anderson <[email protected]>

[ Upstream commit 691c1fcda5351ed98a44610b7dccc0e3ee920020 ]

This is very close to a straight revert of commit 218320fec294 ("regulator: core: Fix off-on-delay-us for always-on/boot-on regulators"). We've identified that patch as causing a boot speed regression on sc7180-trogdor boards. While boot speed certainly isn't more important than making sure that power sequencing is correct, looking closely at the original change it doesn't seem to have been fully justified. It mentions "cycling issues" without describing exactly what the issues were. That means it's possible that the cycling issues were really a problem that should be fixed in a different way.

Let's take a careful look at how we should handle regulators that have an off-on-delay and that are boot-on or always-on. Linux currently doesn't have any way to identify whether a GPIO regulator was already on when the kernel booted. That means that when the kernel boots we probe a regulator, see that it wants boot-on / always-on we, and then turn the regulator on. We could be in one of two cases when we do this:

a) The regulator might have been left on by the bootloader and we're ensuring that it stays on.
b) The regulator might have been left off by the bootloader and we're just now turning it on.

For case a) we definitely don't need any sort of delay. For case b) we _might_ need some delay in case the bootloader turned the regulator off _right_ before booting the kernel. To get the proper delay for case b) then we can just assume a last_off of 0, which is what it gets initialized to by default.

As per above, we can't tell whether we're in case a) or case b) so we'll assume the longer delay (case b). This basically puts the code to how it was before commit 218320fec294 ("regulator: core: Fix off-on-delay-us for always-on/boot-on regulators"). However, we add one important change: we make sure that the delay is actually honored if last_off is 0. Though the original "cycling issues" cited were vague, I'm hopeful that this important extra change will be enough to fix the issues that the initial commit mentioned.

With this fix, I've confined that on a sc7180-trogdor board the delay at boot goes down from 500 ms to ~250 ms. That's not as good as the 0 ms that we had prior to commit 218320fec294 ("regulator: core: Fix off-on-delay-us for always-on/boot-on regulators"), but it's probably safer because we don't know if the bootloader turned the regulator off right before booting.

One note is that it's possible that we could be in a state that's not
a) or b) if there are other issues in the kernel. The only one I can think of is related to pinctrl. If the pinctrl driver being used on a board isn't careful about avoiding glitches when setting up a pin then it's possible that setting up a pin could cause the regulator to "turn off" briefly immediately before the regulator probes. If this is indeed causing problems then the pinctrl driver should be fixed, perhaps in a similar way to what was done in commit d21f4b7ffc22 ("pinctrl: qcom: Avoid glitching lines when we first mux to output")

Fixes 218320fec294 ("regulator: core: Fix off-on-delay-us for always-on/boot-on regulators")
Cc Christian Kohlschütter <[email protected]>
---
 drivers/regulator/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/core.c +3 -4
index cd10880378a6d..e876702d6ef36 100644
@@ -1539,9 +1539,6 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 			rdev->constraints->always_on = true;
 	}
 
-	if (rdev->desc->off_on_delay)
-		rdev->last_off = ktime_get_boottime();
-
 	/* If the constraints say the regulator should be on at this point
 	 * and we have control then make sure it is enabled.
 	 */
@@ -1575,6 +1572,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 
 		if (rdev->constraints->always_on)
 			rdev->use_count++;
+	} else if (rdev->desc->off_on_delay) {
+		rdev->last_off = ktime_get();
 	}
 
 	print_constraints(rdev);
@@ -2624,7 +2623,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
 
 	trace_regulator_enable(rdev_get_name(rdev));
 
-	if (rdev->desc->off_on_delay && rdev->last_off) {
+	if (rdev->desc->off_on_delay) {
 		/* if needed, keep a distance of off_on_delay from last time
 		 * this regulator was disabled.
 		 */
Signature · 1 line
2.39.2
author maintainer
#94 lore raw

PATCH 85/371 arm64: dts: ti: k3-j721e-main: Remove ti,strobe-sel property

In reply to Greg Kroah-Hartman

From: Bhavya Kapoor <[email protected]>

[ Upstream commit 4f4b30a777d3e61603119297965343a37be36435 ]

According to latest errata of J721e [1], (i2024) 'MMCSD: Peripherals Do Not Support HS400' which applies to MMCSD0 subsystem. Speed modes supported has been already updated but missed dropping 'ti,strobe-sel' property which is only required by HS400 speed mode.

Thus, drop 'ti,strobe-sel' property from kernel dtsi for J721e SoC.

[1] https://www.ti.com/lit/er/sprz455/sprz455.pdf

Fixes eb8f6194e807 ("arm64: dts: ti: k3-j721e-main: Update the speed modes supported and their itap delay values for MMCSD subsystems")
---
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +0 -1
index ad21bb1417aa6..d662eeb7d80a7 100644
@@ -1051,7 +1051,6 @@
 		ti,itap-del-sel-mmc-hs = <0xa>;
 		ti,itap-del-sel-ddr52 = <0x3>;
 		ti,trm-icp = <0x8>;
-		ti,strobe-sel = <0x77>;
 		dma-coherent;
 	};
 
Signature · 1 line
2.39.2
author maintainer
#95 lore raw

PATCH 86/371 arm64: dts: broadcom: bcm4908: add DT for Netgear RAXE500

In reply to Greg Kroah-Hartman

From: Rafał Miłecki <[email protected]>

[ Upstream commit d0e68d354f345873e15876a7b35be1baaf5e3ec9 ]

It's a home router based on BCM4908 SoC. It has: 1 GiB of RAM, 512 MiB NAND flash, 6 Ethernet ports and 3 x BCM43684 (WiFi). One of Ethernet ports is "2.5 G Multi-Gig port" that isn't described yet (it isn't known how it's wired up).

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/bcm4908/Makefile |  1 +
 .../bcm4908/bcm4908-netgear-raxe500.dts       | 50 +++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts
arch/arm64/boot/dts/broadcom/bcm4908/Makefile +1 -0
index cc75854519ac3..6e364e304d4fd 100644
@@ -2,3 +2,4 @@
 dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb
 dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb
 dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb
+dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-netgear-raxe500.dtb
arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.39.2
author maintainer
#96 lore raw

PATCH 87/371 arm64: dts: Add DTS files for bcmbca SoC BCM63158

In reply to Greg Kroah-Hartman

From: William Zhang <[email protected]>

[ Upstream commit 076dcedc6628c6bf92bd17bfcf8fb7b1af62bfb6 ]

Add DTS for ARMv8 based broadband SoC BCM63158. bcm63158.dtsi is the SoC description DTS header and bcm963158.dts is a simple DTS file for Broadcom BCM963158 Reference board that only enable the UART port.

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/Makefile         |   1 +
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile  |   2 +
 .../boot/dts/broadcom/bcmbca/bcm63158.dtsi    | 128 ++++++++++++++++++
 .../boot/dts/broadcom/bcmbca/bcm963158.dts    |  30 ++++
 4 files changed, 161 insertions(+)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts
arch/arm64/boot/dts/broadcom/Makefile +1 -0
index 11eae3e3a9447..9a0ea4b97ef23 100644
@@ -7,5 +7,6 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \
 			      bcm2837-rpi-cm3-io3.dtb
 
 subdir-y	+= bcm4908
+subdir-y	+= bcmbca
 subdir-y	+= northstar2
 subdir-y	+= stingray
arch/arm64/boot/dts/broadcom/bcmbca/Makefile new file +2 -0
new file mode 100644
index 0000000000000..d5f89245336c4
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_BCMBCA) += bcm963158.dtb
arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi new file +128 -0

128 lines not on this page · raw message

arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts new file +30 -0
new file mode 100644
index 0000000000000..eba07e0b1ca6f
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2022 Broadcom Ltd.
+ */
+
+/dts-v1/;
+
+#include "bcm63158.dtsi"
+
+/ {
+	model = "Broadcom BCM963158 Reference Board";
+	compatible = "brcm,bcm963158", "brcm,bcm63158", "brcm,bcmbca";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x08000000>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.39.2
author maintainer
#97 lore raw

PATCH 88/371 arm64: dts: Add DTS files for bcmbca SoC BCM4912

In reply to Greg Kroah-Hartman

From: William Zhang <[email protected]>

[ Upstream commit 1ba56aeb391401c4cb2126c39f90b3cdbfabdb3f ]

Add DTS for ARMv8 based broadband SoC BCM4912. bcm4912.dtsi is the SoC description DTS header and bcm94912.dts is a simple DTS file for Broadcom BCM94912 Reference board that only enable the UART port.

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile  |   3 +-
 .../boot/dts/broadcom/bcmbca/bcm4912.dtsi     | 128 ++++++++++++++++++
 .../boot/dts/broadcom/bcmbca/bcm94912.dts     |  30 ++++
 3 files changed, 160 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts
arch/arm64/boot/dts/broadcom/bcmbca/Makefile +2 -1
index d5f89245336c4..b6e520e9f2f21 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_BCMBCA) += bcm963158.dtb
+dtb-$(CONFIG_ARCH_BCMBCA) += bcm94912.dtb \
+				bcm963158.dtb
arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi new file +128 -0

128 lines not on this page · raw message

arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts new file +30 -0
new file mode 100644
index 0000000000000..a3623e6f6919c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2022 Broadcom Ltd.
+ */
+
+/dts-v1/;
+
+#include "bcm4912.dtsi"
+
+/ {
+	model = "Broadcom BCM94912 Reference Board";
+	compatible = "brcm,bcm94912", "brcm,bcm4912", "brcm,bcmbca";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x08000000>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.39.2
author maintainer
#98 lore raw

PATCH 89/371 ARM64: dts: Add DTS files for bcmbca SoC BCM6858

In reply to Greg Kroah-Hartman

From: Anand Gore <[email protected]>

[ Upstream commit e663e06bd3f21e64bc2163910f626af68add6308 ]

Add DTS for ARMv8 based broadband SoC BCM6858. bcm6858.dtsi is the SoC description DTS header and bcm96858.dts is a simple DTS file for Broadcom BCM96858 Reference board that only enables the UART port.

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile  |   3 +-
 .../boot/dts/broadcom/bcmbca/bcm6858.dtsi     | 121 ++++++++++++++++++
 .../boot/dts/broadcom/bcmbca/bcm96858.dts     |  30 +++++
 3 files changed, 153 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts
arch/arm64/boot/dts/broadcom/bcmbca/Makefile +2 -1
index b6e520e9f2f21..4161d557b1329 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_BCMBCA) += bcm94912.dtb \
-				bcm963158.dtb
+				bcm963158.dtb \
+				bcm96858.dtb
arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi new file +121 -0

121 lines not on this page · raw message

arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts new file +30 -0
new file mode 100644
index 0000000000000..0cbf582f5d545
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2022 Broadcom Ltd.
+ */
+
+/dts-v1/;
+
+#include "bcm6858.dtsi"
+
+/ {
+	model = "Broadcom BCM96858 Reference Board";
+	compatible = "brcm,bcm96858", "brcm,bcm6858", "brcm,bcmbca";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x08000000>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.39.2
author maintainer
#99 lore raw

PATCH 90/371 arm64: dts: Add base DTS file for bcmbca device Asus GT-AX6000

In reply to Greg Kroah-Hartman

From: Rafał Miłecki <[email protected]>

[ Upstream commit f3f575c4bef95384e68de552c7b29938fd0d9201 ]

It's a home router with 1 GiB of RAM, 6 Ethernet ports, 2 USB ports.

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile  |  4 +++-
 .../bcmbca/bcm4912-asus-gt-ax6000.dts         | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm4912-asus-gt-ax6000.dts
arch/arm64/boot/dts/broadcom/bcmbca/Makefile +3 -1
index 4161d557b1329..fd60418478696 100644
@@ -1,4 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_BCMBCA) += bcm94912.dtb \
+dtb-$(CONFIG_ARCH_BCMBCA) += \
+				bcm4912-asus-gt-ax6000.dtb \
+				bcm94912.dtb \
 				bcm963158.dtb \
 				bcm96858.dtb
arch/arm64/boot/dts/broadcom/bcmbca/bcm4912-asus-gt-ax6000.dts new file +19 -0
new file mode 100644
index 0000000000000..ed554666e95ea
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "bcm4912.dtsi"
+
+/ {
+	compatible = "asus,gt-ax6000", "brcm,bcm4912", "brcm,bcmbca";
+	model = "Asus GT-AX6000";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00 0x00 0x00 0x40000000>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.39.2
author maintainer
#100 lore raw

PATCH 91/371 arm64: dts: Move BCM4908 dts to bcmbca folder

In reply to Greg Kroah-Hartman

From: William Zhang <[email protected]>

[ Upstream commit ded8f22945899f4e87dd6d952bbc4abce6e64b7e ]

As part of ARCH_BCM4908 to ARCH_BCMBCA migration, move the BCM4908 dts files to bcmbca folder and use CONFIG_ARCH_BCMBCA to build all the BCM4908 board dts. Delete bcm4908 folder and its makefile as well.

Stable-dep-of: 5cca02449490 ("arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name")

---
 arch/arm64/boot/dts/broadcom/Makefile                        | 1 -
 arch/arm64/boot/dts/broadcom/bcm4908/Makefile                | 5 -----
 arch/arm64/boot/dts/broadcom/bcmbca/Makefile                 | 4 ++++
 .../broadcom/{bcm4908 => bcmbca}/bcm4906-netgear-r8000p.dts  | 0
 .../{bcm4908 => bcmbca}/bcm4906-tplink-archer-c2300-v1.dts   | 0
 .../arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906.dtsi | 0
 .../broadcom/{bcm4908 => bcmbca}/bcm4908-asus-gt-ac5300.dts  | 0
 .../broadcom/{bcm4908 => bcmbca}/bcm4908-netgear-raxe500.dts | 0
 .../arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908.dtsi | 0
 9 files changed, 4 insertions(+), 6 deletions(-)
 delete mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/Makefile
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906-netgear-r8000p.dts (100%)
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906-tplink-archer-c2300-v1.dts (100%)
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906.dtsi (100%)
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908-asus-gt-ac5300.dts (100%)
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908-netgear-raxe500.dts (100%)
 rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908.dtsi (100%)
arch/arm64/boot/dts/broadcom/Makefile +0 -1
index 9a0ea4b97ef23..bce0a12554539 100644
@@ -6,7 +6,6 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \
 			      bcm2837-rpi-3-b-plus.dtb \
 			      bcm2837-rpi-cm3-io3.dtb
 
-subdir-y	+= bcm4908
 subdir-y	+= bcmbca
 subdir-y	+= northstar2
 subdir-y	+= stingray
arch/arm64/boot/dts/broadcom/bcm4908/Makefile deleted +0 -5
deleted file mode 100644
index 6e364e304d4fd..0000000000000
@@ -1,5 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb
-dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb
-dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb
-dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-netgear-raxe500.dtb
arch/arm64/boot/dts/broadcom/bcmbca/Makefile +4 -0
index fd60418478696..dc68357849a9b 100644
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_BCMBCA) += \
+				bcm4906-netgear-r8000p.dtb \
+				bcm4906-tplink-archer-c2300-v1.dtb \
+				bcm4908-asus-gt-ac5300.dtb \
+				bcm4908-netgear-raxe500.dtb \
 				bcm4912-asus-gt-ax6000.dtb \
 				bcm94912.dtb \
 				bcm963158.dtb \
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1.dts renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1.dts
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906.dtsi renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4906.dtsi
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-netgear-raxe500.dts renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-netgear-raxe500.dts
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi renamed from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +0 -0
similarity index 100%
rename from arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
rename to arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
Signature · 1 line
2.39.2
author maintainer
#65 lore raw

PATCH 65/371 selinux: fix Makefile dependencies of flask.h

In reply to Greg Kroah-Hartman

From: Ondrej Mosnacek <[email protected]>

[ Upstream commit bcab1adeaad4b39a1e04cb98979a367d08253f03 ]

Make the flask.h target depend on the genheaders binary instead of classmap.h to ensure that it is rebuilt if any of the dependencies of genheaders are changed.

Notably this fixes flask.h not being rebuilt when
initial_sid_to_string.h is modified.

Fixes 8753f6bec352 ("selinux: generate flask headers during kernel build")
---
 security/selinux/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/Makefile +2 -2
index 7761624448826..103c2776478a7 100644
@@ -23,8 +23,8 @@ ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
 $(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
 
 quiet_cmd_flask = GEN     $(obj)/flask.h $(obj)/av_permissions.h
-      cmd_flask = scripts/selinux/genheaders/genheaders $(obj)/flask.h $(obj)/av_permissions.h
+      cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
 
 targets += flask.h av_permissions.h
-$(obj)/flask.h: $(src)/include/classmap.h FORCE
+$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
 	$(call if_changed,flask)
Signature · 1 line
2.39.2
author maintainer
#101 lore raw

PATCH 92/371 arm64: dts: broadcom: bcmbca: bcm4908: fix NAND interrupt name

In reply to Greg Kroah-Hartman

From: Rafał Miłecki <[email protected]>

[ Upstream commit 5cca02449490e767289bda38db1577e2c375c084 ]

This fixes:
arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dtb: nand-controller@1800: interrupt-names:0: 'nand_ctlrdy' was expected
From schema: Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dtb: nand-controller@1800: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
From schema: Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml

---
 arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +1 -1
index e510a6961cf95..03e27bcc44464 100644
@@ -305,7 +305,7 @@
 			reg = <0x1800 0x600>, <0x2000 0x10>;
 			reg-names = "nand", "nand-int-base";
 			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "nand";
+			interrupt-names = "nand_ctlrdy";
 			status = "okay";
 
 			nandcs: nand@0 {
Signature · 1 line
2.39.2
author maintainer
#102 lore raw

PATCH 93/371 arm64: dts: broadcom: bcmbca: bcm4908: fix procmon nodename

In reply to Greg Kroah-Hartman

From: Rafał Miłecki <[email protected]>

[ Upstream commit f16a8294dd7a02c7ad042cd2e3acc5ea06698dc1 ]

This fixes:
arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dtb: syscon@280000: $nodename:0: 'syscon@280000' does not match '^([a-z][a-z0-9\\-]+-bus|bus|localbus|soc|axi|ahb|apb)(@.+)?$'
From schema: schemas/simple-bus.yaml

---
 arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +1 -1
index 03e27bcc44464..b7db95ce0bbf2 100644
@@ -253,7 +253,7 @@
 			};
 		};
 
-		procmon: syscon@280000 {
+		procmon: bus@280000 {
 			compatible = "simple-bus";
 			reg = <0x280000 0x1000>;
 			ranges;
Signature · 1 line
2.39.2
author maintainer
#66 lore raw

PATCH 66/371 selinux: ensure av_permissions.h is built when needed

In reply to Greg Kroah-Hartman

From: Paul Moore <[email protected]>

[ Upstream commit 4ce1f694eb5d8ca607fed8542d32a33b4f1217a5 ]

The Makefile rule responsible for building flask.h and av_permissions.h only lists flask.h as a target which means that av_permissions.h is only generated when flask.h needs to be generated. This patch fixes this by adding av_permissions.h as a target to the rule.

Fixes 8753f6bec352 ("selinux: generate flask headers during kernel build")
---
 security/selinux/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/Makefile +1 -1
index 103c2776478a7..0aecf9334ec31 100644
@@ -26,5 +26,5 @@ quiet_cmd_flask = GEN     $(obj)/flask.h $(obj)/av_permissions.h
       cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
 
 targets += flask.h av_permissions.h
-$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
+$(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/genheaders/genheaders FORCE
 	$(call if_changed,flask)
Signature · 1 line
2.39.2
author maintainer
#67 lore raw

PATCH 67/371 tpm, tpm_tis: Do not skip reset of original interrupt vector

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit ed9be0e6c892a783800d77a41ca4c7255c6af8c5 ]

If in tpm_tis_probe_irq_single() an error occurs after the original interrupt vector has been read, restore the interrupts before the error is returned.

Since the caller does not check the error value, return -1 in any case that the TPM_CHIP_FLAG_IRQ flag is not set. Since the return value of function tpm_tis_gen_interrupt() is not longer used, make it a void function.

Fixes 1107d065fdf1 ("tpm_tis: Introduce intermediate layer for TPM access")
---
 drivers/char/tpm/tpm_tis_core.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -18
index dc56b976d8162..ae0c773a6041a 100644
@@ -714,7 +714,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
+static void tpm_tis_gen_interrupt(struct tpm_chip *chip)
 {
 	const char *desc = "attempting to generate an interrupt";
 	u32 cap2;
@@ -723,7 +723,7 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
 
 	ret = request_locality(chip, 0);
 	if (ret < 0)
-		return ret;
+		return;
 
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
 		ret = tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);
@@ -731,8 +731,6 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
 		ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0);
 
 	release_locality(chip, 0);
-
-	return ret;
 }
 
 /* Register the IRQ and issue a command that will cause an interrupt. If an
@@ -762,42 +760,37 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 
 	rc = tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality), irq);
 	if (rc < 0)
-		return rc;
+		goto restore_irqs;
 
 	rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &int_status);
 	if (rc < 0)
-		return rc;
+		goto restore_irqs;
 
 	/* Clear all existing */
 	rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), int_status);
 	if (rc < 0)
-		return rc;
-
+		goto restore_irqs;
 	/* Turn on */
 	rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality),
 			     intmask | TPM_GLOBAL_INT_ENABLE);
 	if (rc < 0)
-		return rc;
+		goto restore_irqs;
 
 	priv->irq_tested = false;
 
 	/* Generate an interrupt by having the core call through to
 	 * tpm_tis_send
 	 */
-	rc = tpm_tis_gen_interrupt(chip);
-	if (rc < 0)
-		return rc;
+	tpm_tis_gen_interrupt(chip);
 
+restore_irqs:
 	/* tpm_tis_send will either confirm the interrupt is working or it
 	 * will call disable_irq which undoes all of the above.
 	 */
 	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
-		rc = tpm_tis_write8(priv, original_int_vec,
-				TPM_INT_VECTOR(priv->locality));
-		if (rc < 0)
-			return rc;
-
-		return 1;
+		tpm_tis_write8(priv, original_int_vec,
+			       TPM_INT_VECTOR(priv->locality));
+		return -1;
 	}
 
 	return 0;
Signature · 1 line
2.39.2
author maintainer
#68 lore raw

PATCH 68/371 tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit 282657a8bd7fddcf511b834f43705001668b33a7 ]

In disable_interrupts() the TPM_GLOBAL_INT_ENABLE bit is unset in the TPM_INT_ENABLE register to shut the interrupts off. However modifying the register is only possible with a held locality. So claim the locality before disable_interrupts() is called.

Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")

---
 drivers/char/tpm/tpm_tis_core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/char/tpm/tpm_tis_core.c +4 -0
index ae0c773a6041a..274096fece3fa 100644
@@ -1076,7 +1076,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 				dev_err(&chip->dev, FW_BUG
 					"TPM interrupt not working, polling instead\n");
 
+				rc = request_locality(chip, 0);
+				if (rc < 0)
+					goto out_err;
 				disable_interrupts(chip);
+				release_locality(chip, 0);
 			}
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
Signature · 1 line
2.39.2
author maintainer
#69 lore raw

PATCH 69/371 tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit 6d789ad726950e612a7f31044260337237c5b490 ]

Both functions tpm_tis_probe_irq_single() and tpm_tis_probe_irq() may setup the interrupts and then return with an error. This case is indicated by a missing TPM_CHIP_FLAG_IRQ flag in chip->flags.
Currently the interrupt setup is only undone if tpm_tis_probe_irq_single() fails. Undo the setup also if tpm_tis_probe_irq() fails.

Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")

---
 drivers/char/tpm/tpm_tis_core.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -11
index 274096fece3fa..99cbf6fb062ce 100644
@@ -1069,21 +1069,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 			goto out_err;
 		}
 
-		if (irq) {
+		if (irq)
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
 						 irq);
-			if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
-				dev_err(&chip->dev, FW_BUG
+		else
+			tpm_tis_probe_irq(chip, intmask);
+
+		if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
+			dev_err(&chip->dev, FW_BUG
 					"TPM interrupt not working, polling instead\n");
 
-				rc = request_locality(chip, 0);
-				if (rc < 0)
-					goto out_err;
-				disable_interrupts(chip);
-				release_locality(chip, 0);
-			}
-		} else {
-			tpm_tis_probe_irq(chip, intmask);
+			rc = request_locality(chip, 0);
+			if (rc < 0)
+				goto out_err;
+			disable_interrupts(chip);
+			release_locality(chip, 0);
 		}
 	}
 
Signature · 1 line
2.39.2
author maintainer
#70 lore raw

PATCH 70/371 tpm, tpm_tis: Claim locality before writing interrupt registers

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit 15d7aa4e46eba87242a320f39773aa16faddadee ]

In tpm_tis_probe_single_irq() interrupt registers TPM_INT_VECTOR, TPM_INT_STATUS and TPM_INT_ENABLE are modified to setup the interrupts. Currently these modifications are done without holding a locality thus they have no effect. Fix this by claiming the (default) locality before the registers are written.

Since now tpm_tis_gen_interrupt() is called with the locality already claimed remove locality request and release from this function.

Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")

---
 drivers/char/tpm/tpm_tis_core.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -9
index 99cbf6fb062ce..52826a7edf800 100644
@@ -721,16 +721,10 @@ static void tpm_tis_gen_interrupt(struct tpm_chip *chip)
 	cap_t cap;
 	int ret;
 
-	ret = request_locality(chip, 0);
-	if (ret < 0)
-		return;
-
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
 		ret = tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);
 	else
 		ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0);
-
-	release_locality(chip, 0);
 }
 
 /* Register the IRQ and issue a command that will cause an interrupt. If an
@@ -753,10 +747,16 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	}
 	priv->irq = irq;
 
+	rc = request_locality(chip, 0);
+	if (rc < 0)
+		return rc;
+
 	rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality),
 			   &original_int_vec);
-	if (rc < 0)
+	if (rc < 0) {
+		release_locality(chip, priv->locality);
 		return rc;
+	}
 
 	rc = tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality), irq);
 	if (rc < 0)
@@ -790,10 +790,12 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
 		tpm_tis_write8(priv, original_int_vec,
 			       TPM_INT_VECTOR(priv->locality));
-		return -1;
+		rc = -1;
 	}
 
-	return 0;
+	release_locality(chip, priv->locality);
+
+	return rc;
 }
 
 /* Try to find the IRQ the TPM is using. This is for legacy x86 systems that
Signature · 1 line
2.39.2
author maintainer
#80 lore raw

PATCH 71/371 tpm, tpm: Implement usage counter for locality

In reply to Greg Kroah-Hartman

From: Lino Sanfilippo <[email protected]>

[ Upstream commit 7a2f55d0be296c4e81fd782f3d6c43ed4ec7e265 ]

Implement a usage counter for the (default) locality used by the TPM TIS driver:
Request the locality from the TPM if it has not been claimed yet, otherwise only increment the counter. Also release the locality if the counter is 0 otherwise only decrement the counter. Since in case of SPI the register accesses are locked by means of the SPI bus mutex use a sleepable lock (i.e. also a mutex) to ensure thread-safety of the counter which may be accessed by both a userspace thread and the interrupt handler.

By doing this refactor the names of the amended functions to use a more appropriate prefix.

Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")

---
 drivers/char/tpm/tpm_tis_core.c | 63 +++++++++++++++++++++++----------
 drivers/char/tpm/tpm_tis_core.h |  2 ++
 2 files changed, 47 insertions(+), 18 deletions(-)
drivers/char/tpm/tpm_tis_core.c +45 -18
index 52826a7edf800..3ea0fff30273e 100644
@@ -136,16 +136,27 @@ static bool check_locality(struct tpm_chip *chip, int l)
 	return false;
 }
 
-static int release_locality(struct tpm_chip *chip, int l)
+static int __tpm_tis_relinquish_locality(struct tpm_tis_data *priv, int l)
+{
+	tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
+
+	return 0;
+}
+
+static int tpm_tis_relinquish_locality(struct tpm_chip *chip, int l)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
 
-	tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
+	mutex_lock(&priv->locality_count_mutex);
+	priv->locality_count--;
+	if (priv->locality_count == 0)
+		__tpm_tis_relinquish_locality(priv, l);
+	mutex_unlock(&priv->locality_count_mutex);
 
 	return 0;
 }
 
-static int request_locality(struct tpm_chip *chip, int l)
+static int __tpm_tis_request_locality(struct tpm_chip *chip, int l)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
 	unsigned long stop, timeout;
@@ -186,6 +197,20 @@ static int request_locality(struct tpm_chip *chip, int l)
 	return -1;
 }
 
+static int tpm_tis_request_locality(struct tpm_chip *chip, int l)
+{
+	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
+	int ret = 0;
+
+	mutex_lock(&priv->locality_count_mutex);
+	if (priv->locality_count == 0)
+		ret = __tpm_tis_request_locality(chip, l);
+	if (!ret)
+		priv->locality_count++;
+	mutex_unlock(&priv->locality_count_mutex);
+	return ret;
+}
+
 static u8 tpm_tis_status(struct tpm_chip *chip)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
@@ -638,7 +663,7 @@ static int probe_itpm(struct tpm_chip *chip)
 	if (vendor != TPM_VID_INTEL)
 		return 0;
 
-	if (request_locality(chip, 0) != 0)
+	if (tpm_tis_request_locality(chip, 0) != 0)
 		return -EBUSY;
 
 	rc = tpm_tis_send_data(chip, cmd_getticks, len);
@@ -659,7 +684,7 @@ static int probe_itpm(struct tpm_chip *chip)
 
 out:
 	tpm_tis_ready(chip);
-	release_locality(chip, priv->locality);
+	tpm_tis_relinquish_locality(chip, priv->locality);
 
 	return rc;
 }
@@ -747,14 +772,14 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	}
 	priv->irq = irq;
 
-	rc = request_locality(chip, 0);
+	rc = tpm_tis_request_locality(chip, 0);
 	if (rc < 0)
 		return rc;
 
 	rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality),
 			   &original_int_vec);
 	if (rc < 0) {
-		release_locality(chip, priv->locality);
+		tpm_tis_relinquish_locality(chip, priv->locality);
 		return rc;
 	}
 
@@ -793,7 +818,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 		rc = -1;
 	}
 
-	release_locality(chip, priv->locality);
+	tpm_tis_relinquish_locality(chip, priv->locality);
 
 	return rc;
 }
@@ -909,8 +934,8 @@ static const struct tpm_class_ops tpm_tis = {
 	.req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 	.req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
 	.req_canceled = tpm_tis_req_canceled,
-	.request_locality = request_locality,
-	.relinquish_locality = release_locality,
+	.request_locality = tpm_tis_request_locality,
+	.relinquish_locality = tpm_tis_relinquish_locality,
 	.clk_enable = tpm_tis_clkrun_enable,
 };
 
@@ -944,6 +969,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	priv->timeout_min = TPM_TIMEOUT_USECS_MIN;
 	priv->timeout_max = TPM_TIMEOUT_USECS_MAX;
 	priv->phy_ops = phy_ops;
+	priv->locality_count = 0;
+	mutex_init(&priv->locality_count_mutex);
 
 	dev_set_drvdata(&chip->dev, priv);
 
@@ -990,14 +1017,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
 
-	rc = request_locality(chip, 0);
+	rc = tpm_tis_request_locality(chip, 0);
 	if (rc < 0) {
 		rc = -ENODEV;
 		goto out_err;
 	}
 
 	tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
-	release_locality(chip, 0);
+	tpm_tis_relinquish_locality(chip, 0);
 
 	rc = tpm_chip_start(chip);
 	if (rc)
@@ -1057,13 +1084,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		 * proper timeouts for the driver.
 		 */
 
-		rc = request_locality(chip, 0);
+		rc = tpm_tis_request_locality(chip, 0);
 		if (rc < 0)
 			goto out_err;
 
 		rc = tpm_get_timeouts(chip);
 
-		release_locality(chip, 0);
+		tpm_tis_relinquish_locality(chip, 0);
 
 		if (rc) {
 			dev_err(dev, "Could not get TPM timeouts and durations\n");
@@ -1081,11 +1108,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 			dev_err(&chip->dev, FW_BUG
 					"TPM interrupt not working, polling instead\n");
 
-			rc = request_locality(chip, 0);
+			rc = tpm_tis_request_locality(chip, 0);
 			if (rc < 0)
 				goto out_err;
 			disable_interrupts(chip);
-			release_locality(chip, 0);
+			tpm_tis_relinquish_locality(chip, 0);
 		}
 	}
 
@@ -1158,13 +1185,13 @@ int tpm_tis_resume(struct device *dev)
 	 * an error code but for unknown reason it isn't handled.
 	 */
 	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
-		ret = request_locality(chip, 0);
+		ret = tpm_tis_request_locality(chip, 0);
 		if (ret < 0)
 			return ret;
 
 		tpm1_do_selftest(chip);
 
-		release_locality(chip, 0);
+		tpm_tis_relinquish_locality(chip, 0);
 	}
 
 	return 0;
drivers/char/tpm/tpm_tis_core.h +2 -0
index 3be24f221e32a..464ed352ab2e8 100644
@@ -90,6 +90,8 @@ enum tpm_tis_flags {
 
 struct tpm_tis_data {
 	u16 manufacturer_id;
+	struct mutex locality_count_mutex;
+	unsigned int locality_count;
 	int locality;
 	int irq;
 	bool irq_tested;
Signature · 1 line
2.39.2
author maintainer
#62 lore raw

PATCH 62/371 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 95224345c78e7..dd907809d0b29 100644
@@ -733,29 +733,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
#104 lore raw

PATCH 95/371 arm64: dts: qcom: sdm845: correct dynamic power coefficients

In reply to Greg Kroah-Hartman

From: Dmitry Baryshkov <[email protected]>

[ Upstream commit 0e0a8e35d72533b3eef3365e900baacd7cede8e2 ]

Following sm8150/sm8250 update sdm845 capacity-dmips-mhz and dynamic-power-coefficient based on the measurements [1], [2].

The energy model dynamic-power-coefficient values were calculated with
DPC = µW / MHz / V^2
for each OPP, and averaged across all OPPs within each cluster for the final coefficient. Voltages were obtained from the qcom-cpufreq-hw driver that reads voltages from the OSM LUT programmed into the SoC.

Normalized DMIPS/MHz capacity scale values for each CPU were calculated from CoreMarks/MHz (CoreMark iterations per second per MHz), which serves the same purpose. For each CPU, the final capacity-dmips-mhz value is the C/MHz value of its maximum frequency normalized to SCHED_CAPACITY_SCALE (1024) for the fastest CPU in the system.

For more details on measurement process see the commit message for the commit 6aabed5526ee ("arm64: dts: qcom: sm8250: Add CPU capacities and energy model").

[1] https://github.com/kdrag0n/freqbench
[2] https://github.com/kdrag0n/freqbench/tree/master/results/sdm845/main

---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +12 -12
index ed293f635f145..26849cece1eb9 100644
@@ -196,8 +196,8 @@
 			cpu-idle-states = <&LITTLE_CPU_SLEEP_0
 					   &LITTLE_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			capacity-dmips-mhz = <607>;
-			dynamic-power-coefficient = <100>;
+			capacity-dmips-mhz = <611>;
+			dynamic-power-coefficient = <290>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			operating-points-v2 = <&cpu0_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -221,8 +221,8 @@
 			cpu-idle-states = <&LITTLE_CPU_SLEEP_0
 					   &LITTLE_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			capacity-dmips-mhz = <607>;
-			dynamic-power-coefficient = <100>;
+			capacity-dmips-mhz = <611>;
+			dynamic-power-coefficient = <290>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			operating-points-v2 = <&cpu0_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -243,8 +243,8 @@
 			cpu-idle-states = <&LITTLE_CPU_SLEEP_0
 					   &LITTLE_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			capacity-dmips-mhz = <607>;
-			dynamic-power-coefficient = <100>;
+			capacity-dmips-mhz = <611>;
+			dynamic-power-coefficient = <290>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			operating-points-v2 = <&cpu0_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -265,8 +265,8 @@
 			cpu-idle-states = <&LITTLE_CPU_SLEEP_0
 					   &LITTLE_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			capacity-dmips-mhz = <607>;
-			dynamic-power-coefficient = <100>;
+			capacity-dmips-mhz = <611>;
+			dynamic-power-coefficient = <290>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			operating-points-v2 = <&cpu0_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -288,7 +288,7 @@
 			cpu-idle-states = <&BIG_CPU_SLEEP_0
 					   &BIG_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			dynamic-power-coefficient = <396>;
+			dynamic-power-coefficient = <442>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			operating-points-v2 = <&cpu4_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -310,7 +310,7 @@
 			cpu-idle-states = <&BIG_CPU_SLEEP_0
 					   &BIG_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			dynamic-power-coefficient = <396>;
+			dynamic-power-coefficient = <442>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			operating-points-v2 = <&cpu4_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -332,7 +332,7 @@
 			cpu-idle-states = <&BIG_CPU_SLEEP_0
 					   &BIG_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			dynamic-power-coefficient = <396>;
+			dynamic-power-coefficient = <442>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			operating-points-v2 = <&cpu4_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -354,7 +354,7 @@
 			cpu-idle-states = <&BIG_CPU_SLEEP_0
 					   &BIG_CPU_SLEEP_1
 					   &CLUSTER_SLEEP_0>;
-			dynamic-power-coefficient = <396>;
+			dynamic-power-coefficient = <442>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			operating-points-v2 = <&cpu4_opp_table>;
 			interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
Signature · 1 line
2.39.2
author maintainer
#113 lore raw

PATCH 104/371 ARM: dts: qcom: ipq8064: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit 0b16b34e491629016109e56747ad64588074194b ]

For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI addresses (0x0fe00000, 0x31e00000, 0x35e00000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses.

---
 arch/arm/boot/dts/qcom-ipq8064.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +6 -6
index 8ec927f044c38..f4139411c41ed 100644
@@ -808,8 +808,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000   /* downstream I/O */
-				  0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x0fe00000 0x0 0x00010000   /* I/O */
+				  0x82000000 0x0 0x08000000 0x08000000 0x0 0x07e00000>; /* MEM */
 
 			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
@@ -859,8 +859,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000   /* downstream I/O */
-				  0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x31e00000 0x0 0x00010000   /* I/O */
+				  0x82000000 0x0 0x2e000000 0x2e000000 0x0 0x03e00000>; /* MEM */
 
 			interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
@@ -910,8 +910,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000   /* downstream I/O */
-				  0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x35e00000 0x0 0x00010000   /* I/O */
+				  0x82000000 0x0 0x32000000 0x32000000 0x0 0x03e00000>; /* MEM */
 
 			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
Signature · 1 line
2.39.2
author maintainer
#114 lore raw

PATCH 105/371 x86/MCE/AMD: Use an u64 for bank_map

In reply to Greg Kroah-Hartman

From: Muralidhara M K <[email protected]>

[ Upstream commit 4c1cdec319b9aadb65737c3eb1f5cb74bd6aa156 ]

Thee maximum number of MCA banks is 64 (MAX_NR_BANKS), see

a0bc32b3cacf ("x86/mce: Increase maximum number of banks to 64").

However, the bank_map which contains a bitfield of which banks to initialize is of type unsigned int and that overflows when those bit numbers are >= 32, leading to UBSAN complaining correctly:

  UBSAN: shift-out-of-bounds in arch/x86/kernel/cpu/mce/amd.c:1365:38
  shift exponent 32 is too large for 32-bit type 'int'

Change the bank_map to a u64 and use the proper BIT_ULL() macro when modifying bits in there.

[ bp: Rewrite commit message. ]

Fixes a0bc32b3cacf ("x86/mce: Increase maximum number of banks to 64")
---
 arch/x86/kernel/cpu/mce/amd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/mce/amd.c +7 -7
index 6469d3135d268..d4e75be64a4c5 100644
@@ -210,10 +210,10 @@ static DEFINE_PER_CPU(struct threshold_bank **, threshold_banks);
  * A list of the banks enabled on each logical CPU. Controls which respective
  * descriptors to initialize later in mce_threshold_create_device().
  */
-static DEFINE_PER_CPU(unsigned int, bank_map);
+static DEFINE_PER_CPU(u64, bank_map);
 
 /* Map of banks that have more than MCA_MISC0 available. */
-static DEFINE_PER_CPU(u32, smca_misc_banks_map);
+static DEFINE_PER_CPU(u64, smca_misc_banks_map);
 
 static void amd_threshold_interrupt(void);
 static void amd_deferred_error_interrupt(void);
@@ -242,7 +242,7 @@ static void smca_set_misc_banks_map(unsigned int bank, unsigned int cpu)
 		return;
 
 	if (low & MASK_BLKPTR_LO)
-		per_cpu(smca_misc_banks_map, cpu) |= BIT(bank);
+		per_cpu(smca_misc_banks_map, cpu) |= BIT_ULL(bank);
 
 }
 
@@ -505,7 +505,7 @@ static u32 smca_get_block_address(unsigned int bank, unsigned int block,
 	if (!block)
 		return MSR_AMD64_SMCA_MCx_MISC(bank);
 
-	if (!(per_cpu(smca_misc_banks_map, cpu) & BIT(bank)))
+	if (!(per_cpu(smca_misc_banks_map, cpu) & BIT_ULL(bank)))
 		return 0;
 
 	return MSR_AMD64_SMCA_MCx_MISCy(bank, block - 1);
@@ -549,7 +549,7 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,
 	int new;
 
 	if (!block)
-		per_cpu(bank_map, cpu) |= (1 << bank);
+		per_cpu(bank_map, cpu) |= BIT_ULL(bank);
 
 	memset(&b, 0, sizeof(b));
 	b.cpu			= cpu;
@@ -1061,7 +1061,7 @@ static void amd_threshold_interrupt(void)
 		return;
 
 	for (bank = 0; bank < this_cpu_read(mce_num_banks); ++bank) {
-		if (!(per_cpu(bank_map, cpu) & (1 << bank)))
+		if (!(per_cpu(bank_map, cpu) & BIT_ULL(bank)))
 			continue;
 
 		first_block = bp[bank]->blocks;
@@ -1538,7 +1538,7 @@ int mce_threshold_create_device(unsigned int cpu)
 		return -ENOMEM;
 
 	for (bank = 0; bank < numbanks; ++bank) {
-		if (!(this_cpu_read(bank_map) & (1 << bank)))
+		if (!(this_cpu_read(bank_map) & BIT_ULL(bank)))
 			continue;
 		err = threshold_create_bank(bp, cpu, bank);
 		if (err) {
Signature · 1 line
2.39.2
author maintainer
#115 lore raw

PATCH 106/371 media: bdisp: Add missing check for create_workqueue

In reply to Greg Kroah-Hartman

From: Jiasheng Jiang <[email protected]>

[ Upstream commit 2371adeab717d8fe32144a84f3491a03c5838cfb ]

Add the check for the return value of the create_workqueue in order to avoid NULL pointer dereference.

Fixes 28ffeebbb7bd ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework")
---
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +2 -0
index 6413cd2791251..19a0f12483dba 100644
@@ -1310,6 +1310,8 @@ static int bdisp_probe(struct platform_device *pdev)
 	init_waitqueue_head(&bdisp->irq_queue);
 	INIT_DELAYED_WORK(&bdisp->timeout_work, bdisp_irq_timeout);
 	bdisp->work_queue = create_workqueue(BDISP_NAME);
+	if (!bdisp->work_queue)
+		return -ENOMEM;
 
 	spin_lock_init(&bdisp->slock);
 	mutex_init(&bdisp->lock);
Signature · 1 line
2.39.2
author maintainer
#116 lore raw

PATCH 107/371 media: av7110: prevent underflow in write_ts_to_decoder()

In reply to Greg Kroah-Hartman

From: Dan Carpenter <[email protected]>

[ Upstream commit eed9496a0501357aa326ddd6b71408189ed872eb ]

The buf[4] value comes from the user via ts_play(). It is a value in the u8 range. The final length we pass to av7110_ipack_instant_repack() is "len - (buf[4] + 1) - 4" so add a check to ensure that the length is not negative. It's not clear that passing a negative len value does anything bad necessarily, but it's not best practice.

With the new bounds checking the "if (!len)" condition is no longer possible or required so remove that.

Fixes fd46d16d602a ("V4L/DVB (11759): dvb-ttpci: Add TS replay capability")
---
 drivers/staging/media/av7110/av7110_av.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/av7110/av7110_av.c +2 -2
index 91f4866c7e59b..964092e2f41fd 100644
@@ -823,10 +823,10 @@ static int write_ts_to_decoder(struct av7110 *av7110, int type, const u8 *buf, s
 		av7110_ipack_flush(ipack);
 
 	if (buf[3] & ADAPT_FIELD) {
+		if (buf[4] > len - 1 - 4)
+			return 0;
 		len -= buf[4] + 1;
 		buf += buf[4] + 1;
-		if (!len)
-			return 0;
 	}
 
 	av7110_ipack_instant_repack(buf + 4, len - 4, ipack);
Signature · 1 line
2.39.2
author maintainer
#117 lore raw

PATCH 108/371 firmware: qcom_scm: Clear download bit during reboot

In reply to Greg Kroah-Hartman

From: Mukesh Ojha <[email protected]>

[ Upstream commit 781d32d1c9709fd25655c4e3e3e15370ae4ae4db ]

During normal restart of a system download bit should be cleared irrespective of whether download mode is set or not.

Fixes 8c1b7dc9ba22 ("firmware: qcom: scm: Expose download-mode control")
---
 drivers/firmware/qcom_scm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/firmware/qcom_scm.c +1 -2
index 2b5214d5c0daf..18e1a4b80401c 100644
@@ -1320,8 +1320,7 @@ static int qcom_scm_probe(struct platform_device *pdev)
 static void qcom_scm_shutdown(struct platform_device *pdev)
 {
 	/* Clean shutdown, disable download mode to allow normal restart */
-	if (download_mode)
-		qcom_scm_set_download_mode(false);
+	qcom_scm_set_download_mode(false);
 }
 
 static const struct of_device_id qcom_scm_dt_match[] = {
Signature · 1 line
2.39.2
author maintainer
#118 lore raw

PATCH 109/371 drm/bridge: adv7533: Fix adv7533_mode_valid for adv7533 and adv7535

In reply to Greg Kroah-Hartman

From: Adam Ford <[email protected]>

[ Upstream commit ee0285e13455fdbce5de315bdbe91b5f198a2a06 ]

When dynamically switching lanes was removed, the intent of the code was to check to make sure that higher speed items used 4 lanes, but it had the unintended consequence of removing the slower speeds for 4-lane users.

This attempts to remedy this by doing a check to see that the max frequency doesn't exceed the chip limit, and a second check to make sure that the max bit-rate doesn't exceed the number of lanes * max bit rate / lane.

Fixes 9a0cdcd6649b ("drm/bridge: adv7533: remove dynamic lane switching from adv7533 bridge")
---
 drivers/gpu/drm/bridge/adv7511/adv7533.c | 25 +++++++++++-------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7533.c +11 -14
index 7eda12f338a1d..babc0be0bbb56 100644
@@ -103,22 +103,19 @@ void adv7533_dsi_power_off(struct adv7511 *adv)
 enum drm_mode_status adv7533_mode_valid(struct adv7511 *adv,
 					const struct drm_display_mode *mode)
 {
-	int lanes;
+	unsigned long max_lane_freq;
 	struct mipi_dsi_device *dsi = adv->dsi;
+	u8 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
 
-	if (mode->clock > 80000)
-		lanes = 4;
-	else
-		lanes = 3;
-
-	/*
-	 * TODO: add support for dynamic switching of lanes
-	 * by using the bridge pre_enable() op . Till then filter
-	 * out the modes which shall need different number of lanes
-	 * than what was configured in the device tree.
-	 */
-	if (lanes != dsi->lanes)
-		return MODE_BAD;
+	/* Check max clock for either 7533 or 7535 */
+	if (mode->clock > (adv->type == ADV7533 ? 80000 : 148500))
+		return MODE_CLOCK_HIGH;
+
+	/* Check max clock for each lane */
+	max_lane_freq = (adv->type == ADV7533 ? 800000 : 891000);
+
+	if (mode->clock * bpp > max_lane_freq * adv->num_dsi_lanes)
+		return MODE_CLOCK_HIGH;
 
 	return MODE_OK;
 }
Signature · 1 line
2.39.2
author maintainer
#119 lore raw

PATCH 110/371 media: max9286: Free control handler

In reply to Greg Kroah-Hartman

From: Laurent Pinchart <[email protected]>

[ Upstream commit bfce6a12e5ba1edde95126aa06778027f16115d4 ]

The control handler is leaked in some probe-time error paths, as well as in the remove path. Fix it.

---
 drivers/media/i2c/max9286.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/i2c/max9286.c +1 -0
index b9513e93ac617..404a03f48b976 100644
@@ -937,6 +937,7 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
 static void max9286_v4l2_unregister(struct max9286_priv *priv)
 {
 	fwnode_handle_put(priv->sd.fwnode);
+	v4l2_ctrl_handler_free(&priv->ctrls);
 	v4l2_async_unregister_subdev(&priv->sd);
 	max9286_v4l2_notifier_unregister(priv);
 }
Signature · 1 line
2.39.2
author maintainer
#120 lore raw

PATCH 111/371 drm/msm/adreno: Defer enabling runpm until hw_init()

In reply to Greg Kroah-Hartman

From: Rob Clark <[email protected]>

[ Upstream commit 4b18299b33655fa9672b774b6df774dc03d6aee8 ]

To avoid preventing the display from coming up before the rootfs is mounted, without resorting to packing fw in the initrd, the GPU has this limbo state where the device is probed, but we aren't ready to start sending commands to it. This is particularly problematic for a6xx, since the GMU (which requires fw to be loaded) is the one that is controlling the power/clk/icc votes.

So defer enabling runpm until we are ready to call gpu->hw_init(), as that is a point where we know we have all the needed fw and are ready to start sending commands to the coproc's.

Patchwork: https://patchwork.freedesktop.org/patch/489337/

Stable-dep-of: db7662d076c9 ("drm/msm/adreno: drop bogus pm_runtime_set_active()")

---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++++++
 drivers/gpu/drm/msm/adreno/adreno_gpu.c    | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +6 -0
index 2a6ce76656aa2..32207bc42b281 100644
@@ -398,6 +398,12 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
 	if (ret)
 		return NULL;
 
+	/*
+	 * Now that we have firmware loaded, and are ready to begin
+	 * booting the gpu, go ahead and enable runpm:
+	 */
+	pm_runtime_enable(&pdev->dev);
+
 	/* Make sure pm runtime is active and reset any previous errors */
 	pm_runtime_set_active(&pdev->dev);
 
drivers/gpu/drm/msm/adreno/adreno_gpu.c +0 -1
index 3fa01938f4b29..47a260715a89c 100644
@@ -943,7 +943,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 	pm_runtime_set_autosuspend_delay(dev,
 		adreno_gpu->info->inactive_period);
 	pm_runtime_use_autosuspend(dev);
-	pm_runtime_enable(dev);
 
 	return msm_gpu_init(drm, pdev, &adreno_gpu->base, &funcs->base,
 			adreno_gpu->info->name, &adreno_gpu_config);
Signature · 1 line
2.39.2
author maintainer
#121 lore raw

PATCH 112/371 drm/msm/adreno: drop bogus pm_runtime_set_active()

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

[ Upstream commit db7662d076c973072d788bd0e8130e04430307a1 ]

The runtime PM status can only be updated while runtime PM is disabled.

Drop the bogus pm_runtime_set_active() call that was made after enabling runtime PM and which (incidentally but correctly) left the runtime PM status set to 'suspended'.

Fixes 2c087a336676 ("drm/msm/adreno: Load the firmware before bringing up the hardware")

Patchwork: https://patchwork.freedesktop.org/patch/524972/

---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +0 -3
index 32207bc42b281..3eb9146653444 100644
@@ -404,9 +404,6 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
 	 */
 	pm_runtime_enable(&pdev->dev);
 
-	/* Make sure pm runtime is active and reset any previous errors */
-	pm_runtime_set_active(&pdev->dev);
-
 	ret = pm_runtime_get_sync(&pdev->dev);
 	if (ret < 0) {
 		pm_runtime_put_sync(&pdev->dev);
Signature · 1 line
2.39.2
author maintainer
#122 lore raw

PATCH 113/371 drm: msm: adreno: Disable preemption on Adreno 510

In reply to Greg Kroah-Hartman

From: Adam Skladowski <[email protected]>

[ Upstream commit 010c8bbad2cb8c33c47963e29f051f1e917e45a5 ]

Downstream driver appears to not support preemption on A510 target, trying to use one make device slow and fill log with rings related errors. Set num_rings to 1 to disable preemption.

Fixes e20c9284c8f2 ("drm/msm/adreno: Add support for Adreno 510 GPU")

Patchwork: https://patchwork.freedesktop.org/patch/526898/

---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +7 -1
index b8c49ba65254c..d92416d526286 100644
@@ -1749,6 +1749,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 	struct a5xx_gpu *a5xx_gpu = NULL;
 	struct adreno_gpu *adreno_gpu;
 	struct msm_gpu *gpu;
+	unsigned int nr_rings;
 	int ret;
 
 	if (!pdev) {
@@ -1769,7 +1770,12 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 
 	check_speed_bin(&pdev->dev);
 
-	ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4);
+	nr_rings = 4;
+
+	if (adreno_is_a510(adreno_gpu))
+		nr_rings = 1;
+
+	ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, nr_rings);
 	if (ret) {
 		a5xx_destroy(&(a5xx_gpu->base.base));
 		return ERR_PTR(ret);
Signature · 1 line
2.39.2
author maintainer
#105 lore raw

PATCH 96/371 arm64: dts: qcom: sdm845: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit 67aa109eee654c76dcc100554e637fa64d5aa099 ]

For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI addresses (0x60200000, 0x40200000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses.

Fixes 42ad231338c1 ("arm64: dts: qcom: sdm845: Add second PCIe PHY and controller")
Fixes 5c538e09cb19 ("arm64: dts: qcom: sdm845: Add first PCIe controller and PHY")
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +3 -3
index 26849cece1eb9..a5c6b1635ff6d 100644
@@ -1988,8 +1988,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x01000000 0x0 0x60200000 0 0x60200000 0x0 0x100000>,
-				 <0x02000000 0x0 0x60300000 0 0x60300000 0x0 0xd00000>;
+			ranges = <0x01000000 0x0 0x00000000 0x0 0x60200000 0x0 0x100000>,
+				 <0x02000000 0x0 0x60300000 0x0 0x60300000 0x0 0xd00000>;
 
 			interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
@@ -2093,7 +2093,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x01000000 0x0 0x40200000 0x0 0x40200000 0x0 0x100000>,
+			ranges = <0x01000000 0x0 0x00000000 0x0 0x40200000 0x0 0x100000>,
 				 <0x02000000 0x0 0x40300000 0x0 0x40300000 0x0 0x1fd00000>;
 
 			interrupts = <GIC_SPI 307 IRQ_TYPE_EDGE_RISING>;
Signature · 1 line
2.39.2
author maintainer
#123 lore raw

PATCH 114/371 drm/amd/display/dc/dce60/Makefile: Fix previous attempt to silence known override-init warnings

In reply to Greg Kroah-Hartman

From: Lee Jones <[email protected]>

[ Upstream commit 4082b9f5ead4966797dddcfef0905d59e5a83873 ]

Fixes the following W=1 kernel build warning(s):

drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro ‘mmCRTC1_DCFE_MEM_LIGHT_SLEEP_CNTL’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro ‘SRI’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro ‘XFM_COMMON_REG_LIST_DCE60’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:188:17: note: in expansion of macro ‘transform_regs’ drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:722:43: warning: initialized field overwritten [-Woverride-init] drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro ‘mmCRTC2_DCFE_MEM_LIGHT_SLEEP_CNTL’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro ‘SRI’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro ‘XFM_COMMON_REG_LIST_DCE60’ drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:189:17: note: in expansion of macro ‘transform_regs’ drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:722:43: note: (near initialization for ‘xfm_regs[2].DCFE_MEM_LIGHT_SLEEP_CN

[100 lines snipped for brevity]

Fixes ceb3cf476a441 ("drm/amd/display/dc/dce60/Makefile: Ignore -Woverride-init warning")
Cc Harry Wentland <[email protected]>
Cc Leo Li <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "Pan, Xinhui" <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Mauro Rossi <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dce60/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce60/Makefile +1 -1
index dda596fa1cd76..fee331accc0e7 100644
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
 
 DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
 	dce60_resource.o
Signature · 1 line
2.39.2
author maintainer
#124 lore raw

PATCH 115/371 ACPI: processor: Fix evaluating _PDC method when running as Xen dom0

In reply to Greg Kroah-Hartman

From: Roger Pau Monne <[email protected]>

[ Upstream commit 073828e954459b883f23e53999d31e4c55ab9654 ]

In ACPI systems, the OS can direct power management, as opposed to the firmware. This OS-directed Power Management is called OSPM. Part of telling the firmware that the OS going to direct power management is making ACPI "_PDC" (Processor Driver Capabilities) calls. These _PDC methods must be evaluated for every processor object. If these _PDC calls are not completed for every processor it can lead to inconsistency and later failures in things like the CPU frequency driver.

In a Xen system, the dom0 kernel is responsible for system-wide power management. The dom0 kernel is in charge of OSPM. However, the number of CPUs available to dom0 can be different than the number of CPUs physically present on the system.

This leads to a problem: the dom0 kernel needs to evaluate _PDC for all the processors, but it can't always see them.

In dom0 kernels, ignore the existing ACPI method for determining if a processor is physically present because it might not be accurate. Instead, ask the hypervisor for this information.

Fix this by introducing a custom function to use when running as Xen dom0 in order to check whether a processor object matches a CPU that's online. Such checking is done using the existing information fetched by the Xen pCPU subsystem, extending it to also store the ACPI ID.

This ensures that _PDC method gets evaluated for all physically online CPUs, regardless of the number of CPUs made available to dom0.

Fixes 5d554a7bb064 ("ACPI: processor: add internal processor_physically_present()")
---
 drivers/acpi/processor_pdc.c | 11 +++++++++++
 drivers/xen/pcpu.c           | 20 ++++++++++++++++++++
 include/xen/xen.h            | 11 +++++++++++
 3 files changed, 42 insertions(+)
drivers/acpi/processor_pdc.c +11 -0
index 8c3f82c9fff35..18fb04523f93b 100644
@@ -14,6 +14,8 @@
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 
+#include <xen/xen.h>
+
 #include "internal.h"
 
 static bool __init processor_physically_present(acpi_handle handle)
@@ -47,6 +49,15 @@ static bool __init processor_physically_present(acpi_handle handle)
 		return false;
 	}
 
+	if (xen_initial_domain())
+		/*
+		 * When running as a Xen dom0 the number of processors Linux
+		 * sees can be different from the real number of processors on
+		 * the system, and we still need to execute _PDC for all of
+		 * them.
+		 */
+		return xen_processor_present(acpi_id);
+
 	type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
 	cpuid = acpi_get_cpuid(handle, type, acpi_id);
 
drivers/xen/pcpu.c +20 -0
index fd3a644b08559..b3e3d1bb37f3e 100644
@@ -58,6 +58,7 @@ struct pcpu {
 	struct list_head list;
 	struct device dev;
 	uint32_t cpu_id;
+	uint32_t acpi_id;
 	uint32_t flags;
 };
 
@@ -249,6 +250,7 @@ static struct pcpu *create_and_register_pcpu(struct xenpf_pcpuinfo *info)
 
 	INIT_LIST_HEAD(&pcpu->list);
 	pcpu->cpu_id = info->xen_cpuid;
+	pcpu->acpi_id = info->acpi_id;
 	pcpu->flags = info->flags;
 
 	/* Need hold on xen_pcpu_lock before pcpu list manipulations */
@@ -381,3 +383,21 @@ static int __init xen_pcpu_init(void)
 	return ret;
 }
 arch_initcall(xen_pcpu_init);
+
+#ifdef CONFIG_ACPI
+bool __init xen_processor_present(uint32_t acpi_id)
+{
+	const struct pcpu *pcpu;
+	bool online = false;
+
+	mutex_lock(&xen_pcpu_lock);
+	list_for_each_entry(pcpu, &xen_pcpus, list)
+		if (pcpu->acpi_id == acpi_id) {
+			online = pcpu->flags & XEN_PCPU_FLAGS_ONLINE;
+			break;
+		}
+	mutex_unlock(&xen_pcpu_lock);
+
+	return online;
+}
+#endif
include/xen/xen.h +11 -0
index 43efba045acc7..5a6a2ab675bed 100644
@@ -61,4 +61,15 @@ void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
 #include <xen/balloon.h>
 #endif
 
+#if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) && defined(CONFIG_X86)
+bool __init xen_processor_present(uint32_t acpi_id);
+#else
+#include <linux/bug.h>
+static inline bool xen_processor_present(uint32_t acpi_id)
+{
+	BUG();
+	return false;
+}
+#endif
+
 #endif	/* _XEN_XEN_H */
Signature · 1 line
2.39.2
author maintainer
#125 lore raw

PATCH 116/371 mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data

In reply to Greg Kroah-Hartman

From: Georgii Kruglov <[email protected]>

[ Upstream commit 0dd8316037a2a6d85b2be208bef9991de7b42170 ]

If spec_reg is equal to 'SDHCI_PRESENT_STATE', esdhc_readl_fixup() fixes up register value and returns it immediately. As a result, the further block
(spec_reg == SDHCI_PRESENT_STATE)

    &&(esdhc->quirk_ignore_data_inhibit == true),

is never executed.

The patch merges the second block into the first one.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 1f1929f3f2fa ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
---
 drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +11 -13
index 04a37fd137ee1..ea9bb545b1a21 100644
@@ -126,6 +126,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 			return ret;
 		}
 	}
+
 	/*
 	 * The DAT[3:0] line signal levels and the CMD line signal level are
 	 * not compatible with standard SDHC register. The line signal levels
@@ -137,6 +138,16 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 		ret = value & 0x000fffff;
 		ret |= (value >> 4) & SDHCI_DATA_LVL_MASK;
 		ret |= (value << 1) & SDHCI_CMD_LVL;
+
+		/*
+		 * Some controllers have unreliable Data Line Active
+		 * bit for commands with busy signal. This affects
+		 * Command Inhibit (data) bit. Just ignore it since
+		 * MMC core driver has already polled card status
+		 * with CMD13 after any command with busy siganl.
+		 */
+		if (esdhc->quirk_ignore_data_inhibit)
+			ret &= ~SDHCI_DATA_INHIBIT;
 		return ret;
 	}
 
@@ -151,19 +162,6 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 		return ret;
 	}
 
-	/*
-	 * Some controllers have unreliable Data Line Active
-	 * bit for commands with busy signal. This affects
-	 * Command Inhibit (data) bit. Just ignore it since
-	 * MMC core driver has already polled card status
-	 * with CMD13 after any command with busy siganl.
-	 */
-	if ((spec_reg == SDHCI_PRESENT_STATE) &&
-	(esdhc->quirk_ignore_data_inhibit == true)) {
-		ret = value & ~SDHCI_DATA_INHIBIT;
-		return ret;
-	}
-
 	ret = value;
 	return ret;
 }
Signature · 1 line
2.39.2
author maintainer
#126 lore raw

PATCH 117/371 drm: rcar-du: Fix a NULL vs IS_ERR() bug

In reply to Greg Kroah-Hartman

From: Dan Carpenter <[email protected]>

[ Upstream commit 40f43730f43699ce8557e4fe59622d4f4b69f44a ]

The drmm_encoder_alloc() function returns error pointers. It never returns NULL. Fix the check accordingly.

Fixes 7a1adbd23990 ("drm: rcar-du: Use drmm_encoder_alloc() to manage encoder")
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_encoder.c +2 -2
index 4bf4e25d7f011..6bc0c4e6cd965 100644
@@ -109,8 +109,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 	renc = drmm_encoder_alloc(&rcdu->ddev, struct rcar_du_encoder, base,
 				  &rcar_du_encoder_funcs, DRM_MODE_ENCODER_NONE,
 				  NULL);
-	if (!renc)
-		return -ENOMEM;
+	if (IS_ERR(renc))
+		return PTR_ERR(renc);
 
 	renc->output = output;
 
Signature · 1 line
2.39.2
author maintainer
#127 lore raw

PATCH 118/371 ARM: dts: gta04: fix excess dma channel usage

In reply to Greg Kroah-Hartman

From: H. Nikolaus Schaller <[email protected]>

[ Upstream commit a622310f7f0185da02e42cdb06475f533efaae60 ]

OMAP processors support 32 channels but there is no check or inspect this except booting a device and looking at dmesg reports of not available channels.

Recently some more subsystems with DMA (aes1+2) were added filling the list of dma channels beyond the limit of 32 (even if other parameters indicate 96 or 128 channels). This leads to random subsystem failures i(e.g. mcbsp for audio) after boot or boot messages that DMA can not be initialized.

Another symptom is that

/sys/kernel/debug/dmaengine/summary

has 32 entries and does not show all required channels.

Fix by disabling unused (on the GTA04 hardware) mcspi1...4. Each SPI channel allocates 4 DMA channels rapidly filling the available ones.

Disabling unused SPI modules on the OMAP3 SoC may also save some energy (has not been checked).

Fixes c312f066314e ("ARM: dts: omap3: Migrate AES from hwmods to sysc-omap2")
[re-enabled aes2, improved commit subject line]

Message-Id: <[email protected]>

---
 arch/arm/boot/dts/omap3-gta04.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/omap3-gta04.dtsi +16 -0
index 3923b38e798d0..bb5e00b36d8dc 100644
@@ -609,6 +609,22 @@
 	clock-frequency = <100000>;
 };
 
+&mcspi1 {
+	status = "disabled";
+};
+
+&mcspi2 {
+	status = "disabled";
+};
+
+&mcspi3 {
+	status = "disabled";
+};
+
+&mcspi4 {
+	status = "disabled";
+};
+
 &usb_otg_hs {
 	interface-type = <0>;
 	usb-phy = <&usb2_phy>;
Signature · 1 line
2.39.2
author maintainer
#128 lore raw

PATCH 119/371 firmware: arm_scmi: Fix xfers allocation on Rx channel

In reply to Greg Kroah-Hartman

From: Cristian Marussi <[email protected]>

[ Upstream commit b2ccba9e8cdc6fb3985cc227844e7c6af309ffb1 ]

Two distinct pools of xfer descriptors are allocated at initialization
time: one (Tx) used to provide xfers to track commands and their replies (or delayed replies) and another (Rx) to pick xfers from to be used for processing notifications.

Such pools, though, are allocated globally to be used by the whole SCMI instance, they are not allocated per-channel and as such the allocation of notifications xfers cannot be simply skipped if no Rx channel was found for the base protocol common channel, because there could be defined more optional per-protocol dedicated channels that instead support Rx channels.

Change the conditional check to skip allocation for the notification pool only if no Rx channel has been detected on any per-channel protocol at all.

Fixes 4ebd8f6dea81 ("firmware: arm_scmi: Add receive buffer support for notifications")
---
 drivers/firmware/arm_scmi/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/driver.c +1 -1
index 11842497b2261..7ccda7d720a19 100644
@@ -1463,7 +1463,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
 		return ret;
 
 	ret = __scmi_xfer_info_init(sinfo, &sinfo->tx_minfo);
-	if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE))
+	if (!ret && !idr_is_empty(&sinfo->rx_idr))
 		ret = __scmi_xfer_info_init(sinfo, &sinfo->rx_minfo);
 
 	return ret;
Signature · 1 line
2.39.2
author maintainer
#129 lore raw

PATCH 120/371 ACPI: VIOT: Initialize the correct IOMMU fwspec

In reply to Greg Kroah-Hartman

From: Jean-Philippe Brucker <[email protected]>

[ Upstream commit 47d26684185d09e083669bbbd0c465ab3493a51f ]

When setting up DMA for a PCI device, we need to initialize its iommu_fwspec with all possible alias RIDs (such as PCI bridges). To do this we use pci_for_each_dma_alias() which calls viot_pci_dev_iommu_init(). This function incorrectly initializes the fwspec of the bridge instead of the device being configured. Fix it by passing the original device as context to pci_for_each_dma_alias().

---
 drivers/acpi/viot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/viot.c +3 -2
index 647f11cf165d7..fe4b66dae01b5 100644
@@ -329,6 +329,7 @@ static int viot_pci_dev_iommu_init(struct pci_dev *pdev, u16 dev_id, void *data)
 {
 	u32 epid;
 	struct viot_endpoint *ep;
+	struct device *aliased_dev = data;
 	u32 domain_nr = pci_domain_nr(pdev->bus);
 
 	list_for_each_entry(ep, &viot_pci_ranges, list) {
@@ -339,7 +340,7 @@ static int viot_pci_dev_iommu_init(struct pci_dev *pdev, u16 dev_id, void *data)
 			epid = ((domain_nr - ep->segment_start) << 16) +
 				dev_id - ep->bdf_start + ep->endpoint_id;
 
-			return viot_dev_iommu_init(&pdev->dev, ep->viommu,
+			return viot_dev_iommu_init(aliased_dev, ep->viommu,
 						   epid);
 		}
 	}
@@ -373,7 +374,7 @@ int viot_iommu_configure(struct device *dev)
 {
 	if (dev_is_pci(dev))
 		return pci_for_each_dma_alias(to_pci_dev(dev),
-					      viot_pci_dev_iommu_init, NULL);
+					      viot_pci_dev_iommu_init, dev);
 	else if (dev_is_platform(dev))
 		return viot_mmio_dev_iommu_init(to_platform_device(dev));
 	return -ENODEV;
Signature · 1 line
2.39.2
author maintainer
#130 lore raw

PATCH 121/371 drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()

In reply to Greg Kroah-Hartman

From: Harshit Mogalapalli <[email protected]>

[ Upstream commit c5647cae2704e58d1c4e5fedbf63f11bca6376c9 ]

Smatch reports:
drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
missing unwind goto?

Store return value in err and goto 'err_out0' which has lima_sched_slab_fini() before returning.

---
 drivers/gpu/drm/lima/lima_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/lima/lima_drv.c +4 -2
index 7b8d7178d09aa..39cab4a55f572 100644
@@ -392,8 +392,10 @@ static int lima_pdev_probe(struct platform_device *pdev)
 
 	/* Allocate and initialize the DRM device. */
 	ddev = drm_dev_alloc(&lima_drm_driver, &pdev->dev);
-	if (IS_ERR(ddev))
-		return PTR_ERR(ddev);
+	if (IS_ERR(ddev)) {
+		err = PTR_ERR(ddev);
+		goto err_out0;
+	}
 
 	ddev->dev_private = ldev;
 	ldev->ddev = ddev;
Signature · 1 line
2.39.2
author maintainer
#131 lore raw

PATCH 122/371 mailbox: mpfs: switch to txdone_poll

In reply to Greg Kroah-Hartman

From: Conor Dooley <[email protected]>

[ Upstream commit b5984a9844fc45cd301a28fb56f3de95f7e20f3c ]

The system controller on PolarFire SoC has no interrupt to signify that the TX has been completed. The interrupt instead signals that a service requested by the mailbox client has succeeded. If a service fails, there will be no interrupt delivered.

Switch to polling the busy register to determine whether transmission has completed.

Fixes 83d7b1560810 ("mbox: add polarfire soc system controller mailbox")
---
 drivers/mailbox/mailbox-mpfs.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mailbox/mailbox-mpfs.c +10 -2
index 853901acaeec2..08aa840cccaca 100644
@@ -79,6 +79,13 @@ static bool mpfs_mbox_busy(struct mpfs_mbox *mbox)
 	return status & SCB_STATUS_BUSY_MASK;
 }
 
+static bool mpfs_mbox_last_tx_done(struct mbox_chan *chan)
+{
+	struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv;
+
+	return !mpfs_mbox_busy(mbox);
+}
+
 static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data)
 {
 	struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv;
@@ -182,7 +189,6 @@ static irqreturn_t mpfs_mbox_inbox_isr(int irq, void *data)
 
 	mpfs_mbox_rx_data(chan);
 
-	mbox_chan_txdone(chan, 0);
 	return IRQ_HANDLED;
 }
 
@@ -212,6 +218,7 @@ static const struct mbox_chan_ops mpfs_mbox_ops = {
 	.send_data = mpfs_mbox_send_data,
 	.startup = mpfs_mbox_startup,
 	.shutdown = mpfs_mbox_shutdown,
+	.last_tx_done = mpfs_mbox_last_tx_done,
 };
 
 static int mpfs_mbox_probe(struct platform_device *pdev)
@@ -247,7 +254,8 @@ static int mpfs_mbox_probe(struct platform_device *pdev)
 	mbox->controller.num_chans = 1;
 	mbox->controller.chans = mbox->chans;
 	mbox->controller.ops = &mpfs_mbox_ops;
-	mbox->controller.txdone_irq = true;
+	mbox->controller.txdone_poll = true;
+	mbox->controller.txpoll_period = 10u;
 
 	ret = devm_mbox_controller_register(&pdev->dev, &mbox->controller);
 	if (ret) {
Signature · 1 line
2.39.2
author maintainer
#132 lore raw

PATCH 123/371 arm64: dts: qcom: sc7180-trogdor-lazor: correct trackpad supply

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

[ Upstream commit 52e2996f253d82520011340d40dbc1c76ea79208 ]

The hid-over-i2c takes VDD, not VCC supply. Fix copy-pasta from other boards which use elan,ekth3000 with valid VCC:

sc7180-trogdor-lazor-limozeen-nots-r4.dtb: trackpad@2c: 'vcc-supply' does not match any of the regexes: 'pinctrl-[0-9]+'

---
 .../boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r4.dts     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r4.dts +1 -1
index 6ebde0828550c..8a98a6f849c4f 100644
@@ -26,7 +26,7 @@
 		interrupt-parent = <&tlmm>;
 		interrupts = <58 IRQ_TYPE_EDGE_FALLING>;
 
-		vcc-supply = <&pp3300_fp_tp>;
+		vdd-supply = <&pp3300_fp_tp>;
 		hid-descr-addr = <0x20>;
 
 		wakeup-source;
Signature · 1 line
2.39.2
author maintainer
#106 lore raw

PATCH 97/371 arm64: dts: qcom: msm8998: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit c30a27dcfe4545edbda1578b3a63ed6147519cdd ]

For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI address (0x1b200000) specified in the ranges property for I/O region.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -1
index 5ddf9fa904aba..b7d72b0d579e4 100644
@@ -951,7 +951,7 @@
 			phy-names = "pciephy";
 			status = "disabled";
 
-			ranges = <0x01000000 0x0 0x1b200000 0x1b200000 0x0 0x100000>,
+			ranges = <0x01000000 0x0 0x00000000 0x1b200000 0x0 0x100000>,
 				 <0x02000000 0x0 0x1b300000 0x1b300000 0x0 0xd00000>;
 
 			#interrupt-cells = <1>;
Signature · 1 line
2.39.2
author maintainer
#133 lore raw

PATCH 124/371 arm64: dts: qcom: msm8994-kitakami: drop unit address from PMI8994 regulator

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

[ Upstream commit 3555dd528ba9c08d6ccd56239c695dbeac3b63e3 ]

The PMIC regulators are not supposed to have unit addresses.

Fixes e9783584c9b7 ("arm64: dts: qcom: msm8994-kitakami: Add VDD_GFX regulator")
---
 arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi +1 -2
index 48de66bf19c4c..55198190bbeaa 100644
@@ -183,8 +183,7 @@
 	 * power domain.. which still isn't enough and forces us to bind
 	 * OXILI_CX and OXILI_GX together!
 	 */
-	vdd_gfx: s2@1700 {
-		reg = <0x1700 0x100>;
+	vdd_gfx: s2 {
 		regulator-name = "VDD_GFX";
 		regulator-min-microvolt = <980000>;
 		regulator-max-microvolt = <980000>;
Signature · 1 line
2.39.2
author maintainer
#134 lore raw

PATCH 125/371 arm64: dts: qcom: msm8994-msft-lumia-octagon: drop unit address from PMI8994 regulator

In reply to Greg Kroah-Hartman

From: Krzysztof Kozlowski <[email protected]>

[ Upstream commit 7a202df0f3eed006e4a9e7c06d62cf67be56c14c ]

The PMIC regulators are not supposed to have unit addresses.

Fixes 60b214effb80 ("arm64: dts: qcom: msm8994-octagon: Configure regulators")
---
 arch/arm64/boot/dts/qcom/msm8994-msft-lumia-octagon.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994-msft-lumia-octagon.dtsi +1 -2
index 3a3790a52a2ce..e2d08915ec426 100644
@@ -540,8 +540,7 @@
 };
 
 &pmi8994_spmi_regulators {
-	vdd_gfx: s2@1700 {
-		reg = <0x1700 0x100>;
+	vdd_gfx: s2 {
 		regulator-min-microvolt = <980000>;
 		regulator-max-microvolt = <980000>;
 	};
Signature · 1 line
2.39.2
author maintainer
#107 lore raw

PATCH 98/371 arm64: dts: qcom: ipq8074: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit e49eafefe5ab325e38dd074f2005076ffc271e54 ]

For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI addresses (0x10200000, 0x20200000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses and align them in a single line.

---
 arch/arm64/boot/dts/qcom/ipq8074.dtsi | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +4 -8
index 68e82c755986c..17eeff106bab7 100644
@@ -661,10 +661,8 @@
 			phys = <&pcie_phy1>;
 			phy-names = "pciephy";
 
-			ranges = <0x81000000 0 0x10200000 0x10200000
-				  0 0x10000>,   /* downstream I/O */
-				 <0x82000000 0 0x10220000 0x10220000
-				  0 0xfde0000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x10200000 0x0 0x10000>,   /* I/O */
+				 <0x82000000 0x0 0x10220000 0x10220000 0x0 0xfde0000>; /* MEM */
 
 			interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
@@ -725,10 +723,8 @@
 			phys = <&pcie_phy0>;
 			phy-names = "pciephy";
 
-			ranges = <0x81000000 0 0x20200000 0x20200000
-				  0 0x10000>, /* downstream I/O */
-				 <0x82000000 0 0x20220000 0x20220000
-				  0 0xfde0000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x20200000 0x0 0x10000>,   /* I/O */
+				 <0x82000000 0x0 0x20220000 0x20220000 0x0 0xfde0000>; /* MEM */
 
 			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
Signature · 1 line
2.39.2
author maintainer
#108 lore raw

PATCH 99/371 arm64: dts: qcom: ipq6018: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit 75a6e1fdb351189f55097741e8460ca3f9b2883f ]

For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI address (0x20200000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses.

---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/ipq6018.dtsi +2 -4
@@ -433,10 +433,8 @@
 			phys = <&pcie_phy0>;
 			phy-names = "pciephy";
 
-			ranges = <0x81000000 0 0x20200000 0 0x20200000
-				  0 0x10000>, /* downstream I/O */
-				 <0x82000000 0 0x20220000 0 0x20220000
-				  0 0xfde0000>; /* non-prefetchable memory */
+			ranges = <0x81000000 0x0 0x00000000 0x0 0x20200000 0x0 0x10000>,
+				 <0x82000000 0x0 0x20220000 0x0 0x20220000 0x0 0xfde0000>;
 
 			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
author maintainer
#109 lore raw

PATCH 100/371 arm64: dts: qcom: msm8996: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit cf0ac10feb17661987d0018eb9475dc03e2a2253 ]

For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI addresses (0x0c200000, 0x0d200000, 0x0e200000) specified in the ranges property for I/O region.

While at it, let's also align the entries.

---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +6 -6
index 40174220e8e28..b22d3c8db3b39 100644
@@ -1555,8 +1555,8 @@
 
 				#address-cells = <3>;
 				#size-cells = <2>;
-				ranges = <0x01000000 0x0 0x0c200000 0x0c200000 0x0 0x100000>,
-					<0x02000000 0x0 0x0c300000 0x0c300000 0x0 0xd00000>;
+				ranges = <0x01000000 0x0 0x00000000 0x0c200000 0x0 0x100000>,
+					 <0x02000000 0x0 0x0c300000 0x0c300000 0x0 0xd00000>;
 
 				device_type = "pci";
 
@@ -1609,8 +1609,8 @@
 
 				#address-cells = <3>;
 				#size-cells = <2>;
-				ranges = <0x01000000 0x0 0x0d200000 0x0d200000 0x0 0x100000>,
-					<0x02000000 0x0 0x0d300000 0x0d300000 0x0 0xd00000>;
+				ranges = <0x01000000 0x0 0x00000000 0x0d200000 0x0 0x100000>,
+					 <0x02000000 0x0 0x0d300000 0x0d300000 0x0 0xd00000>;
 
 				device_type = "pci";
 
@@ -1660,8 +1660,8 @@
 
 				#address-cells = <3>;
 				#size-cells = <2>;
-				ranges = <0x01000000 0x0 0x0e200000 0x0e200000 0x0 0x100000>,
-					<0x02000000 0x0 0x0e300000 0x0e300000 0x0 0x1d00000>;
+				ranges = <0x01000000 0x0 0x00000000 0x0e200000 0x0 0x100000>,
+					 <0x02000000 0x0 0x0e300000 0x0e300000 0x0 0x1d00000>;
 
 				device_type = "pci";
 
Signature · 1 line
2.39.2
author maintainer
#110 lore raw

PATCH 101/371 arm64: dts: qcom: sm8250: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit e115a4495db687898b8d91d4f16c2cf55bbf167c ]

For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI addresses (0x60200000, 0x40200000, 0x64200000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses.

---
 arch/arm64/boot/dts/qcom/sm8250.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +4 -4
index 4e3b772a8bded..181e32b8a2728 100644
@@ -1393,8 +1393,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x01000000 0x0 0x60200000 0 0x60200000 0x0 0x100000>,
-				 <0x02000000 0x0 0x60300000 0 0x60300000 0x0 0x3d00000>;
+			ranges = <0x01000000 0x0 0x00000000 0x0 0x60200000 0x0 0x100000>,
+				 <0x02000000 0x0 0x60300000 0x0 0x60300000 0x0 0x3d00000>;
 
 			interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
@@ -1494,7 +1494,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x01000000 0x0 0x40200000 0x0 0x40200000 0x0 0x100000>,
+			ranges = <0x01000000 0x0 0x00000000 0x0 0x40200000 0x0 0x100000>,
 				 <0x02000000 0x0 0x40300000 0x0 0x40300000 0x0 0x1fd00000>;
 
 			interrupts = <GIC_SPI 307 IRQ_TYPE_LEVEL_HIGH>;
@@ -1602,7 +1602,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x01000000 0x0 0x64200000 0x0 0x64200000 0x0 0x100000>,
+			ranges = <0x01000000 0x0 0x00000000 0x0 0x64200000 0x0 0x100000>,
 				 <0x02000000 0x0 0x64300000 0x0 0x64300000 0x0 0x3d00000>;
 
 			interrupts = <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.39.2
author maintainer
#111 lore raw

PATCH 102/371 ARM: dts: qcom: ipq4019: Fix the PCI I/O port range

In reply to Greg Kroah-Hartman

From: Manivannan Sadhasivam <[email protected]>

[ Upstream commit 2540279e9a9e74fc880d1e4c83754ecfcbe290a0 ]

For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI address (0x40200000) specified in the ranges property for I/O region.

While at it, let's use the missing 0x prefix for the addresses.

---
 arch/arm/boot/dts/qcom-ipq4019.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -2
index 08bc5f46649dd..9dcf308b3ad49 100644
@@ -424,8 +424,8 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000>,
-				 <0x82000000 0 0x40300000 0x40300000 0 0x00d00000>;
+			ranges = <0x81000000 0x0 0x00000000 0x40200000 0x0 0x00100000>,
+				 <0x82000000 0x0 0x40300000 0x40300000 0x0 0x00d00000>;
 
 			interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "msi";
Signature · 1 line
2.39.2
author maintainer
#112 lore raw

PATCH 103/371 ARM: dts: qcom: ipq8064: reduce pci IO size to 64K

In reply to Greg Kroah-Hartman

From: Christian Marangi <[email protected]>

[ Upstream commit 8fafb7e5c041814876266259e5e439f93571dcef ]

The current value for pci IO is problematic for ath10k wifi card commonly connected to ipq8064 SoC.
The current value is probably a typo and is actually uncommon to find 1MB IO space even on a x86 arch. Also with recent changes to the pci driver, pci1 and pci2 now fails to function as any connected device fails any reg read/write. Reduce this to 64K as it should be more than enough and 3 * 64K of total IO space doesn't exceed the IO_SPACE_LIMIT hardcoded for the ARM arch.

Stable-dep-of: 0b16b34e4916 ("ARM: dts: qcom: ipq8064: Fix the PCI I/O port range")

---
 arch/arm/boot/dts/qcom-ipq8064.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +3 -3
index 4139d3817bd6f..8ec927f044c38 100644
@@ -808,7 +808,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00100000   /* downstream I/O */
+			ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000   /* downstream I/O */
 				  0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */
 
 			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
@@ -859,7 +859,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00100000   /* downstream I/O */
+			ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000   /* downstream I/O */
 				  0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */
 
 			interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
@@ -910,7 +910,7 @@
 			#address-cells = <3>;
 			#size-cells = <2>;
 
-			ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00100000   /* downstream I/O */
+			ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000   /* downstream I/O */
 				  0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */
 
 			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.39.2
author maintainer
#103 lore raw

PATCH 94/371 arm64: dts: qcom: msm8998: Fix stm-stimulus-base reg name

In reply to Greg Kroah-Hartman

From: Konrad Dybcio <[email protected]>

[ Upstream commit b5d08f08377218b1d2ab4026e427a7788b271c8e ]

The name stm-data-base comes from ancient (msm-3.10 or older) downstream kernels. Upstream uses stm-stimulus-base instead. Fix it.

Fixes 783abfa2249a ("arm64: dts: qcom: msm8998: Add Coresight support")
---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -1
index 5350b911f4f6c..5ddf9fa904aba 100644
@@ -1473,7 +1473,7 @@
 			compatible = "arm,coresight-stm", "arm,primecell";
 			reg = <0x06002000 0x1000>,
 			      <0x16280000 0x180000>;
-			reg-names = "stm-base", "stm-data-base";
+			reg-names = "stm-base", "stm-stimulus-base";
 			status = "disabled";
 
 			clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
Signature · 1 line
2.39.2
author maintainer
#136 lore raw

PATCH 127/371 drm/ttm/pool: Fix ttm_pool_alloc error path

In reply to Greg Kroah-Hartman

From: Thomas Hellström <[email protected]>

[ Upstream commit 379989e7cbdc7aa7496a00ee286ec146c7599cf0 ]

When hitting an error, the error path forgot to unmap dma mappings and could call set_pages_wb() on already uncached pages.

Fix this by introducing a common ttm_pool_free_range() function that does the right thing.

v2:
- Simplify that common function (Christian König)
v3:
- Rename that common function to ttm_pool_free_range() (Christian König)

Fixes d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
Cc Christian König <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 81 +++++++++++++++++++++-------------
 1 file changed, 51 insertions(+), 30 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +51 -30
index 603b044833048..aa3512af051ad 100644
@@ -367,6 +367,43 @@ static int ttm_pool_page_allocated(struct ttm_pool *pool, unsigned int order,
 	return 0;
 }
 
+/**
+ * ttm_pool_free_range() - Free a range of TTM pages
+ * @pool: The pool used for allocating.
+ * @tt: The struct ttm_tt holding the page pointers.
+ * @caching: The page caching mode used by the range.
+ * @start_page: index for first page to free.
+ * @end_page: index for last page to free + 1.
+ *
+ * During allocation the ttm_tt page-vector may be populated with ranges of
+ * pages with different attributes if allocation hit an error without being
+ * able to completely fulfill the allocation. This function can be used
+ * to free these individual ranges.
+ */
+static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt,
+				enum ttm_caching caching,
+				pgoff_t start_page, pgoff_t end_page)
+{
+	struct page **pages = tt->pages;
+	unsigned int order;
+	pgoff_t i, nr;
+
+	for (i = start_page; i < end_page; i += nr, pages += nr) {
+		struct ttm_pool_type *pt = NULL;
+
+		order = ttm_pool_page_order(pool, *pages);
+		nr = (1UL << order);
+		if (tt->dma_address)
+			ttm_pool_unmap(pool, tt->dma_address[i], nr);
+
+		pt = ttm_pool_select_type(pool, caching, order);
+		if (pt)
+			ttm_pool_type_give(pt, *pages);
+		else
+			ttm_pool_free_page(pool, caching, order, *pages);
+	}
+}
+
 /**
  * ttm_pool_alloc - Fill a ttm_tt object
  *
@@ -382,12 +419,14 @@ static int ttm_pool_page_allocated(struct ttm_pool *pool, unsigned int order,
 int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 		   struct ttm_operation_ctx *ctx)
 {
-	unsigned long num_pages = tt->num_pages;
+	pgoff_t num_pages = tt->num_pages;
 	dma_addr_t *dma_addr = tt->dma_address;
 	struct page **caching = tt->pages;
 	struct page **pages = tt->pages;
+	enum ttm_caching page_caching;
 	gfp_t gfp_flags = GFP_USER;
-	unsigned int i, order;
+	pgoff_t caching_divide;
+	unsigned int order;
 	struct page *p;
 	int r;
 
@@ -410,6 +449,7 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 	     order = min_t(unsigned int, order, __fls(num_pages))) {
 		struct ttm_pool_type *pt;
 
+		page_caching = tt->caching;
 		pt = ttm_pool_select_type(pool, tt->caching, order);
 		p = pt ? ttm_pool_type_take(pt) : NULL;
 		if (p) {
@@ -418,6 +458,7 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 			if (r)
 				goto error_free_page;
 
+			caching = pages;
 			do {
 				r = ttm_pool_page_allocated(pool, order, p,
 							    &dma_addr,
@@ -426,14 +467,15 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 				if (r)
 					goto error_free_page;
 
+				caching = pages;
 				if (num_pages < (1 << order))
 					break;
 
 				p = ttm_pool_type_take(pt);
 			} while (p);
-			caching = pages;
 		}
 
+		page_caching = ttm_cached;
 		while (num_pages >= (1 << order) &&
 		       (p = ttm_pool_alloc_page(pool, gfp_flags, order))) {
 
@@ -442,6 +484,7 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 							   tt->caching);
 				if (r)
 					goto error_free_page;
+				caching = pages;
 			}
 			r = ttm_pool_page_allocated(pool, order, p, &dma_addr,
 						    &num_pages, &pages);
@@ -468,15 +511,13 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 	return 0;
 
 error_free_page:
-	ttm_pool_free_page(pool, tt->caching, order, p);
+	ttm_pool_free_page(pool, page_caching, order, p);
 
 error_free_all:
 	num_pages = tt->num_pages - num_pages;
-	for (i = 0; i < num_pages; ) {
-		order = ttm_pool_page_order(pool, tt->pages[i]);
-		ttm_pool_free_page(pool, tt->caching, order, tt->pages[i]);
-		i += 1 << order;
-	}
+	caching_divide = caching - tt->pages;
+	ttm_pool_free_range(pool, tt, tt->caching, 0, caching_divide);
+	ttm_pool_free_range(pool, tt, ttm_cached, caching_divide, num_pages);
 
 	return r;
 }
@@ -492,27 +533,7 @@ EXPORT_SYMBOL(ttm_pool_alloc);
  */
 void ttm_pool_free(struct ttm_pool *pool, struct ttm_tt *tt)
 {
-	unsigned int i;
-
-	for (i = 0; i < tt->num_pages; ) {
-		struct page *p = tt->pages[i];
-		unsigned int order, num_pages;
-		struct ttm_pool_type *pt;
-
-		order = ttm_pool_page_order(pool, p);
-		num_pages = 1ULL << order;
-		if (tt->dma_address)
-			ttm_pool_unmap(pool, tt->dma_address[i], num_pages);
-
-		pt = ttm_pool_select_type(pool, tt->caching, order);
-		if (pt)
-			ttm_pool_type_give(pt, tt->pages[i]);
-		else
-			ttm_pool_free_page(pool, tt->caching, order,
-					   tt->pages[i]);
-
-		i += num_pages;
-	}
+	ttm_pool_free_range(pool, tt, tt->caching, 0, tt->num_pages);
 
 	while (atomic_long_read(&allocated_pages) > page_pool_size)
 		ttm_pool_shrink();
Signature · 1 line
2.39.2
author maintainer
#145 lore raw

PATCH 136/371 platform: Provide a remove callback that returns no value

In reply to Greg Kroah-Hartman

From: Uwe Kleine-König <[email protected]>

[ Upstream commit 5c5a7680e67ba6fbbb5f4d79fa41485450c1985c ]

struct platform_driver::remove returning an integer made driver authors expect that returning an error code was proper error handling. However the driver core ignores the error and continues to remove the device because there is nothing the core could do anyhow and reentering the remove callback again is only calling for trouble.

So this is an source for errors typically yielding resource leaks in the error path.

As there are too many platform drivers to neatly convert them all to return void in a single go, do it in several steps after this patch:

a) Convert all drivers to implement .remove_new() returning void instead

    of .remove() returning int;
 b) Change struct platform_driver::remove() to return void and so make
    it identical to .remove_new();

c) Change all drivers back to .remove() now with the better prototype;
d) drop struct platform_driver::remove_new().

While this touches all drivers eventually twice, steps a) and c) can be done one driver after another and so reduces coordination efforts immensely and simplifies review.

Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")

---
 drivers/base/platform.c         |  4 +++-
 include/linux/platform_device.h | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/base/platform.c +3 -1
index 652531f67135a..ac5cf1a8d79ab 100644
@@ -1427,7 +1427,9 @@ static void platform_remove(struct device *_dev)
 	struct platform_driver *drv = to_platform_driver(_dev->driver);
 	struct platform_device *dev = to_platform_device(_dev);
 
-	if (drv->remove) {
+	if (drv->remove_new) {
+		drv->remove_new(dev);
+	} else if (drv->remove) {
 		int ret = drv->remove(dev);
 
 		if (ret)
include/linux/platform_device.h +11 -0
index 7c96f169d2740..8aefdc0099c86 100644
@@ -203,7 +203,18 @@ extern void platform_device_put(struct platform_device *pdev);
 
 struct platform_driver {
 	int (*probe)(struct platform_device *);
+
+	/*
+	 * Traditionally the remove callback returned an int which however is
+	 * ignored by the driver core. This led to wrong expectations by driver
+	 * authors who thought returning an error code was a valid error
+	 * handling strategy. To convert to a callback returning void, new
+	 * drivers should implement .remove_new() until the conversion it done
+	 * that eventually makes .remove() return void.
+	 */
 	int (*remove)(struct platform_device *);
+	void (*remove_new)(struct platform_device *);
+
 	void (*shutdown)(struct platform_device *);
 	int (*suspend)(struct platform_device *, pm_message_t state);
 	int (*resume)(struct platform_device *);
Signature · 1 line
2.39.2
author maintainer
#146 lore raw

PATCH 137/371 media: rcar_fdp1: Convert to platform remove callback returning void

In reply to Greg Kroah-Hartman

From: Uwe Kleine-König <[email protected]>

[ Upstream commit 0e82d3715fd208de567b8e4307fbf91ae5e57db4 ]

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")

---
 drivers/media/platform/rcar_fdp1.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/rcar_fdp1.c +2 -4
index 37ecf489d112e..d80b3214dfae1 100644
@@ -2396,7 +2396,7 @@ static int fdp1_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int fdp1_remove(struct platform_device *pdev)
+static void fdp1_remove(struct platform_device *pdev)
 {
 	struct fdp1_dev *fdp1 = platform_get_drvdata(pdev);
 
@@ -2404,8 +2404,6 @@ static int fdp1_remove(struct platform_device *pdev)
 	video_unregister_device(&fdp1->vfd);
 	v4l2_device_unregister(&fdp1->v4l2_dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static int __maybe_unused fdp1_pm_runtime_suspend(struct device *dev)
@@ -2441,7 +2439,7 @@ MODULE_DEVICE_TABLE(of, fdp1_dt_ids);
 
 static struct platform_driver fdp1_pdrv = {
 	.probe		= fdp1_probe,
-	.remove		= fdp1_remove,
+	.remove_new	= fdp1_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.of_match_table = fdp1_dt_ids,
Signature · 1 line
2.39.2
author maintainer
#147 lore raw

PATCH 138/371 media: rcar_fdp1: Fix refcount leak in probe and remove function

In reply to Greg Kroah-Hartman

From: Miaoqian Lin <[email protected]>

[ Upstream commit c766c90faf93897b77c9c5daa603cffab85ba907 ]

rcar_fcp_get() take reference, which should be balanced with rcar_fcp_put(). Add missing rcar_fcp_put() in fdp1_remove and the error paths of fdp1_probe() to fix this.

Fixes 4710b752e029 ("[media] v4l: Add Renesas R-Car FDP1 Driver")
[hverkuil: resolve merge conflict, remove() is now void]
---
 drivers/media/platform/rcar_fdp1.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/rcar_fdp1.c +8 -3
index d80b3214dfae1..c548cb01957b0 100644
@@ -2313,8 +2313,10 @@ static int fdp1_probe(struct platform_device *pdev)
 
 	/* Determine our clock rate */
 	clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
+	if (IS_ERR(clk)) {
+		ret = PTR_ERR(clk);
+		goto put_dev;
+	}
 
 	fdp1->clk_rate = clk_get_rate(clk);
 	clk_put(clk);
@@ -2323,7 +2325,7 @@ static int fdp1_probe(struct platform_device *pdev)
 	ret = v4l2_device_register(&pdev->dev, &fdp1->v4l2_dev);
 	if (ret) {
 		v4l2_err(&fdp1->v4l2_dev, "Failed to register video device\n");
-		return ret;
+		goto put_dev;
 	}
 
 	/* M2M registration */
@@ -2393,6 +2395,8 @@ static int fdp1_probe(struct platform_device *pdev)
 unreg_dev:
 	v4l2_device_unregister(&fdp1->v4l2_dev);
 
+put_dev:
+	rcar_fcp_put(fdp1->fcp);
 	return ret;
 }
 
@@ -2404,6 +2408,7 @@ static void fdp1_remove(struct platform_device *pdev)
 	video_unregister_device(&fdp1->vfd);
 	v4l2_device_unregister(&fdp1->v4l2_dev);
 	pm_runtime_disable(&pdev->dev);
+	rcar_fcp_put(fdp1->fcp);
 }
 
 static int __maybe_unused fdp1_pm_runtime_suspend(struct device *dev)
Signature · 1 line
2.39.2
author maintainer
#148 lore raw

PATCH 139/371 drm/amd/display: Fix potential null dereference

In reply to Greg Kroah-Hartman

From: Igor Artemiev <[email protected]>

[ Upstream commit 52f1783ff4146344342422c1cd94fcb4ce39b6fe ]

The adev->dm.dc pointer can be NULL and dereferenced in amdgpu_dm_fini() without checking.

Add a NULL pointer check before calling dc_dmub_srv_destroy().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 9a71c7d31734 ("drm/amd/display: Register DMUB service with DC")
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 68c98e30fee71..1e0ddf7722cd4 100644
@@ -1707,7 +1707,8 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 		dc_deinit_callbacks(adev->dm.dc);
 #endif
 
-	dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
+	if (adev->dm.dc)
+		dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
 
 	if (dc_enable_dmub_notifications(adev->dm.dc)) {
 		kfree(adev->dm.dmub_notify);
Signature · 1 line
2.39.2
author maintainer
#149 lore raw

PATCH 140/371 media: rc: gpio-ir-recv: Fix support for wake-up

In reply to Greg Kroah-Hartman

From: Florian Fainelli <[email protected]>

[ Upstream commit 9c592f8ab114875fdb3b2040f01818e53de44991 ]

The driver was intended from the start to be a wake-up source for the system, however due to the absence of a suitable call to device_set_wakeup_capable(), the device_may_wakeup() call used to decide whether to enable the GPIO interrupt as a wake-up source would never happen. Lookup the DT standard "wakeup-source" property and call device_init_wakeup() to ensure the device is flagged as being wakeup capable.

Fixes fd0f6851eb46 ("[media] rc: Add support for GPIO based IR Receiver driver")
---
 drivers/media/rc/gpio-ir-recv.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/rc/gpio-ir-recv.c +2 -0
index a56c844d7f816..16795e07dc103 100644
@@ -107,6 +107,8 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 		rcdev->map_name = RC_MAP_EMPTY;
 
 	gpio_dev->rcdev = rcdev;
+	if (of_property_read_bool(np, "wakeup-source"))
+		device_init_wakeup(dev, true);
 
 	rc = devm_rc_register_device(dev, rcdev);
 	if (rc < 0) {
Signature · 1 line
2.39.2
author maintainer
#150 lore raw

PATCH 141/371 media: venus: dec: Fix handling of the start cmd

In reply to Greg Kroah-Hartman

From: Michał Krawczyk <[email protected]>

[ Upstream commit 50248ad9f190d527cbd578190ca769729518b703 ]

The decoder driver should clear the last_buffer_dequeued flag of the capture queue upon receiving V4L2_DEC_CMD_START.

The last_buffer_dequeued flag is set upon receiving EOS (which always happens upon receiving V4L2_DEC_CMD_STOP).

Without this patch, after issuing the V4L2_DEC_CMD_STOP and V4L2_DEC_CMD_START, the vb2_dqbuf() function will always fail, even if the buffers are completed by the hardware.

Fixes beac82904a87 ("media: venus: make decoder compliant with stateful codec API")
---
 drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/media/platform/qcom/venus/vdec.c +8 -0
index 9a4443a390b1f..6e0466772339a 100644
@@ -498,6 +498,7 @@ static int
 vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
+	struct vb2_queue *dst_vq;
 	struct hfi_frame_data fdata = {0};
 	int ret;
 
@@ -528,6 +529,13 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 			inst->codec_state = VENUS_DEC_STATE_DRAIN;
 			inst->drain_active = true;
 		}
+	} else if (cmd->cmd == V4L2_DEC_CMD_START &&
+		   inst->codec_state == VENUS_DEC_STATE_STOPPED) {
+		dst_vq = v4l2_m2m_get_vq(inst->fh.m2m_ctx,
+					 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+		vb2_clear_last_buffer_dequeued(dst_vq);
+
+		inst->codec_state = VENUS_DEC_STATE_DECODING;
 	}
 
 unlock:
Signature · 1 line
2.39.2
author maintainer
#151 lore raw

PATCH 142/371 regulator: stm32-pwr: fix of_iomap leak

In reply to Greg Kroah-Hartman

From: YAN SHI <[email protected]>

[ Upstream commit c4a413e56d16a2ae84e6d8992f215c4dcc7fac20 ]

Smatch reports:
drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.

In stm32_pwr_regulator_probe(), base is not released when devm_kzalloc() fails to allocate memory or devm_regulator_register() fails to register a new regulator device, which may cause a leak.

To fix this issue, replace of_iomap() with devm_platform_ioremap_resource(). devm_platform_ioremap_resource() is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe function succeeds or fails.

Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource() can either be a pointer to the remapped memory or an ERR_PTR() encoded error code if the operation fails.

---
 drivers/regulator/stm32-pwr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/stm32-pwr.c +3 -4
index 2a42acb7c24e9..e5dd4db6403b2 100644
@@ -129,17 +129,16 @@ static const struct regulator_desc stm32_pwr_desc[] = {
 
 static int stm32_pwr_regulator_probe(struct platform_device *pdev)
 {
-	struct device_node *np = pdev->dev.of_node;
 	struct stm32_pwr_reg *priv;
 	void __iomem *base;
 	struct regulator_dev *rdev;
 	struct regulator_config config = { };
 	int i, ret = 0;
 
-	base = of_iomap(np, 0);
-	if (!base) {
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
 		dev_err(&pdev->dev, "Unable to map IO memory\n");
-		return -ENOMEM;
+		return PTR_ERR(base);
 	}
 
 	config.dev = &pdev->dev;
Signature · 1 line
2.39.2
author maintainer
#152 lore raw

PATCH 143/371 x86/ioapic: Dont return 0 from arch_dynirq_lower_bound()

In reply to Greg Kroah-Hartman

From: Saurabh Sengar <[email protected]>

[ Upstream commit 5af507bef93c09a94fb8f058213b489178f4cbe5 ]

arch_dynirq_lower_bound() is invoked by the core interrupt code to retrieve the lowest possible Linux interrupt number for dynamically allocated interrupts like MSI.

The x86 implementation uses this to exclude the IO/APIC GSI space. This works correctly as long as there is an IO/APIC registered, but returns 0 if not. This has been observed in VMs where the BIOS does not advertise an IO/APIC.

0 is an invalid interrupt number except for the legacy timer interrupt on x86. The return value is unchecked in the core code, so it ends up to allocate interrupt number 0 which is subsequently considered to be invalid by the caller, e.g. the MSI allocation code.

The function has already a check for 0 in the case that an IO/APIC is registered, as ioapic_dynirq_base is 0 in case of device tree setups.

Consolidate this and zero check for both ioapic_dynirq_base and gsi_top, which is used in the case that no IO/APIC is registered.

Fixes 3e5bedc2c258 ("x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines")
---
 arch/x86/kernel/apic/io_apic.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +9 -5
index c1bb384935b05..bb71b628edcb4 100644
@@ -2479,17 +2479,21 @@ static int io_apic_get_redir_entries(int ioapic)
 
 unsigned int arch_dynirq_lower_bound(unsigned int from)
 {
+	unsigned int ret;
+
 	/*
 	 * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
 	 * gsi_top if ioapic_dynirq_base hasn't been initialized yet.
 	 */
-	if (!ioapic_initialized)
-		return gsi_top;
+	ret = ioapic_dynirq_base ? : gsi_top;
+
 	/*
-	 * For DT enabled machines ioapic_dynirq_base is irrelevant and not
-	 * updated. So simply return @from if ioapic_dynirq_base == 0.
+	 * For DT enabled machines ioapic_dynirq_base is irrelevant and
+	 * always 0. gsi_top can be 0 if there is no IO/APIC registered.
+	 * 0 is an invalid interrupt number for dynamic allocations. Return
+	 * @from instead.
 	 */
-	return ioapic_dynirq_base ? : from;
+	return ret ? : from;
 }
 
 #ifdef CONFIG_X86_32
Signature · 1 line
2.39.2
author maintainer
#153 lore raw

PATCH 144/371 arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step

In reply to Greg Kroah-Hartman

From: Sumit Garg <[email protected]>

[ Upstream commit af6c0bd59f4f3ad5daad2f7b777954b1954551d5 ]

Currently only the first attempt to single-step has any effect. After that all further stepping remains "stuck" at the same program counter value.

Refer to the ARM Architecture Reference Manual (ARM DDI 0487E.a) D2.12, PSTATE.SS=1 should be set at each step before transferring the PE to the 'Active-not-pending' state. The problem here is PSTATE.SS=1 is not set since the second single-step.

After the first single-step, the PE transferes to the 'Inactive' state, with PSTATE.SS=0 and MDSCR.SS=1, thus PSTATE.SS won't be set to 1 due to kernel_active_single_step()=true. Then the PE transferes to the 'Active-pending' state when ERET and returns to the debugger by step exception.

Before this patch:
==================
Entering kdb (current=0xffff3376039f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb>

[0]kdb>
[0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffa45c13d09290 (write_sysrq_trigger)
is enabled addr at ffffa45c13d09290, hardtype=0 installed=0

[0]kdb> go

$ echo h > /proc/sysrq-trigger

Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to Breakpoint @ 0xffffad651a309290 [1]kdb> ss

Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb> ss

Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb>

After this patch:
=================
Entering kdb (current=0xffff6851c39f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffc02d2dd09290 (write_sysrq_trigger)
is enabled addr at ffffc02d2dd09290, hardtype=0 installed=0

[0]kdb> go

$ echo h > /proc/sysrq-trigger

Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to Breakpoint @ 0xffffc02d2dd09290 [1]kdb> ss

Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09294 [1]kdb> ss

Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09298 [1]kdb> ss

Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd0929c [1]kdb>

---
 arch/arm64/include/asm/debug-monitors.h | 1 +
 arch/arm64/kernel/debug-monitors.c      | 5 +++++
 arch/arm64/kernel/kgdb.c                | 2 ++
 3 files changed, 8 insertions(+)
arch/arm64/include/asm/debug-monitors.h +1 -0
index e1e10a24519b2..8de1a840ad974 100644
@@ -116,6 +116,7 @@ void user_regs_reset_single_step(struct user_pt_regs *regs,
 void kernel_enable_single_step(struct pt_regs *regs);
 void kernel_disable_single_step(void);
 int kernel_active_single_step(void);
+void kernel_rewind_single_step(struct pt_regs *regs);
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 int reinstall_suspended_bps(struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +5 -0
index bf9fe71589bca..732f0890416de 100644
@@ -438,6 +438,11 @@ int kernel_active_single_step(void)
 }
 NOKPROBE_SYMBOL(kernel_active_single_step);
 
+void kernel_rewind_single_step(struct pt_regs *regs)
+{
+	set_regs_spsr_ss(regs);
+}
+
 /* ptrace API */
 void user_enable_single_step(struct task_struct *task)
 {
arch/arm64/kernel/kgdb.c +2 -0
index cda9c1e9864f7..4e1f983df3d1c 100644
@@ -224,6 +224,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
 		 */
 		if (!kernel_active_single_step())
 			kernel_enable_single_step(linux_regs);
+		else
+			kernel_rewind_single_step(linux_regs);
 		err = 0;
 		break;
 	default:
Signature · 1 line
2.39.2
author maintainer
#154 lore raw

PATCH 145/371 debugobject: Prevent init race with static objects

In reply to Greg Kroah-Hartman

From: Thomas Gleixner <[email protected]>

[ Upstream commit 63a759694eed61025713b3e14dd827c8548daadc ]

Statically initialized objects are usually not initialized via the init() function of the subsystem. They are special cased and the subsystem provides a function to validate whether an object which is not yet tracked by debugobjects is statically initialized. This means the object is started to be tracked on first use, e.g. activation.

This works perfectly fine, unless there are two concurrent operations on that object. Schspa decoded the problem:

T0 T1

debug_object_assert_init(addr)
lock_hash_bucket()
obj = lookup_object(addr);
if (!obj) {

  	unlock_hash_bucket();
	- > preemption
			            lock_subsytem_object(addr);
				      activate_object(addr)
				      lock_hash_bucket();
				      obj = lookup_object(addr);
				      if (!obj) {
				    	unlock_hash_bucket();
					if (is_static_object(addr))
					   init_and_track(addr);
				      lock_hash_bucket();
				      obj = lookup_object(addr);
				      obj->state = ACTIVATED;
				      unlock_hash_bucket();

				    subsys function modifies content of addr,
				    so static object detection does
				    not longer work.

				    unlock_subsytem_object(addr);

        if (is_static_object(addr)) <- Fails

	  debugobject emits a warning and invokes the fixup function which
	  reinitializes the already active object in the worst case.

This race exists forever, but was never observed until mod_timer() got a debug_object_assert_init() added which is outside of the timer base lock held section right at the beginning of the function to cover the lockless early exit points too.

Rework the code so that the lookup, the static object check and the tracking object association happens atomically under the hash bucket lock. This prevents the issue completely as all callers are serialized on the hash bucket lock and therefore cannot observe inconsistent state.

---
 lib/debugobjects.c | 125 ++++++++++++++++++++++++---------------------
 1 file changed, 66 insertions(+), 59 deletions(-)
lib/debugobjects.c +66 -59
index 793c31b7e417d..097071b5a11d9 100644
@@ -219,10 +219,6 @@ static struct debug_obj *__alloc_object(struct hlist_head *list)
 	return obj;
 }
 
-/*
- * Allocate a new object. If the pool is empty, switch off the debugger.
- * Must be called with interrupts disabled.
- */
 static struct debug_obj *
 alloc_object(void *addr, struct debug_bucket *b, const struct debug_obj_descr *descr)
 {
@@ -555,11 +551,49 @@ static void debug_object_is_on_stack(void *addr, int onstack)
 	WARN_ON(1);
 }
 
+static struct debug_obj *lookup_object_or_alloc(void *addr, struct debug_bucket *b,
+						const struct debug_obj_descr *descr,
+						bool onstack, bool alloc_ifstatic)
+{
+	struct debug_obj *obj = lookup_object(addr, b);
+	enum debug_obj_state state = ODEBUG_STATE_NONE;
+
+	if (likely(obj))
+		return obj;
+
+	/*
+	 * debug_object_init() unconditionally allocates untracked
+	 * objects. It does not matter whether it is a static object or
+	 * not.
+	 *
+	 * debug_object_assert_init() and debug_object_activate() allow
+	 * allocation only if the descriptor callback confirms that the
+	 * object is static and considered initialized. For non-static
+	 * objects the allocation needs to be done from the fixup callback.
+	 */
+	if (unlikely(alloc_ifstatic)) {
+		if (!descr->is_static_object || !descr->is_static_object(addr))
+			return ERR_PTR(-ENOENT);
+		/* Statically allocated objects are considered initialized */
+		state = ODEBUG_STATE_INIT;
+	}
+
+	obj = alloc_object(addr, b, descr);
+	if (likely(obj)) {
+		obj->state = state;
+		debug_object_is_on_stack(addr, onstack);
+		return obj;
+	}
+
+	/* Out of memory. Do the cleanup outside of the locked region */
+	debug_objects_enabled = 0;
+	return NULL;
+}
+
 static void
 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack)
 {
 	enum debug_obj_state state;
-	bool check_stack = false;
 	struct debug_bucket *db;
 	struct debug_obj *obj;
 	unsigned long flags;
@@ -575,16 +609,11 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack
 
 	raw_spin_lock_irqsave(&db->lock, flags);
 
-	obj = lookup_object(addr, db);
-	if (!obj) {
-		obj = alloc_object(addr, db, descr);
-		if (!obj) {
-			debug_objects_enabled = 0;
-			raw_spin_unlock_irqrestore(&db->lock, flags);
-			debug_objects_oom();
-			return;
-		}
-		check_stack = true;
+	obj = lookup_object_or_alloc(addr, db, descr, onstack, false);
+	if (unlikely(!obj)) {
+		raw_spin_unlock_irqrestore(&db->lock, flags);
+		debug_objects_oom();
+		return;
 	}
 
 	switch (obj->state) {
@@ -610,8 +639,6 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack
 	}
 
 	raw_spin_unlock_irqrestore(&db->lock, flags);
-	if (check_stack)
-		debug_object_is_on_stack(addr, onstack);
 }
 
 /**
@@ -651,14 +678,12 @@ EXPORT_SYMBOL_GPL(debug_object_init_on_stack);
  */
 int debug_object_activate(void *addr, const struct debug_obj_descr *descr)
 {
+	struct debug_obj o = { .object = addr, .state = ODEBUG_STATE_NOTAVAILABLE, .descr = descr };
 	enum debug_obj_state state;
 	struct debug_bucket *db;
 	struct debug_obj *obj;
 	unsigned long flags;
 	int ret;
-	struct debug_obj o = { .object = addr,
-			       .state = ODEBUG_STATE_NOTAVAILABLE,
-			       .descr = descr };
 
 	if (!debug_objects_enabled)
 		return 0;
@@ -667,8 +692,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)
 
 	raw_spin_lock_irqsave(&db->lock, flags);
 
-	obj = lookup_object(addr, db);
-	if (obj) {
+	obj = lookup_object_or_alloc(addr, db, descr, false, true);
+	if (likely(!IS_ERR_OR_NULL(obj))) {
 		bool print_object = false;
 
 		switch (obj->state) {
@@ -701,24 +726,16 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)
 
 	raw_spin_unlock_irqrestore(&db->lock, flags);
 
-	/*
-	 * We are here when a static object is activated. We
-	 * let the type specific code confirm whether this is
-	 * true or not. if true, we just make sure that the
-	 * static object is tracked in the object tracker. If
-	 * not, this must be a bug, so we try to fix it up.
-	 */
-	if (descr->is_static_object && descr->is_static_object(addr)) {
-		/* track this static object */
-		debug_object_init(addr, descr);
-		debug_object_activate(addr, descr);
-	} else {
-		debug_print_object(&o, "activate");
-		ret = debug_object_fixup(descr->fixup_activate, addr,
-					ODEBUG_STATE_NOTAVAILABLE);
-		return ret ? 0 : -EINVAL;
+	/* If NULL the allocation has hit OOM */
+	if (!obj) {
+		debug_objects_oom();
+		return 0;
 	}
-	return 0;
+
+	/* Object is neither static nor tracked. It's not initialized */
+	debug_print_object(&o, "activate");
+	ret = debug_object_fixup(descr->fixup_activate, addr, ODEBUG_STATE_NOTAVAILABLE);
+	return ret ? 0 : -EINVAL;
 }
 EXPORT_SYMBOL_GPL(debug_object_activate);
 
@@ -872,6 +889,7 @@ EXPORT_SYMBOL_GPL(debug_object_free);
  */
 void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr)
 {
+	struct debug_obj o = { .object = addr, .state = ODEBUG_STATE_NOTAVAILABLE, .descr = descr };
 	struct debug_bucket *db;
 	struct debug_obj *obj;
 	unsigned long flags;
@@ -882,31 +900,20 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr)
 	db = get_bucket((unsigned long) addr);
 
 	raw_spin_lock_irqsave(&db->lock, flags);
+	obj = lookup_object_or_alloc(addr, db, descr, false, true);
+	raw_spin_unlock_irqrestore(&db->lock, flags);
+	if (likely(!IS_ERR_OR_NULL(obj)))
+		return;
 
-	obj = lookup_object(addr, db);
+	/* If NULL the allocation has hit OOM */
 	if (!obj) {
-		struct debug_obj o = { .object = addr,
-				       .state = ODEBUG_STATE_NOTAVAILABLE,
-				       .descr = descr };
-
-		raw_spin_unlock_irqrestore(&db->lock, flags);
-		/*
-		 * Maybe the object is static, and we let the type specific
-		 * code confirm. Track this static object if true, else invoke
-		 * fixup.
-		 */
-		if (descr->is_static_object && descr->is_static_object(addr)) {
-			/* Track this static object */
-			debug_object_init(addr, descr);
-		} else {
-			debug_print_object(&o, "assert_init");
-			debug_object_fixup(descr->fixup_assert_init, addr,
-					   ODEBUG_STATE_NOTAVAILABLE);
-		}
+		debug_objects_oom();
 		return;
 	}
 
-	raw_spin_unlock_irqrestore(&db->lock, flags);
+	/* Object is neither tracked nor static. It's not initialized. */
+	debug_print_object(&o, "assert_init");
+	debug_object_fixup(descr->fixup_assert_init, addr, ODEBUG_STATE_NOTAVAILABLE);
 }
 EXPORT_SYMBOL_GPL(debug_object_assert_init);
 
Signature · 1 line
2.39.2
author maintainer
#137 lore raw

PATCH 128/371 regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()

In reply to Greg Kroah-Hartman

From: Douglas Anderson <[email protected]>

[ Upstream commit b83a1772be854f87602de14726737d3e5b06e1f4 ]

When a codepath locks a rdev using ww_mutex_lock_slow() directly then that codepath is responsible for incrementing the "ref_cnt" and also setting the "mutex_owner" to "current".

The regulator core consistently got that right for "ref_cnt" but didn't always get it right for "mutex_owner". Let's fix this.

It's unlikely that this truly matters because the "mutex_owner" is only needed if we're going to do subsequent locking of the same rdev. However, even though it's not truly needed it seems less surprising if we consistently set "mutex_owner" properly.

---
 drivers/regulator/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/core.c +2 -0
index e876702d6ef36..48db0735e3dba 100644
@@ -333,6 +333,7 @@ static void regulator_lock_dependent(struct regulator_dev *rdev,
 			ww_mutex_lock_slow(&new_contended_rdev->mutex, ww_ctx);
 			old_contended_rdev = new_contended_rdev;
 			old_contended_rdev->ref_cnt++;
+			old_contended_rdev->mutex_owner = current;
 		}
 
 		err = regulator_lock_recursive(rdev,
@@ -5966,6 +5967,7 @@ static void regulator_summary_lock(struct ww_acquire_ctx *ww_ctx)
 			ww_mutex_lock_slow(&new_contended_rdev->mutex, ww_ctx);
 			old_contended_rdev = new_contended_rdev;
 			old_contended_rdev->ref_cnt++;
+			old_contended_rdev->mutex_owner = current;
 		}
 
 		err = regulator_summary_lock_all(ww_ctx,
Signature · 1 line
2.39.2
author maintainer
#155 lore raw

PATCH 146/371 drm/i915: Make intel_get_crtc_new_encoder() less oopsy

In reply to Greg Kroah-Hartman

From: Ville Syrjälä <[email protected]>

[ Upstream commit 631420b06597a33c72b6dcef78d1c2dea17f452d ]

The point of the WARN was to print something, not oops straight up. Currently that is precisely what happens if we can't find the connector for the crtc in the atomic state. Get the dev pointer from the atomic state instead of the potentially NULL encoder to avoid that.

Fixes 3a47ae201e07 ("drm/i915/display: Make WARN* drm specific where encoder ptr is available")
(cherry picked from commit 3b6692357f70498f617ea1b31a0378070a0acf1c)
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 566b34ba57e18..26811176846dc 100644
@@ -2303,7 +2303,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
 		num_encoders++;
 	}
 
-	drm_WARN(encoder->base.dev, num_encoders != 1,
+	drm_WARN(state->base.dev, num_encoders != 1,
 		 "%d encoders for pipe %c\n",
 		 num_encoders, pipe_name(crtc->pipe));
 
Signature · 1 line
2.39.2
author maintainer
#156 lore raw

PATCH 147/371 tick/common: Align tick period with the HZ tick.

In reply to Greg Kroah-Hartman

From: Sebastian Andrzej Siewior <[email protected]>

[ Upstream commit e9523a0d81899361214d118ad60ef76f0e92f71d ]

With HIGHRES enabled tick_sched_timer() is programmed every jiffy to expire the timer_list timers. This timer is programmed accurate in respect to CLOCK_MONOTONIC so that 0 seconds and nanoseconds is the first tick and the next one is 1000/CONFIG_HZ ms later. For HZ=250 it is every 4 ms and so based on the current time the next tick can be computed.

This accuracy broke since the commit mentioned below because the jiffy based clocksource is initialized with higher accuracy in read_persistent_wall_and_boot_offset(). This higher accuracy is inherited during the setup in tick_setup_device(). The timer still fires every 4ms with HZ=250 but timer is no longer aligned with CLOCK_MONOTONIC with 0 as it origin but has an offset in the us/ns part of the timestamp. The offset differs with every boot and makes it impossible for user land to align with the tick.

Align the tick period with CLOCK_MONOTONIC ensuring that it is always a multiple of 1000/CONFIG_HZ ms.

---
 kernel/time/tick-common.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/time/tick-common.c +11 -1
index 46789356f856e..65b8658da829e 100644
@@ -218,9 +218,19 @@ static void tick_setup_device(struct tick_device *td,
 		 * this cpu:
 		 */
 		if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
+			ktime_t next_p;
+			u32 rem;
+
 			tick_do_timer_cpu = cpu;
 
-			tick_next_period = ktime_get();
+			next_p = ktime_get();
+			div_u64_rem(next_p, TICK_NSEC, &rem);
+			if (rem) {
+				next_p -= rem;
+				next_p += TICK_NSEC;
+			}
+
+			tick_next_period = next_p;
 #ifdef CONFIG_NO_HZ_FULL
 			/*
 			 * The boot CPU may be nohz_full, in which case set
Signature · 1 line
2.39.2
author maintainer
#157 lore raw

PATCH 148/371 cpufreq: use correct unit when verify cur freq

In reply to Greg Kroah-Hartman

From: Sanjay Chandrashekara <[email protected]>

[ Upstream commit 44295af5019f1997d038ad2611086a2d1e2af167 ]

cpufreq_verify_current_freq checks() if the frequency returned by the hardware has a slight delta with the valid frequency value last set and returns "policy->cur" if the delta is within "1 MHz". In the comparison, "policy->cur" is in "kHz" but it's compared against HZ_PER_MHZ. So, the comparison range becomes "1 GHz".

Fix this by comparing against KHZ_PER_MHZ instead of HZ_PER_MHZ.

Fixes f55ae08c8987 ("cpufreq: Avoid unnecessary frequency updates due to mismatch")
[ sumit gupta: Commit message update ]
---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +1 -1
index b998b50839534..ae7b95e15ac7e 100644
@@ -1709,7 +1709,7 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
 		 * MHz. In such cases it is better to avoid getting into
 		 * unnecessary frequency updates.
 		 */
-		if (abs(policy->cur - new_freq) < HZ_PER_MHZ)
+		if (abs(policy->cur - new_freq) < KHZ_PER_MHZ)
 			return policy->cur;
 
 		cpufreq_out_of_sync(policy, new_freq);
Signature · 1 line
2.39.2
author maintainer
#158 lore raw

PATCH 149/371 hwmon: (pmbus/fsp-3y) Fix functionality bitmask in FSP-3Y YM-2151E

In reply to Greg Kroah-Hartman

From: Tomáš Pecka <[email protected]>

[ Upstream commit 93822f5161a2dc57a60b95b35b3cb8589f53413e ]

The bit flags in pmbus_driver_info functionality for YM-2151E chip were joined with a comma operator instead of a bitwise OR. This means that the last constant PMBUS_HAVE_IIN was not OR-ed with the other PM_BUS_HAVE_* constants for this page but it initialized the next element of the func array (which was not accessed from anywhere because of the number of pages).

However, there is no need for setting PMBUS_HAVE_IIN in the 5Vsb page because this command does not seem to be paged. Obviously, the device only has one IIN sensor, so it doesn't make sense to query it again from the second page.

Fixes 1734b4135a62 ("hwmon: Add driver for fsp-3y PSUs and PDUs")
---
 drivers/hwmon/pmbus/fsp-3y.c | 1 -
 1 file changed, 1 deletion(-)
drivers/hwmon/pmbus/fsp-3y.c +0 -1
index aec294cc72d1f..c7469d2cdedcf 100644
@@ -180,7 +180,6 @@ static struct pmbus_driver_info fsp3y_info[] = {
 			PMBUS_HAVE_FAN12,
 		.func[YM2151_PAGE_5VSB_LOG] =
 			PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT,
-			PMBUS_HAVE_IIN,
 		.read_word_data = fsp3y_read_word_data,
 		.read_byte_data = fsp3y_read_byte_data,
 	},
Signature · 1 line
2.39.2
author maintainer
#159 lore raw

PATCH 150/371 wifi: ath6kl: minor fix for allocation size

In reply to Greg Kroah-Hartman

From: Alexey V. Vissarionov <[email protected]>

[ Upstream commit 778f83f889e7fca37780d9640fcbd0229ae38eaa ]

Although the "param" pointer occupies more or equal space compared to "*param", the allocation size should use the size of variable itself.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/net/wireless/ath/ath6kl/bmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/bmi.c +1 -1
index bde5a10d470c8..af98e871199d3 100644
@@ -246,7 +246,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)
 		return -EACCES;
 	}
 
-	size = sizeof(cid) + sizeof(addr) + sizeof(param);
+	size = sizeof(cid) + sizeof(addr) + sizeof(*param);
 	if (size > ar->bmi.max_cmd_size) {
 		WARN_ON(1);
 		return -EINVAL;
Signature · 1 line
2.39.2
author maintainer
#160 lore raw

PATCH 151/371 wifi: ath9k: hif_usb: fix memory leak of remain_skbs

In reply to Greg Kroah-Hartman

From: Fedor Pchelkin <[email protected]>

[ Upstream commit 7654cc03eb699297130b693ec34e25f77b17c947 ]

hif_dev->remain_skb is allocated and used exclusively in ath9k_hif_usb_rx_stream(). It is implied that an allocated remain_skb is processed and subsequently freed (in error paths) only during the next call of ath9k_hif_usb_rx_stream().

So, if the urbs are deallocated between those two calls due to the device deinitialization or suspend, it is possible that ath9k_hif_usb_rx_stream() is not called next time and the allocated remain_skb is leaked. Our local Syzkaller instance was able to trigger that.

remain_skb makes sense when receiving two consecutive urbs which are logically linked together, i.e. a specific data field from the first skb indicates a cached skb to be allocated, memcpy'd with some data and subsequently processed in the next call to ath9k_hif_usb_rx_stream(). Urbs deallocation supposedly makes that link irrelevant so we need to free the cached skb in those cases.

Fix the leak by introducing a function to explicitly free remain_skb (if it is not NULL) when the rx urbs have been deallocated. remain_skb is NULL when it has not been allocated at all (hif_dev struct is kzalloced) or when it has been processed in next call to ath9k_hif_usb_rx_stream().

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +19 -0
index f521dfa2f1945..e0130beb304df 100644
@@ -534,6 +534,24 @@ static struct ath9k_htc_hif hif_usb = {
 	.send = hif_usb_send,
 };
 
+/* Need to free remain_skb allocated in ath9k_hif_usb_rx_stream
+ * in case ath9k_hif_usb_rx_stream wasn't called next time to
+ * process the buffer and subsequently free it.
+ */
+static void ath9k_hif_usb_free_rx_remain_skb(struct hif_device_usb *hif_dev)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&hif_dev->rx_lock, flags);
+	if (hif_dev->remain_skb) {
+		dev_kfree_skb_any(hif_dev->remain_skb);
+		hif_dev->remain_skb = NULL;
+		hif_dev->rx_remain_len = 0;
+		RX_STAT_INC(hif_dev, skb_dropped);
+	}
+	spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
+}
+
 static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 				    struct sk_buff *skb)
 {
@@ -868,6 +886,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
 static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
 {
 	usb_kill_anchored_urbs(&hif_dev->rx_submitted);
+	ath9k_hif_usb_free_rx_remain_skb(hif_dev);
 }
 
 static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
Signature · 1 line
2.39.2
author maintainer
#161 lore raw

PATCH 152/371 wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()

In reply to Greg Kroah-Hartman

From: Dan Carpenter <[email protected]>

[ Upstream commit 4c856ee12df85aabd437c3836ed9f68d94268358 ]

This loop checks that i < max at the start of loop but then it does i++ which could put it past the end of the array. It's harmless to check again and prevent a potential out of bounds.

Fixes 1048643ea94d ("ath5k: Clean up eeprom parsing and add missing calibration data")
---
 drivers/net/wireless/ath/ath5k/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/eeprom.c +1 -1
index d444b3d70ba2e..58d3e86f6256d 100644
@@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max,
 		ee->ee_n_piers[mode]++;
 
 		freq2 = (val >> 8) & 0xff;
-		if (!freq2)
+		if (!freq2 || i >= max)
 			break;
 
 		pc[i++].freq = ath5k_eeprom_bin2freq(ee,
Signature · 1 line
2.39.2
author maintainer
#162 lore raw

PATCH 153/371 wifi: brcmfmac: support CQM RSSI notification with older firmware

In reply to Greg Kroah-Hartman

From: John Keeping <[email protected]>

[ Upstream commit ec52d77d077529f198fd874c550a26b9cc86a331 ]

Using the BCM4339 firmware from linux-firmware (version "BCM4339/2 wl0:
Sep 5 2019 11:05:52 version 6.37.39.113 (r722271 CY)" from cypress/cyfmac4339-sdio.bin) the RSSI respose is only 4 bytes, which results in an error being logged.

It seems that older devices send only the RSSI field and neither SNR nor noise is included. Handle this by accepting a 4 byte message and reading only the RSSI from it.

Fixes 7dd56ea45a66 ("brcmfmac: add support for CQM RSSI notifications")
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c         | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +8 -6
index cba909c5bc6b6..5a1b01db02e6e 100644
@@ -6212,18 +6212,20 @@ static s32 brcmf_notify_rssi(struct brcmf_if *ifp,
 {
 	struct brcmf_cfg80211_vif *vif = ifp->vif;
 	struct brcmf_rssi_be *info = data;
-	s32 rssi, snr, noise;
+	s32 rssi, snr = 0, noise = 0;
 	s32 low, high, last;
 
-	if (e->datalen < sizeof(*info)) {
+	if (e->datalen >= sizeof(*info)) {
+		rssi = be32_to_cpu(info->rssi);
+		snr = be32_to_cpu(info->snr);
+		noise = be32_to_cpu(info->noise);
+	} else if (e->datalen >= sizeof(rssi)) {
+		rssi = be32_to_cpu(*(__be32 *)data);
+	} else {
 		brcmf_err("insufficient RSSI event data\n");
 		return 0;
 	}
 
-	rssi = be32_to_cpu(info->rssi);
-	snr = be32_to_cpu(info->snr);
-	noise = be32_to_cpu(info->noise);
-
 	low = vif->cqm_rssi_low;
 	high = vif->cqm_rssi_high;
 	last = vif->cqm_rssi_last;
Signature · 1 line
2.39.2
author maintainer
#163 lore raw

PATCH 154/371 wifi: ath6kl: reduce WARN to dev_dbg() in callback

In reply to Greg Kroah-Hartman

From: Fedor Pchelkin <[email protected]>

[ Upstream commit 75c4a8154cb6c7239fb55d5550f481f6765fb83c ]

The warn is triggered on a known race condition, documented in the code above the test, that is correctly handled. Using WARN() hinders automated testing. Reducing severity.

Fixes de2070fc4aa7 ("ath6kl: Fix kernel panic on continuous driver load/unload")
Reported-and-tested-by [email protected]
---
 drivers/net/wireless/ath/ath6kl/htc_pipe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath6kl/htc_pipe.c +2 -2
index c68848819a52d..9b88d96bfe96c 100644
@@ -960,8 +960,8 @@ static int ath6kl_htc_pipe_rx_complete(struct ath6kl *ar, struct sk_buff *skb,
 	 * Thus the possibility of ar->htc_target being NULL
 	 * via ath6kl_recv_complete -> ath6kl_usb_io_comp_work.
 	 */
-	if (WARN_ON_ONCE(!target)) {
-		ath6kl_err("Target not yet initialized\n");
+	if (!target) {
+		ath6kl_dbg(ATH6KL_DBG_HTC, "Target not yet initialized\n");
 		status = -EINVAL;
 		goto free_skb;
 	}
Signature · 1 line
2.39.2
author maintainer
#164 lore raw

PATCH 155/371 tools: bpftool: Remove invalid \ json escape

In reply to Greg Kroah-Hartman

From: Luis Gerhorst <[email protected]>

[ Upstream commit c679bbd611c08b0559ffae079330bc4e5574696a ]

RFC8259 ("The JavaScript Object Notation (JSON) Data Interchange Format") only specifies \", \\, \/, \b, \f, \n, \r, and \r as valid two-character escape sequences. This does not include \', which is not required in JSON because it exclusively uses double quotes as string separators.

Solidus (/) may be escaped, but does not have to. Only reverse solidus (\), double quotes ("), and the control characters have to be escaped. Therefore, with this fix, bpftool correctly supports all valid two-character escape sequences (but still does not support characters that require multi-character escape sequences).

Witout this fix, attempting to load a JSON file generated by bpftool using Python 3.10.6's default json.load() may fail with the error "Invalid \escape" if the file contains the invalid escaped single quote (\').

Fixes b66e907cfee2 ("tools: bpftool: copy JSON writer from iproute2 repository")
---
 tools/bpf/bpftool/json_writer.c | 3 ---
 1 file changed, 3 deletions(-)
tools/bpf/bpftool/json_writer.c +0 -3
index 7fea83bedf488..bca5dd0a59e34 100644
@@ -80,9 +80,6 @@ static void jsonw_puts(json_writer_t *self, const char *str)
 		case '"':
 			fputs("\\\"", self->out);
 			break;
-		case '\'':
-			fputs("\\\'", self->out);
-			break;
 		default:
 			putc(*str, self->out);
 		}
Signature · 1 line
2.39.2
author maintainer
#138 lore raw

PATCH 129/371 regulator: core: Avoid lockdep reports when resolving supplies

In reply to Greg Kroah-Hartman

From: Douglas Anderson <[email protected]>

[ Upstream commit cba6cfdc7c3f1516f0d08ddfb24e689af0932573 ]

An automated bot told me that there was a potential lockdep problem
with regulators. This was on the chromeos-5.15 kernel, but I see
nothing that would be different downstream compared to upstream. The
bot said:
============================================
WARNING: possible recursive locking detected 5.15.104-lockdep-17461-gc1e499ed6604 #1 Not tainted
--------------------------------------------
kworker/u16:4/115 is trying to acquire lock:
ffffff8083110170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: create_regulator+0x398/0x7ec

but task is already holding lock:
ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8

other info that might help us debug this:

   Possible unsafe locking scenario:
         CPU0
         ----
    lock(regulator_ww_class_mutex);
    lock(regulator_ww_class_mutex);

*** DEADLOCK ***

May be due to missing lock nesting notation

4 locks held by kworker/u16:4/115:
#0: ffffff808006a948 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x520/0x1348 #1: ffffffc00e0a7cc0 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work+0x55c/0x1348 #2: ffffff80828a2260 (&dev->mutex){....}-{3:3}, at: __device_attach_async_helper+0xd0/0x2a4 #3: ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8

  stack backtrace:
  CPU: 2 PID: 115 Comm: kworker/u16:4 Not tainted 5.15.104-lockdep-17461-gc1e499ed6604 #1 9292e52fa83c0e23762b2b3aa1bacf5787a4d5da
  Hardware name: Google Quackingstick (rev0+) (DT)
  Workqueue: events_unbound async_run_entry_fn
  Call trace:
   dump_backtrace+0x0/0x4ec
   show_stack+0x34/0x50
   dump_stack_lvl+0xdc/0x11c
   dump_stack+0x1c/0x48
   __lock_acquire+0x16d4/0x6c74
   lock_acquire+0x208/0x750
   __mutex_lock_common+0x11c/0x11f8
   ww_mutex_lock+0xc0/0x440
   create_regulator+0x398/0x7ec
   regulator_resolve_supply+0x654/0x7c4
   regulator_register_resolve_supply+0x30/0x120
   class_for_each_device+0x1b8/0x230
   regulator_register+0x17a4/0x1f40
   devm_regulator_register+0x60/0xd0
   reg_fixed_voltage_probe+0x728/0xaec
   platform_probe+0x150/0x1c8
   really_probe+0x274/0xa20
   __driver_probe_device+0x1dc/0x3f4
   driver_probe_device+0x78/0x1c0
   __device_attach_driver+0x1ac/0x2c8
   bus_for_each_drv+0x11c/0x190
   __device_attach_async_helper+0x1e4/0x2a4
   async_run_entry_fn+0xa0/0x3ac
   process_one_work+0x638/0x1348
   worker_thread+0x4a8/0x9c4
   kthread+0x2e4/0x3a0
   ret_from_fork+0x10/0x20

The problem was first reported soon after we made many of the regulators probe asynchronously, though nothing I've seen implies that the problems couldn't have also happened even without that.

I haven't personally been able to reproduce the lockdep issue, but the issue does look somewhat legitimate. Specifically, it looks like in regulator_resolve_supply() we are holding a "rdev" lock while calling set_supply() -> create_regulator() which grabs the lock of a _different_ "rdev" (the one for our supply). This is not necessarily safe from a lockdep perspective since there is no documented ordering between these two locks.

In reality, we should always be locking a regulator before the supplying regulator, so I don't expect there to be any real deadlocks in practice. However, the regulator framework in general doesn't express this to lockdep.

Let's fix the issue by simply grabbing the two locks involved in the same way we grab multiple locks elsewhere in the regulator framework:
using the "wound/wait" mechanisms.

---
 drivers/regulator/core.c | 91 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 83 insertions(+), 8 deletions(-)
drivers/regulator/core.c +83 -8
index 48db0735e3dba..9ddb80d10dee3 100644
@@ -206,6 +206,78 @@ static void regulator_unlock(struct regulator_dev *rdev)
 	mutex_unlock(&regulator_nesting_mutex);
 }
 
+/**
+ * regulator_lock_two - lock two regulators
+ * @rdev1:		first regulator
+ * @rdev2:		second regulator
+ * @ww_ctx:		w/w mutex acquire context
+ *
+ * Locks both rdevs using the regulator_ww_class.
+ */
+static void regulator_lock_two(struct regulator_dev *rdev1,
+			       struct regulator_dev *rdev2,
+			       struct ww_acquire_ctx *ww_ctx)
+{
+	struct regulator_dev *tmp;
+	int ret;
+
+	ww_acquire_init(ww_ctx, &regulator_ww_class);
+
+	/* Try to just grab both of them */
+	ret = regulator_lock_nested(rdev1, ww_ctx);
+	WARN_ON(ret);
+	ret = regulator_lock_nested(rdev2, ww_ctx);
+	if (ret != -EDEADLOCK) {
+		WARN_ON(ret);
+		goto exit;
+	}
+
+	while (true) {
+		/*
+		 * Start of loop: rdev1 was locked and rdev2 was contended.
+		 * Need to unlock rdev1, slowly lock rdev2, then try rdev1
+		 * again.
+		 */
+		regulator_unlock(rdev1);
+
+		ww_mutex_lock_slow(&rdev2->mutex, ww_ctx);
+		rdev2->ref_cnt++;
+		rdev2->mutex_owner = current;
+		ret = regulator_lock_nested(rdev1, ww_ctx);
+
+		if (ret == -EDEADLOCK) {
+			/* More contention; swap which needs to be slow */
+			tmp = rdev1;
+			rdev1 = rdev2;
+			rdev2 = tmp;
+		} else {
+			WARN_ON(ret);
+			break;
+		}
+	}
+
+exit:
+	ww_acquire_done(ww_ctx);
+}
+
+/**
+ * regulator_unlock_two - unlock two regulators
+ * @rdev1:		first regulator
+ * @rdev2:		second regulator
+ * @ww_ctx:		w/w mutex acquire context
+ *
+ * The inverse of regulator_lock_two().
+ */
+
+static void regulator_unlock_two(struct regulator_dev *rdev1,
+				 struct regulator_dev *rdev2,
+				 struct ww_acquire_ctx *ww_ctx)
+{
+	regulator_unlock(rdev2);
+	regulator_unlock(rdev1);
+	ww_acquire_fini(ww_ctx);
+}
+
 static bool regulator_supply_is_couple(struct regulator_dev *rdev)
 {
 	struct regulator_dev *c_rdev;
@@ -1583,8 +1655,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 
 /**
  * set_supply - set regulator supply regulator
- * @rdev: regulator name
- * @supply_rdev: supply regulator name
+ * @rdev: regulator (locked)
+ * @supply_rdev: supply regulator (locked))
  *
  * Called by platform initialisation code to set the supply regulator for this
  * regulator. This ensures that a regulators supply will also be enabled by the
@@ -1756,6 +1828,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 	struct regulator *regulator;
 	int err = 0;
 
+	lockdep_assert_held_once(&rdev->mutex.base);
+
 	if (dev) {
 		char buf[REG_STR_SIZE];
 		int size;
@@ -1783,9 +1857,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 	regulator->rdev = rdev;
 	regulator->supply_name = supply_name;
 
-	regulator_lock(rdev);
 	list_add(&regulator->list, &rdev->consumer_list);
-	regulator_unlock(rdev);
 
 	if (dev) {
 		regulator->dev = dev;
@@ -1951,6 +2023,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
 {
 	struct regulator_dev *r;
 	struct device *dev = rdev->dev.parent;
+	struct ww_acquire_ctx ww_ctx;
 	int ret = 0;
 
 	/* No supply to resolve? */
@@ -2017,23 +2090,23 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
 	 * between rdev->supply null check and setting rdev->supply in
 	 * set_supply() from concurrent tasks.
 	 */
-	regulator_lock(rdev);
+	regulator_lock_two(rdev, r, &ww_ctx);
 
 	/* Supply just resolved by a concurrent task? */
 	if (rdev->supply) {
-		regulator_unlock(rdev);
+		regulator_unlock_two(rdev, r, &ww_ctx);
 		put_device(&r->dev);
 		goto out;
 	}
 
 	ret = set_supply(rdev, r);
 	if (ret < 0) {
-		regulator_unlock(rdev);
+		regulator_unlock_two(rdev, r, &ww_ctx);
 		put_device(&r->dev);
 		goto out;
 	}
 
-	regulator_unlock(rdev);
+	regulator_unlock_two(rdev, r, &ww_ctx);
 
 	/*
 	 * In set_machine_constraints() we may have turned this regulator on
@@ -2146,7 +2219,9 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
 		return regulator;
 	}
 
+	regulator_lock(rdev);
 	regulator = create_regulator(rdev, dev, id);
+	regulator_unlock(rdev);
 	if (regulator == NULL) {
 		regulator = ERR_PTR(-ENOMEM);
 		module_put(rdev->owner);
Signature · 1 line
2.39.2