6.18.2-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 119/614 arm64: dts: qcom: sm8750-mtp: move PCIe GPIOs to pcieport0 node
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Chaitanya Chundru <[email protected]>
[ Upstream commit cc8056a16472d186140d1a66ed5648cee41f4379 ]
Relocate the wake-gpios and perst-gpios properties from the pcie0 controller node to the pcieport0 node. These GPIOs are associated with the PCIe root port and should reside under the pcieport0 node.
Also rename perst-gpios to reset-gpios to match the expected property name in the PCIe port node.
--- arch/arm64/boot/dts/qcom/sm8750-mtp.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8750-mtp.dts +3 -3
@@ -960,9 +960,6 @@ &pon_resin { }; &pcie0 { - wake-gpios = <&tlmm 104 GPIO_ACTIVE_HIGH>; - perst-gpios = <&tlmm 102 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie0_default_state>; pinctrl-names = "default";
@@ -977,6 +974,9 @@ &pcie0_phy { }; &pcieport0 { + wake-gpios = <&tlmm 104 GPIO_ACTIVE_HIGH>; + reset-gpios = <&tlmm 102 GPIO_ACTIVE_LOW>; + wifi@0 { compatible = "pci17cb,1107"; reg = <0x10000 0x0 0x0 0x0 0x0>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 120/614 arm64: dts: qcom: qcm6490-shift-otter: Add missing reserved-memory
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Martinz <[email protected]>
[ Upstream commit f404fdcb50021fdad6bc734d69468cc777901a80 ]
It seems we also need to reserve a region of 81 MiB called "removed_mem" otherwise we can easily hit memory errors with higher RAM usage.
--- arch/arm64/boot/dts/qcom/qcm6490-shift-otter.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/qcm6490-shift-otter.dts +5 -0
@@ -118,6 +118,11 @@ cdsp_mem: cdsp@88f00000 { no-map; }; + removed_mem: removed@c0000000 { + reg = <0x0 0xc0000000 0x0 0x5100000>; + no-map; + }; + rmtfs_mem: rmtfs@f8500000 { compatible = "qcom,rmtfs-mem"; reg = <0x0 0xf8500000 0x0 0x600000>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 121/614 arm64: dts: qcom: x1-dell-thena: Add missing pinctrl for eDP HPD
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 1bdfe3edd4c862f97ac65b60da1db999981fc52a ]
The commit a41d23142d87 ("arm64: dts: qcom: x1e80100-dell-xps13-9345:
Add missing pinctrl for eDP HPD") has applied this change to a very similar machine, so apply it here too.
This allows us not to rely on the boot firmware to set up the pinctrl for the eDP HPD line of the internal display.
--- arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi +3 -0
@@ -1039,6 +1039,9 @@ &mdss_dp1_out { &mdss_dp3 { /delete-property/ #sound-dai-cells; + pinctrl-0 = <&edp0_hpd_default>; + pinctrl-names = "default"; + status = "okay"; aux-bus {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 122/614 arm64: dts: qcom: x1-dell-thena: remove dp data-lanes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 147d5eefab8f0e17e9951fb5e0c4c77bada34558 ]
The commit 458de584248a ("arm64: dts: qcom: x1e80100: move dp0/1/2 data-lanes to SoC dtsi") has landed before this file was added, so the data-lanes lines here remained.
Remove them to enable 4-lane DP on the X1E Dell Inspiron/Latitude.
--- arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi +0 -2
@@ -1023,7 +1023,6 @@ &mdss_dp0 { }; &mdss_dp0_out { - data-lanes = <0 1>; link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000 8100000000>; };
@@ -1032,7 +1031,6 @@ &mdss_dp1 { }; &mdss_dp1_out { - data-lanes = <0 1>; link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000 8100000000>; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 123/614 arm64: dts: qcom: sc8280xp: Fix shifted GPI DMA channels
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengyu Luo <[email protected]>
[ Upstream commit fb48d3f3abba9a7bca2814fa2e9db8ac5b9e16b9 ]
The GPI DMA channels in sc8280xp.dtsi are wrong. Let's fix it.
Origianl patch was rebased to the linux-next and formated to a new patch again later, then it got the GPI DMA channels in the new patch shifted.
--- arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 170 ++++++++++++------------- 1 file changed, 85 insertions(+), 85 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +85 -85
@@ -967,8 +967,8 @@ i2c16: i2c@880000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 6 QCOM_GPI_SPI>, - <&gpi_dma2 1 6 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 0 QCOM_GPI_I2C>, + <&gpi_dma2 1 0 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -989,8 +989,8 @@ spi16: spi@880000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 0 QCOM_GPI_I2C>, - <&gpi_dma2 1 0 QCOM_GPI_I2C>; + dmas = <&gpi_dma2 0 0 QCOM_GPI_SPI>, + <&gpi_dma2 1 0 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1011,8 +1011,8 @@ i2c17: i2c@884000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 0 QCOM_GPI_SPI>, - <&gpi_dma2 1 0 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 1 QCOM_GPI_I2C>, + <&gpi_dma2 1 1 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1033,8 +1033,8 @@ spi17: spi@884000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 1 QCOM_GPI_I2C>, - <&gpi_dma2 1 1 QCOM_GPI_I2C>; + dmas = <&gpi_dma2 0 1 QCOM_GPI_SPI>, + <&gpi_dma2 1 1 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1069,8 +1069,8 @@ i2c18: i2c@888000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 1 QCOM_GPI_SPI>, - <&gpi_dma2 1 1 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 2 QCOM_GPI_I2C>, + <&gpi_dma2 1 2 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1091,8 +1091,8 @@ spi18: spi@888000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 2 QCOM_GPI_I2C>, - <&gpi_dma2 1 2 QCOM_GPI_I2C>; + dmas = <&gpi_dma2 0 2 QCOM_GPI_SPI>, + <&gpi_dma2 1 2 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1131,8 +1131,8 @@ i2c19: i2c@88c000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 2 QCOM_GPI_SPI>, - <&gpi_dma2 1 2 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 3 QCOM_GPI_I2C>, + <&gpi_dma2 1 3 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1153,8 +1153,8 @@ spi19: spi@88c000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 3 QCOM_GPI_I2C>, - <&gpi_dma2 1 3 QCOM_GPI_I2C>; + dmas = <&gpi_dma2 0 3 QCOM_GPI_SPI>, + <&gpi_dma2 1 3 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1175,8 +1175,8 @@ i2c20: i2c@890000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 3 QCOM_GPI_SPI>, - <&gpi_dma2 1 3 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 4 QCOM_GPI_I2C>, + <&gpi_dma2 1 4 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1197,8 +1197,8 @@ spi20: spi@890000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 4 QCOM_GPI_I2C>, - <&gpi_dma2 1 4 QCOM_GPI_I2C>; + dmas = <&gpi_dma2 0 4 QCOM_GPI_SPI>, + <&gpi_dma2 1 4 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1241,8 +1241,8 @@ spi21: spi@894000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 4 QCOM_GPI_SPI>, - <&gpi_dma2 1 4 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 5 QCOM_GPI_SPI>, + <&gpi_dma2 1 5 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1285,8 +1285,8 @@ spi22: spi@898000 { <&aggre1_noc MASTER_QUP_2 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma2 0 5 QCOM_GPI_SPI>, - <&gpi_dma2 1 5 QCOM_GPI_SPI>; + dmas = <&gpi_dma2 0 6 QCOM_GPI_SPI>, + <&gpi_dma2 1 6 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1338,7 +1338,7 @@ spi23: spi@89c000 { }; }; - gpi_dma0: dma-controller@900000 { + gpi_dma0: dma-controller@900000 { compatible = "qcom,sc8280xp-gpi-dma", "qcom,sm6350-gpi-dma"; reg = <0 0x00900000 0 0x60000>;
@@ -1393,8 +1393,8 @@ i2c0: i2c@980000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 7 QCOM_GPI_I2C>, - <&gpi_dma0 1 7 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 0 QCOM_GPI_I2C>, + <&gpi_dma0 1 0 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1415,8 +1415,8 @@ spi0: spi@980000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 0 QCOM_GPI_I2C>, - <&gpi_dma0 1 0 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 0 QCOM_GPI_SPI>, + <&gpi_dma0 1 0 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1437,8 +1437,8 @@ i2c1: i2c@984000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 0 QCOM_GPI_SPI>, - <&gpi_dma0 1 0 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 1 QCOM_GPI_I2C>, + <&gpi_dma0 1 1 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1459,8 +1459,8 @@ spi1: spi@984000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 1 QCOM_GPI_I2C>, - <&gpi_dma0 1 1 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 1 QCOM_GPI_SPI>, + <&gpi_dma0 1 1 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1481,8 +1481,8 @@ i2c2: i2c@988000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 1 QCOM_GPI_SPI>, - <&gpi_dma0 1 1 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 2 QCOM_GPI_I2C>, + <&gpi_dma0 1 2 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1503,8 +1503,8 @@ spi2: spi@988000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 2 QCOM_GPI_I2C>, - <&gpi_dma0 1 2 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 2 QCOM_GPI_SPI>, + <&gpi_dma0 1 2 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1539,8 +1539,8 @@ i2c3: i2c@98c000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 2 QCOM_GPI_SPI>, - <&gpi_dma0 1 2 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 3 QCOM_GPI_I2C>, + <&gpi_dma0 1 3 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1561,8 +1561,8 @@ spi3: spi@98c000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 3 QCOM_GPI_I2C>, - <&gpi_dma0 1 3 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 3 QCOM_GPI_SPI>, + <&gpi_dma0 1 3 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1583,8 +1583,8 @@ i2c4: i2c@990000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 3 QCOM_GPI_SPI>, - <&gpi_dma0 1 3 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 4 QCOM_GPI_I2C>, + <&gpi_dma0 1 4 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1605,8 +1605,8 @@ spi4: spi@990000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 4 QCOM_GPI_I2C>, - <&gpi_dma0 1 4 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 4 QCOM_GPI_SPI>, + <&gpi_dma0 1 4 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1627,8 +1627,8 @@ i2c5: i2c@994000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 4 QCOM_GPI_SPI>, - <&gpi_dma0 1 4 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 5 QCOM_GPI_I2C>, + <&gpi_dma0 1 5 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1649,8 +1649,8 @@ spi5: spi@994000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 5 QCOM_GPI_I2C>, - <&gpi_dma0 1 5 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 5 QCOM_GPI_SPI>, + <&gpi_dma0 1 5 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1671,8 +1671,8 @@ i2c6: i2c@998000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 5 QCOM_GPI_SPI>, - <&gpi_dma0 1 5 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 6 QCOM_GPI_I2C>, + <&gpi_dma0 1 6 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1693,8 +1693,8 @@ spi6: spi@998000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 6 QCOM_GPI_I2C>, - <&gpi_dma0 1 6 QCOM_GPI_I2C>; + dmas = <&gpi_dma0 0 6 QCOM_GPI_SPI>, + <&gpi_dma0 1 6 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1715,8 +1715,8 @@ i2c7: i2c@99c000 { <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma0 0 6 QCOM_GPI_SPI>, - <&gpi_dma0 1 6 QCOM_GPI_SPI>; + dmas = <&gpi_dma0 0 7 QCOM_GPI_I2C>, + <&gpi_dma0 1 7 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1800,8 +1800,8 @@ i2c8: i2c@a80000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 7 QCOM_GPI_I2C>, - <&gpi_dma1 1 7 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 0 QCOM_GPI_I2C>, + <&gpi_dma1 1 0 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1822,8 +1822,8 @@ spi8: spi@a80000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 0 QCOM_GPI_I2C>, - <&gpi_dma1 1 0 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 0 QCOM_GPI_SPI>, + <&gpi_dma1 1 0 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1844,8 +1844,8 @@ i2c9: i2c@a84000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 0 QCOM_GPI_SPI>, - <&gpi_dma1 1 0 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 1 QCOM_GPI_I2C>, + <&gpi_dma1 1 1 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1866,8 +1866,8 @@ spi9: spi@a84000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 1 QCOM_GPI_I2C>, - <&gpi_dma1 1 1 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 1 QCOM_GPI_SPI>, + <&gpi_dma1 1 1 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1888,8 +1888,8 @@ i2c10: i2c@a88000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 1 QCOM_GPI_SPI>, - <&gpi_dma1 1 1 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 2 QCOM_GPI_I2C>, + <&gpi_dma1 1 2 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1910,8 +1910,8 @@ spi10: spi@a88000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 2 QCOM_GPI_I2C>, - <&gpi_dma1 1 2 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 2 QCOM_GPI_SPI>, + <&gpi_dma1 1 2 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1932,8 +1932,8 @@ i2c11: i2c@a8c000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 2 QCOM_GPI_SPI>, - <&gpi_dma1 1 2 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 3 QCOM_GPI_I2C>, + <&gpi_dma1 1 3 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1954,8 +1954,8 @@ spi11: spi@a8c000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 3 QCOM_GPI_I2C>, - <&gpi_dma1 1 3 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 3 QCOM_GPI_SPI>, + <&gpi_dma1 1 3 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -1976,8 +1976,8 @@ i2c12: i2c@a90000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 3 QCOM_GPI_SPI>, - <&gpi_dma1 1 3 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 4 QCOM_GPI_I2C>, + <&gpi_dma1 1 4 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -1998,8 +1998,8 @@ spi12: spi@a90000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 4 QCOM_GPI_I2C>, - <&gpi_dma1 1 4 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 4 QCOM_GPI_SPI>, + <&gpi_dma1 1 4 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -2020,8 +2020,8 @@ i2c13: i2c@a94000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 4 QCOM_GPI_SPI>, - <&gpi_dma1 1 4 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 5 QCOM_GPI_I2C>, + <&gpi_dma1 1 5 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -2042,8 +2042,8 @@ spi13: spi@a94000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 5 QCOM_GPI_I2C>, - <&gpi_dma1 1 5 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 5 QCOM_GPI_SPI>, + <&gpi_dma1 1 5 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -2064,8 +2064,8 @@ i2c14: i2c@a98000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 5 QCOM_GPI_SPI>, - <&gpi_dma1 1 5 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 6 QCOM_GPI_I2C>, + <&gpi_dma1 1 6 QCOM_GPI_I2C>; dma-names = "tx", "rx";
@@ -2086,8 +2086,8 @@ spi14: spi@a98000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 6 QCOM_GPI_I2C>, - <&gpi_dma1 1 6 QCOM_GPI_I2C>; + dmas = <&gpi_dma1 0 6 QCOM_GPI_SPI>, + <&gpi_dma1 1 6 QCOM_GPI_SPI>; dma-names = "tx", "rx";
@@ -2108,8 +2108,8 @@ i2c15: i2c@a9c000 { <&aggre1_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "qup-core", "qup-config", "qup-memory"; - dmas = <&gpi_dma1 0 6 QCOM_GPI_SPI>, - <&gpi_dma1 1 6 QCOM_GPI_SPI>; + dmas = <&gpi_dma1 0 7 QCOM_GPI_I2C>, + <&gpi_dma1 1 7 QCOM_GPI_I2C>; dma-names = "tx", "rx";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 124/614 arm64: dts: qcom: sdm845-starqltechn: Fix i2c-gpio node name
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 6030fa06360b8b8d898b66ac156adaaf990b83cb ]
Fix the following DT checker warning:
$nodename:0: 'i2c21' does not match '^i2c(@.+|-[a-z0-9]+)?$'
--- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +1 -1
@@ -158,7 +158,7 @@ rmtfs_mem: rmtfs-mem@fde00000 { }; }; - i2c21 { + i2c-21 { compatible = "i2c-gpio"; sda-gpios = <&tlmm 127 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; scl-gpios = <&tlmm 128 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 125/614 arm64: dts: qcom: sm8250-samsung-common: correct reserved pins
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Gonçalves <[email protected]>
[ Upstream commit 42e56b53a1919dbbd78e140a9f8223f8136ac360 ]
The S20 series has additional reserved pins for the fingerprint sensor, GPIO 20-23. Correct it by adding them into gpio-reserved-ranges.
--- arch/arm64/boot/dts/qcom/sm8250-samsung-common.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8250-samsung-common.dtsi +2 -1
@@ -159,7 +159,8 @@ &pon_resin { }; &tlmm { - gpio-reserved-ranges = <40 4>; /* I2C (Unused) */ + gpio-reserved-ranges = <20 4>, /* SPI (fingerprint scanner) */ + <40 4>; /* Unused */ }; &usb_1 {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 126/614 perf hwmon_pmu: Fix uninitialized variable warning
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
[ Upstream commit 2fee899c068c159e486e62623afe9e2a4975bd79 ]
The line_len is only set on success. Check the return value instead.
util/hwmon_pmu.c: In function ‘perf_pmus__read_hwmon_pmus’:
util/hwmon_pmu.c:742:20: warning: ‘line_len’ may be used uninitialized [-Wmaybe-uninitialized]
742 | if (line_len > 0 && line[line_len - 1] == '\n')
| ^
util/hwmon_pmu.c:719:24: note: ‘line_len’ was declared here
719 | size_t line_len;
--- tools/perf/util/hwmon_pmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/hwmon_pmu.c +1 -2
@@ -742,8 +742,7 @@ int perf_pmus__read_hwmon_pmus(struct list_head *pmus)continue ; }io__init (&io, name_fd, buf2,sizeof (buf2)); -io__getline (&io, &line, &line_len); -if (line_len >0 && line[line_len -1 ] =='\n' ) +if (io__getline (&io, &line, &line_len) >0 && line[line_len -1 ] =='\n' ) line[line_len -1 ] ='\0' ;hwmon_pmu__new (pmus, buf, class_hwmon_ent->d_name, line);close (name_fd);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 127/614 phy: mscc: Fix PTP for VSC8574 and VSC8572
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit ea5df88aeca112aac69e6c32e3dd1433a113b0c9 ]
The PTP initialization is two-step. First part are the function vsc8584_ptp_probe_once() and vsc8584_ptp_probe() at probe time which initialize the locks, queues, creates the PTP device. The second part is the function vsc8584_ptp_init() at config_init() time which initialize PTP in the HW.
For VSC8574 and VSC8572, the PTP initialization is incomplete. It is missing the first part but it makes the second part. Meaning that the ptp_clock_register() is never called.
There is no crash without the first part when enabling PTP but this is unexpected because some PHys have PTP functionality exposed by the driver and some don't even though they share the same PTP clock PTP.
--- drivers/net/phy/mscc/mscc_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/mscc/mscc_main.c +3 -3
@@ -2625,7 +2625,7 @@ static struct phy_driver vsc85xx_driver[] = { .suspend = &genphy_suspend, .resume = &genphy_resume, .remove = &vsc85xx_remove, - .probe = &vsc8574_probe, + .probe = &vsc8584_probe, .set_wol = &vsc85xx_wol_set, .get_wol = &vsc85xx_wol_get, .get_tunable = &vsc85xx_get_tunable,
@@ -2648,12 +2648,12 @@ static struct phy_driver vsc85xx_driver[] = { .config_aneg = &vsc85xx_config_aneg, .aneg_done = &genphy_aneg_done, .read_status = &vsc85xx_read_status, - .handle_interrupt = vsc85xx_handle_interrupt, + .handle_interrupt = vsc8584_handle_interrupt, .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, .remove = &vsc85xx_remove, - .probe = &vsc8574_probe, + .probe = &vsc8584_probe, .set_wol = &vsc85xx_wol_set, .get_wol = &vsc85xx_wol_get, .get_tunable = &vsc85xx_get_tunable,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 128/614 sctp: Defer SCTP_DBG_OBJCNT_DEC() to sctp_destroy_sock().
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 622e8838a29845316668ec2e7648428878df7f9a ]
SCTP_DBG_OBJCNT_INC() is called only when sctp_init_sock() returns 0 after successfully allocating sctp_sk(sk)->ep.
OTOH, SCTP_DBG_OBJCNT_DEC() is called in sctp_close().
The code seems to expect that the socket is always exposed to userspace once SCTP_DBG_OBJCNT_INC() is incremented, but there is a path where the assumption is not true.
In sctp_accept(), sctp_sock_migrate() could fail after sctp_init_sock().
Then, sk_common_release() does not call inet_release() nor sctp_close(). Instead, it calls sk->sk_prot->destroy().
Let's move SCTP_DBG_OBJCNT_DEC() from sctp_close() to sctp_destroy_sock().
--- net/sctp/socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sctp/socket.c +3 -2
@@ -1553,8 +1553,6 @@ static void sctp_close(struct sock *sk, long timeout)spin_unlock_bh (&net->sctp.addr_wq_lock);sock_put (sk); - -SCTP_DBG_OBJCNT_DEC (sock); }/* Handle EPIPE error. */
@@ -5109,9 +5107,12 @@ static void sctp_destroy_sock(struct sock *sk) sp->do_auto_asconf =0 ;list_del (&sp->auto_asconf_list); } +sctp_endpoint_free (sp->ep); +sk_sockets_allocated_dec (sk);sock_prot_inuse_add (sock_net (sk), sk->sk_prot,-1 ); +SCTP_DBG_OBJCNT_DEC (sock); }static void sctp_destruct_sock (struct sock *sk)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 129/614 arm64: dts: qcom: qcm2290: Fix camss register prop ordering
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Loic Poulain <[email protected]>
[ Upstream commit 67445dc8a8060309eeb7aebbc41fa0e58302fc09 ]
The qcm2290 CAMSS node has been applied from the V4 series, but a later version changed the order of the register property, fix it to prevent dtb check error.
--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +5 -5
@@ -1685,25 +1685,25 @@ cci_i2c1: i2c-bus@1 { }; }; - camss: camss@5c6e000 { + camss: camss@5c11000 { compatible = "qcom,qcm2290-camss"; - reg = <0x0 0x5c6e000 0x0 0x1000>, + reg = <0x0 0x5c11000 0x0 0x1000>, + <0x0 0x5c6e000 0x0 0x1000>, <0x0 0x5c75000 0x0 0x1000>, <0x0 0x5c52000 0x0 0x1000>, <0x0 0x5c53000 0x0 0x1000>, <0x0 0x5c66000 0x0 0x400>, <0x0 0x5c68000 0x0 0x400>, - <0x0 0x5c11000 0x0 0x1000>, <0x0 0x5c6f000 0x0 0x4000>, <0x0 0x5c76000 0x0 0x4000>; - reg-names = "csid0", + reg-names = "top", + "csid0", "csid1", "csiphy0", "csiphy1", "csitpg0", "csitpg1", - "top", "vfe0", "vfe1";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 130/614 RDMA/rxe: Fix null deref on srq->rq.queue after resize failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 503a5e4690ae14c18570141bc0dcf7501a8419b0 ]
A NULL pointer dereference can occur in rxe_srq_chk_attr() when ibv_modify_srq() is invoked twice in succession under certain error conditions. The first call may fail in rxe_queue_resize(), which leads rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then triggers a crash (null deref) when accessing srq->rq.queue->buf->index_mask.
Call Trace: <TASK> rxe_modify_srq+0x170/0x480 [rdma_rxe] ? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe] ? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs] ? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs] ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs] ? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs] ? tryinc_node_nr_active+0xe6/0x150 ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs] ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs] ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs] ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs] ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs] ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs] ? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs] ? __pfx___raw_spin_lock_irqsave+0x10/0x10 ? __pfx_do_vfs_ioctl+0x10/0x10 ? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0 ? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10 ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs] ? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs] __x64_sys_ioctl+0x138/0x1c0 do_syscall_64+0x82/0x250 ? fdget_pos+0x58/0x4c0 ? ksys_write+0xf3/0x1c0 ? __pfx_ksys_write+0x10/0x10 ? do_syscall_64+0xc8/0x250 ? __pfx_vm_mmap_pgoff+0x10/0x10 ? fget+0x173/0x230 ? fput+0x2a/0x80 ? ksys_mmap_pgoff+0x224/0x4c0 ? do_syscall_64+0xc8/0x250 ? do_user_addr_fault+0x37b/0xfe0 ? clear_bhb_loop+0x50/0xa0 ? clear_bhb_loop+0x50/0xa0 ? clear_bhb_loop+0x50/0xa0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- drivers/infiniband/sw/rxe/rxe_srq.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/infiniband/sw/rxe/rxe_srq.c +1 -6
@@ -171,7 +171,7 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq, udata, mi, &srq->rq.producer_lock, &srq->rq.consumer_lock);if (err) - goto err_free; +return err; srq->rq.max_wr = attr->max_wr; }
@@ -180,11 +180,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq, srq->limit = attr->srq_limit;return 0 ; - -err_free: -rxe_queue_cleanup (q); - srq->rq.queue =NULL ; -return err; }void rxe_srq_cleanup (struct rxe_pool_elem *elem)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 131/614 ARM: dts: renesas: gose: Remove superfluous port property
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 00df14f34615630f92f97c9d6790bd9d25c4242d ]
'bus-width' is defined for the corresponding vin input port already. No need to declare it in the output port again. Fixes:
arch/arm/boot/dts/renesas/r8a7793-gose.dtb: composite-in@20 (adi,adv7180cp): ports:port@3:endpoint: Unevaluated properties are not allowed ('bus-width' was unexpected) from schema $id: http://devicetree.org/schemas/media/i2c/adi,adv7180.yaml#
--- arch/arm/boot/dts/renesas/r8a7793-gose.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/renesas/r8a7793-gose.dts +0 -1
@@ -373,7 +373,6 @@ adv7180_in: endpoint { port@3 { reg = <3>; adv7180_out: endpoint { - bus-width = <8>; remote-endpoint = <&vin1ep>; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 132/614 ARM: dts: renesas: r9a06g032-rzn1d400-db: Drop invalid #cells properties
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit ca7fffb6e92a7c93604ea2bae0e1c89b20750937 ]
The 'ethernet-ports' node in the SoC DTSI handles them already. Fixes:
arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dtb: switch@44050000 (renesas,r9a06g032-a5psw): Unevaluated properties are not allowed ('#address-cells', '#size-cells' were unexpected)
from schema $id: http://devicetree.org/schemas/net/dsa/renesas,rzn1-a5psw.yaml#
--- arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts +0 -2
@@ -308,8 +308,6 @@ &rtc0 { &switch { status = "okay"; - #address-cells = <1>; - #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&pins_eth3>, <&pins_eth4>, <&pins_mdio1>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 133/614 drm/amdgpu: add userq object va track helpers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit 5cfa33fabf01f2cc0af6b1feed6e65cb81806a37 ]
Add the userq object virtual address list_add() helpers for tracking the userq obj va address usage.
Stable-dep-of: a0559012a18a ("drm/amdgpu/userq: fix SDMA and compute validation")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 44 ++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 12 ++++-- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 16 ++++---- 4 files changed, 52 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 -0
@@ -96,6 +96,7 @@ struct amdgpu_bo_va {* if non-zero, cannot unmap from GPU because user queues may still access it */ unsigned int queue_refcount; +atomic_t userq_va_mapped; };struct amdgpu_bo {
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +33 -11
82 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +9 -3
@@ -47,6 +47,11 @@ struct amdgpu_userq_obj {struct amdgpu_bo *obj; }; +struct amdgpu_userq_va_cursor { +u64 gpu_addr; +struct list_head list; +}; +struct amdgpu_usermode_queue {int queue_type;enum amdgpu_userq_state state;
@@ -66,6 +71,8 @@ struct amdgpu_usermode_queue {u32 xcp_id;int priority;struct dentry *debugfs_queue; + +struct list_head userq_va_list; };struct amdgpu_userq_funcs {
@@ -136,7 +143,6 @@ int amdgpu_userq_stop_sched_for_enforce_isolation(struct amdgpu_device *adev, u32 idx);int amdgpu_userq_start_sched_for_enforce_isolation (struct amdgpu_device *adev,u32 idx); - -int amdgpu_userq_input_va_validate (struct amdgpu_vm *vm,u64 addr, -u64 expected_size); +int amdgpu_userq_input_va_validate (struct amdgpu_usermode_queue *queue, +u64 addr,u64 expected_size);#endif
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +9 -7
@@ -298,8 +298,9 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, goto free_mqd; } -if (amdgpu_userq_input_va_validate (queue->vm, compute_mqd->eop_va, -max_t (u32,PAGE_SIZE ,AMDGPU_GPU_PAGE_SIZE ))) + r =amdgpu_userq_input_va_validate (queue, compute_mqd->eop_va, +max_t (u32,PAGE_SIZE ,AMDGPU_GPU_PAGE_SIZE )); +if (r) goto free_mqd; userq_props->eop_gpu_addr = compute_mqd->eop_va;
@@ -330,8 +331,9 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, userq_props->tmz_queue = mqd_user->flags &AMDGPU_USERQ_CREATE_FLAGS_QUEUE_SECURE ; -if (amdgpu_userq_input_va_validate (queue->vm, mqd_gfx_v11->shadow_va, - shadow_info.shadow_size)) + r =amdgpu_userq_input_va_validate (queue, mqd_gfx_v11->shadow_va, + shadow_info.shadow_size); +if (r) goto free_mqd;kfree (mqd_gfx_v11);
@@ -350,9 +352,9 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, r = -ENOMEM ; goto free_mqd; } - -if (amdgpu_userq_input_va_validate (queue->vm, mqd_sdma_v11->csa_va, - shadow_info.csa_size)) + r =amdgpu_userq_input_va_validate (queue, mqd_sdma_v11->csa_va, + shadow_info.csa_size); +if (r) goto free_mqd; userq_props->csa_addr = mqd_sdma_v11->csa_va;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 134/614 drm/amdgpu/userq: fix SDMA and compute validation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit a0559012a18a5a6ad87516e982892765a403b8ab ]
The CSA and EOP buffers have different alignement requirements. Hardcode them for now as a bug fix. A proper query will be added in a subsequent patch.
v2: verify gfx shadow helper callback (Prike)
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +14 -5
@@ -254,7 +254,6 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,struct amdgpu_mqd *mqd_hw_default = &adev->mqds[queue->queue_type];struct drm_amdgpu_userq_in *mqd_user = args_in;struct amdgpu_mqd_prop *userq_props; -struct amdgpu_gfx_shadow_info shadow_info;int r;/* Structure to initialize MQD for userqueue using generic MQD init function */
@@ -280,8 +279,6 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, userq_props->doorbell_index = queue->doorbell_index; userq_props->fence_address = queue->fence_drv->gpu_addr; -if (adev->gfx.funcs->get_gfx_shadow_info) - adev->gfx.funcs->get_gfx_shadow_info (adev, &shadow_info, true);if (queue->queue_type ==AMDGPU_HW_IP_COMPUTE ) {struct drm_amdgpu_userq_mqd_compute_gfx11 *compute_mqd;
@@ -299,7 +296,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, } r =amdgpu_userq_input_va_validate (queue, compute_mqd->eop_va, -max_t (u32,PAGE_SIZE ,AMDGPU_GPU_PAGE_SIZE )); +2048 );if (r) goto free_mqd;
@@ -312,6 +309,14 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,kfree (compute_mqd); }else if (queue->queue_type ==AMDGPU_HW_IP_GFX ) {struct drm_amdgpu_userq_mqd_gfx11 *mqd_gfx_v11; +struct amdgpu_gfx_shadow_info shadow_info; + +if (adev->gfx.funcs->get_gfx_shadow_info) { + adev->gfx.funcs->get_gfx_shadow_info (adev, &shadow_info, true); + }else { + r = -EINVAL ; + goto free_mqd; + }if (mqd_user->mqd_size !=sizeof (*mqd_gfx_v11) || !mqd_user->mqd) {DRM_ERROR ("Invalid GFX MQD\n" );
@@ -335,6 +340,10 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, shadow_info.shadow_size);if (r) goto free_mqd; + r =amdgpu_userq_input_va_validate (queue, mqd_gfx_v11->csa_va, + shadow_info.csa_size); +if (r) + goto free_mqd;kfree (mqd_gfx_v11); }else if (queue->queue_type ==AMDGPU_HW_IP_DMA ) {
@@ -353,7 +362,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr, goto free_mqd; } r =amdgpu_userq_input_va_validate (queue, mqd_sdma_v11->csa_va, - shadow_info.csa_size); +32 );if (r) goto free_mqd;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 135/614 wifi: iwlwifi: mld: add null check for kzalloc() in iwl_mld_send_proto_offload()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Qiang <[email protected]>
[ Upstream commit 3df28496673bd8009f1cd3a85a63650c96e369f4 ]
Add a missing NULL pointer check after kzalloc() in iwl_mld_send_proto_offload(). Without this check, a failed allocation could lead to a NULL dereference.
--- drivers/net/wireless/intel/iwlwifi/mld/d3.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/mld/d3.c +4 -0
@@ -1794,6 +1794,10 @@ iwl_mld_send_proto_offload(struct iwl_mld *mld,u32 enabled =0 ; cmd =kzalloc (hcmd.len[0 ],GFP_KERNEL ); +if (!cmd) { +IWL_DEBUG_WOWLAN (mld,"Failed to allocate proto offload cmd\n" ); +return -ENOMEM ; + }#if IS_ENABLED (CONFIG_IPV6 )struct iwl_mld_vif *mld_vif =iwl_mld_vif_from_mac80211 (vif);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 136/614 Revert "mtd: rawnand: marvell: fix layouts"
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aryan Srivastava <[email protected]>
[ Upstream commit fbd72cb463fdea3a0c900dd5d6e813cdebc3a73c ]
This reverts commit e6a30d0c48a1e8a68f1cc413bee65302ab03ddfb.
This change resulted in the 8bit ECC layouts having the incorrect amount of read/write chunks, the last spare bytes chunk would always be missed.
--- drivers/mtd/nand/raw/marvell_nand.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/marvell_nand.c +8 -5
@@ -290,13 +290,16 @@ static const struct marvell_hw_ecc_layout marvell_nfc_layouts[] = {MARVELL_LAYOUT (2048 ,512 ,4 ,1 ,1 ,2048 ,32 ,30 ,0 ,0 ,0 ),MARVELL_LAYOUT (2048 ,512 ,8 ,2 ,1 ,1024 ,0 ,30 ,1024 ,32 ,30 ),MARVELL_LAYOUT (2048 ,512 ,8 ,2 ,1 ,1024 ,0 ,30 ,1024 ,64 ,30 ), -MARVELL_LAYOUT (2048 ,512 ,16 ,4 ,4 ,512 ,0 ,30 ,0 ,32 ,30 ), +MARVELL_LAYOUT (2048 ,512 ,12 ,3 ,2 ,704 ,0 ,30 ,640 ,0 ,30 ), +MARVELL_LAYOUT (2048 ,512 ,16 ,5 ,4 ,512 ,0 ,30 ,0 ,32 ,30 ),MARVELL_LAYOUT (4096 ,512 ,4 ,2 ,2 ,2048 ,32 ,30 ,0 ,0 ,0 ), -MARVELL_LAYOUT (4096 ,512 ,8 ,4 ,4 ,1024 ,0 ,30 ,0 ,64 ,30 ), -MARVELL_LAYOUT (4096 ,512 ,16 ,8 ,8 ,512 ,0 ,30 ,0 ,32 ,30 ), +MARVELL_LAYOUT (4096 ,512 ,8 ,5 ,4 ,1024 ,0 ,30 ,0 ,64 ,30 ), +MARVELL_LAYOUT (4096 ,512 ,12 ,6 ,5 ,704 ,0 ,30 ,576 ,32 ,30 ), +MARVELL_LAYOUT (4096 ,512 ,16 ,9 ,8 ,512 ,0 ,30 ,0 ,32 ,30 ),MARVELL_LAYOUT (8192 ,512 ,4 ,4 ,4 ,2048 ,0 ,30 ,0 ,0 ,0 ), -MARVELL_LAYOUT (8192 ,512 ,8 ,8 ,8 ,1024 ,0 ,30 ,0 ,160 ,30 ), - MARVELL_LAYOUT( 8192, 512, 16, 16, 16, 512, 0, 30, 0, 32, 30), +MARVELL_LAYOUT (8192 ,512 ,8 ,9 ,8 ,1024 ,0 ,30 ,0 ,160 ,30 ), +MARVELL_LAYOUT (8192 ,512 ,12 ,12 ,11 ,704 ,0 ,30 ,448 ,64 ,30 ), + MARVELL_LAYOUT( 8192, 512, 16, 17, 16, 512, 0, 30, 0, 32, 30), };/**
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 137/614 mtd: nand: relax ECC parameter validation check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aryan Srivastava <[email protected]>
[ Upstream commit 050553c683f21eebd7d1020df9b2ec852e2a9e4e ]
Due to the custom handling and layouts of certain nand controllers this validity check will always fail for certain layouts. The check inherently depends on even chunk sizing and this is not always the case.
Modify the check to only print a warning, instead of failing to init the attached NAND. This allows various 8 bit and 12 ECC strength layouts to be used.
--- drivers/mtd/nand/raw/nand_base.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/nand_base.c +8 -5
@@ -6338,11 +6338,14 @@ static int nand_scan_tail(struct nand_chip *chip) ecc->steps = mtd->writesize / ecc->size;if (!base->ecc.ctx.nsteps) base->ecc.ctx.nsteps = ecc->steps; -if (ecc->steps * ecc->size != mtd->writesize) { -WARN (1 ,"Invalid ECC parameters\n" ); - ret = -EINVAL ; - goto err_nand_manuf_cleanup; - } + +/* +* Validity check: Warn if ECC parameters are not compatible with page size. +* Due to the custom handling of ECC blocks in certain controllers the check +* may result in an expected failure. +*/ +if (ecc->steps * ecc->size != mtd->writesize) +pr_warn ("ECC parameters may be invalid in reference to underlying NAND chip\n" );if (!ecc->total) { ecc->total = ecc->steps * ecc->bytes;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 138/614 mtd: rawnand: lpc32xx_slc: fix GPIO descriptor leak on probe error and remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit cdf44f1add4ec9ee80569d5a43e6e9bba0d74c7a ]
The driver calls gpiod_get_optional() in the probe function but never calls gpiod_put() in the remove function or in the probe error path. This leads to a GPIO descriptor resource leak. The lpc32xx_mlc.c driver in the same directory handles this correctly by calling gpiod_put() on both paths.
Add gpiod_put() in the remove function and in the probe error path to fix the resource leak.
--- drivers/mtd/nand/raw/lpc32xx_slc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/raw/lpc32xx_slc.c +2 -0
@@ -937,6 +937,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)dma_release_channel (host->dma_chan); enable_wp:lpc32xx_wp_enable (host); +gpiod_put (host->wp_gpio);return res; }
@@ -962,6 +963,7 @@ static void lpc32xx_nand_remove(struct platform_device *pdev)writel (tmp,SLC_CTRL (host->io_base));lpc32xx_wp_enable (host); +gpiod_put (host->wp_gpio); }static int lpc32xx_nand_resume (struct platform_device *pdev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 139/614 bpf: Refactor stack map trace depth calculation into helper function
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaud Lecomte <[email protected]>
[ Upstream commit e17d62fedd10ae56e2426858bd0757da544dbc73 ]
Extract the duplicated maximum allowed depth computation for stack traces stored in BPF stacks from bpf_get_stackid() and __bpf_get_stack() into a dedicated stack_map_calculate_max_depth() helper function.
This unifies the logic for:
- The max depth computation
- Enforcing the sysctl_perf_event_max_stack limit
No functional changes for existing code paths.
Stable-dep-of: 23f852daa4ba ("bpf: Fix stackmap overflow check in __bpf_get_stackid()")
--- kernel/bpf/stackmap.c | 47 +++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 15 deletions(-)
kernel/bpf/stackmap.c +32 -15
@@ -42,6 +42,28 @@ static inline int stack_map_data_size(struct bpf_map *map) sizeof(struct bpf_stack_build_id) : sizeof(u64); } +/** +* stack_map_calculate_max_depth - Calculate maximum allowed stack trace depth +* @size: Size of the buffer/map value in bytes +* @elem_size: Size of each stack trace element +* @flags: BPF stack trace flags (BPF_F_USER_STACK, BPF_F_USER_BUILD_ID, ...) +* +* Return: Maximum number of stack trace entries that can be safely stored +*/ +static u32 stack_map_calculate_max_depth (u32 size,u32 elem_size,u64 flags) +{ +u32 skip = flags &BPF_F_SKIP_FIELD_MASK ; +u32 max_depth; +u32 curr_sysctl_max_stack =READ_ONCE (sysctl_perf_event_max_stack); + + max_depth = size / elem_size; + max_depth += skip; +if (max_depth > curr_sysctl_max_stack) +return curr_sysctl_max_stack; + +return max_depth; +} +static int prealloc_elems_and_freelist (struct bpf_stack_map *smap) { u64 elem_size = sizeof(struct stack_map_bucket) +
@@ -300,20 +322,17 @@ static long __bpf_get_stackid(struct bpf_map *map, BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map, u64, flags) { -u32 max_depth = map->value_size /stack_map_data_size (map); -u32 skip = flags &BPF_F_SKIP_FIELD_MASK ; +u32 elem_size =stack_map_data_size (map);bool user = flags &BPF_F_USER_STACK ;struct perf_callchain_entry *trace;bool kernel = !user; +u32 max_depth;if (unlikely (flags & ~(BPF_F_SKIP_FIELD_MASK |BPF_F_USER_STACK |BPF_F_FAST_STACK_CMP |BPF_F_REUSE_STACKID )))return -EINVAL ; - max_depth += skip; -if (max_depth > sysctl_perf_event_max_stack) - max_depth = sysctl_perf_event_max_stack; - + max_depth =stack_map_calculate_max_depth (map->value_size, elem_size, flags); trace =get_perf_callchain (regs, kernel, user, max_depth, false, false);
@@ -406,7 +425,7 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,struct perf_callchain_entry *trace_in, void *buf, u32 size, u64 flags, bool may_fault) { - u32 trace_nr, copy_len, elem_size, num_elem, max_depth; + u32 trace_nr, copy_len, elem_size, max_depth;bool user_build_id = flags &BPF_F_USER_BUILD_ID ;bool crosstask = task && task != current;u32 skip = flags &BPF_F_SKIP_FIELD_MASK ;
@@ -438,21 +457,20 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task, goto clear; } - num_elem = size / elem_size; - max_depth = num_elem + skip; -if (sysctl_perf_event_max_stack < max_depth) - max_depth = sysctl_perf_event_max_stack; + max_depth =stack_map_calculate_max_depth (size, elem_size, flags);if (may_fault)rcu_read_lock ();/* need RCU for perf's callchain below */ -if (trace_in) +if (trace_in) { trace = trace_in; -else if (kernel && task) + trace->nr =min_t (u32, trace->nr, max_depth); + }else if (kernel && task) { trace =get_callchain_entry_for_task (task, max_depth); -else + }else { trace =get_perf_callchain (regs, kernel, user, max_depth, crosstask, false); + }if (unlikely (!trace) || trace->nr < skip) {if (may_fault)
@@ -461,7 +479,6 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task, } trace_nr = trace->nr - skip; - trace_nr = (trace_nr <= num_elem) ? trace_nr : num_elem; copy_len = trace_nr * elem_size; ips = trace->ip + skip;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 140/614 bpf: Fix stackmap overflow check in __bpf_get_stackid()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaud Lecomte <[email protected]>
[ Upstream commit 23f852daa4bab4d579110e034e4d513f7d490846 ]
Syzkaller reported a KASAN slab-out-of-bounds write in __bpf_get_stackid() when copying stack trace data. The issue occurs when the perf trace
contains more stack entries than the stack map bucket can hold, leading to an out-of-bounds write in the bucket's data array.
--- kernel/bpf/stackmap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
kernel/bpf/stackmap.c +8 -7
@@ -251,8 +251,8 @@ static long __bpf_get_stackid(struct bpf_map *map, { struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);struct stack_map_bucket *bucket, *new_bucket, *old_bucket; +u32 hash, id, trace_nr, trace_len, i, max_depth;u32 skip = flags &BPF_F_SKIP_FIELD_MASK ; -u32 hash, id, trace_nr, trace_len, i;bool user = flags &BPF_F_USER_STACK ;u64 *ips;bool hash_matches;
@@ -261,7 +261,8 @@ static long __bpf_get_stackid(struct bpf_map *map,/* skipping more than usable stack trace */ return -EFAULT ; - trace_nr = trace->nr - skip; + max_depth =stack_map_calculate_max_depth (map->value_size,stack_map_data_size (map), flags); + trace_nr =min_t (u32, trace->nr - skip, max_depth - skip); trace_len = trace_nr *sizeof (u64); ips = trace->ip + skip; hash =jhash2 ((u32 *)ips, trace_len /sizeof (u32),0 );
@@ -390,15 +391,11 @@ BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx,return -EFAULT ; nr_kernel =count_kernel_ip (trace); +__u64 nr = trace->nr;/* save original */ if (kernel) { -__u64 nr = trace->nr; - trace->nr = nr_kernel; ret =__bpf_get_stackid (map, trace, flags); - -/* restore nr */ - trace->nr = nr; }else {/* user */ u64 skip = flags &BPF_F_SKIP_FIELD_MASK ;
@@ -409,6 +406,10 @@ BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx, flags = (flags & ~BPF_F_SKIP_FIELD_MASK ) | skip; ret =__bpf_get_stackid (map, trace, flags); } + +/* restore nr */ + trace->nr = nr; +return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 141/614 perf/x86/intel/cstate: Remove PC3 support from LunarLake
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit 4ba45f041abe60337fdeeb68553b9ee1217d544e ]
LunarLake doesn't support Package C3. Remove the PC3 residency counter support from LunarLake.
--- arch/x86/events/intel/cstate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/events/intel/cstate.c +1 -2
@@ -70,7 +70,7 @@* perf code: 0x01 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, * GLM,CNL,KBL,CML,ICL,TGL,TNT,RKL, -* ADL,RPL,MTL,ARL,LNL +* ADL,RPL,MTL,ARL * Scope: Package (physical package) * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. * perf code: 0x02
@@ -522,7 +522,6 @@ static const struct cstate_model lnl_cstates __initconst = { BIT(PERF_CSTATE_CORE_C7_RES), .pkg_events =BIT (PERF_CSTATE_PKG_C2_RES ) | -BIT (PERF_CSTATE_PKG_C3_RES ) |BIT (PERF_CSTATE_PKG_C6_RES ) | BIT(PERF_CSTATE_PKG_C10_RES), };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 142/614 task_work: Fix NMI race condition
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit ef1ea98c8fffe227e5319215d84a53fa2a4bcebc ]
__schedule()
// disable irqs
<NMI>
task_work_add(current, work, TWA_NMI_CURRENT);
</NMI>
// current = next;
// enable irqs
<IRQ>
task_work_set_notify_irq()
test_and_set_tsk_thread_flag(current,
TIF_NOTIFY_RESUME); // wrong task!
</IRQ>
// original task skips task work on its next return to user (or exit!)--- kernel/task_work.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/task_work.c +7 -1
@@ -9,7 +9,12 @@ static struct callback_head work_exited; /* all we need is ->next == NULL */#ifdef CONFIG_IRQ_WORK static void task_work_set_notify_irq (struct irq_work *entry) { -test_and_set_tsk_thread_flag (current,TIF_NOTIFY_RESUME ); +/* +* no-op IPI +* +* TWA_NMI_CURRENT will already have set the TIF flag, all +* this interrupt does it tickle the return-to-user path. +*/ } static DEFINE_PER_CPU(struct irq_work, irq_work_NMI_resume) =IRQ_WORK_INIT_HARD (task_work_set_notify_irq);
@@ -86,6 +91,7 @@ int task_work_add(struct task_struct *task, struct callback_head *work,break ;#ifdef CONFIG_IRQ_WORK case TWA_NMI_CURRENT : +set_tsk_thread_flag (current,TIF_NOTIFY_RESUME );irq_work_queue (this_cpu_ptr (&irq_work_NMI_resume));break ;#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 143/614 drm/rcar-du: dsi: Fix missing parameter in RXSETR_...EN macros
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 42bbf82b73bda18bbc3e158cb6fda040bb586feb ]
The RXSETR_CRCEN(n) and RXSETR_ECCEN(n) macros both take parameter (n), add the missing macro parameter. Neither of those macros is used by the driver, so for now the bug is harmless.
--- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h +2 -2
@@ -50,8 +50,8 @@#define TXCMPPD3R 0x16c#define RXSETR 0x200 -#define RXSETR_CRCEN (((n) & 0xf) << 24) -#define RXSETR_ECCEN (((n) & 0xf) << 16) +#define RXSETR_CRCEN (n) (((n) & 0xf) << 24) +#define RXSETR_ECCEN (n) (((n) & 0xf) << 16)#define RXPSETR 0x210#define RXPSETR_LPPDACC (1 << 0)#define RXPSR 0x220
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 144/614 x86/dumpstack: Prevent KASAN false positive warnings in __show_regs()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengda Wu <[email protected]>
[ Upstream commit ced37e9ceae50e4cb6cd058963bd315ec9afa651 ]
When triggering a stack dump via sysrq (echo t > /proc/sysrq-trigger), KASAN may report false-positive out-of-bounds access:
BUG: KASAN: out-of-bounds in __show_regs+0x4b/0x340
Call Trace:
dump_stack_lvl
print_address_description.constprop.0
print_report
__show_regs
show_trace_log_lvl
sched_show_task
show_state_filter
sysrq_handle_showstate
__handle_sysrq
write_sysrq_trigger
proc_reg_write
vfs_write
ksys_write
do_syscall_64
entry_SYSCALL_64_after_hwframeThe issue occurs as follows:
Task A (walk other tasks' stacks) Task B (running)
1. echo t > /proc/sysrq-trigger
show_trace_log_lvl
regs = unwind_get_entry_regs()
show_regs_if_on_stack(regs)
2. The stack value pointed by regs keeps changing, and so are the tags in its KASAN shadow region.
__show_regs(regs)
regs->ax, regs->bx, ...
3. hit KASAN redzones, OOB
When task A walks task B's stack without suspending it, the continuous changes in task B's stack (and corresponding KASAN shadow tags) may cause task A to hit KASAN redzones when accessing obsolete values on the stack, resulting in false positive reports.
Simply stopping the task before unwinding is not a viable fix, as it would alter the state intended to inspect. This is especially true for diagnosing misbehaving tasks (e.g., in a hard lockup), where stopping might fail or hide the root cause by changing the call stack.
Therefore, fix this by disabling KASAN checks during asynchronous stack unwinding, which is identified when the unwinding task does not match the current task (task != current).
[ bp: Align arguments on function's opening brace. ]
--- arch/x86/kernel/dumpstack.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
arch/x86/kernel/dumpstack.c +21 -2
@@ -181,8 +181,8 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,* in false positive reports. Disable instrumentation to avoid those. */ __no_kmsan_checks -static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, -unsigned long *stack,const char *log_lvl) +static void __show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, +unsigned long *stack,const char *log_lvl) {struct unwind_state state;struct stack_info stack_info = {0 };
@@ -303,6 +303,25 @@ static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, } } +static void show_trace_log_lvl (struct task_struct *task,struct pt_regs *regs, +unsigned long *stack,const char *log_lvl) +{ +/* +* Disable KASAN to avoid false positives during walking another +* task's stacks, as values on these stacks may change concurrently +* with task execution. +*/ +bool disable_kasan = task && task != current; + +if (disable_kasan) +kasan_disable_current (); + +__show_trace_log_lvl (task, regs, stack, log_lvl); + +if (disable_kasan) +kasan_enable_current (); +} +void show_stack (struct task_struct *task,unsigned long *sp,const char *loglvl) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 145/614 accel/ivpu: Remove skip of dma unmap for imported buffers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Falkowski <[email protected]>
[ Upstream commit c063c1bbee67391f12956d2ffdd5da00eb87ff79 ]
Rework of imported buffers introduced in the commit e0c0891cd63b ("accel/ivpu: Rework bind/unbind of imported buffers") switched the logic of imported buffers by dma mapping/unmapping them just as the regular buffers.
The commit didn't include removal of skipping dma unmap of imported buffers which results in them being mapped without unmapping.
--- drivers/accel/ivpu/ivpu_gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/accel/ivpu/ivpu_gem.c +0 -3
@@ -157,9 +157,6 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo) bo->ctx =NULL ; } -if (drm_gem_is_imported (&bo->base.base)) -return ; -if (bo->base.sgt) {if (bo->base.base.import_attach) { dma_buf_unmap_attachment(bo->base.base.import_attach,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 146/614 tools/nolibc/stdio: let perror work when NOLIBC_IGNORE_ERRNO is set
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit c485ca3aff2442adea4c08ceb5183e671ebed22a ]
There is no errno variable when NOLIBC_IGNORE_ERRNO is defined. As such, simply print the message with "unknown error" rather than the integer value of errno.
--- tools/include/nolibc/stdio.h | 4 ++++ 1 file changed, 4 insertions(+)
tools/include/nolibc/stdio.h +4 -0
@@ -600,7 +600,11 @@ int sscanf(const char *str, const char *format, ...)static __attribute__((unused))void perror (const char *msg) { +#ifdef NOLIBC_IGNORE_ERRNO +fprintf (stderr,"%s%sunknown error\n" , (msg && *msg) ? msg :"" , (msg && *msg) ?": " :"" ); +#else fprintf (stderr,"%s%serrno=%d\n" , (msg && *msg) ? msg :"" , (msg && *msg) ?": " :"" , errno); +#endif } static __attribute__((unused))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 147/614 tools/nolibc/dirent: avoid errno in readdir_r
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 4ada5679f18dbbe92d87c37a842c3368e6ab5e4a ]
Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use sys_lseek instead of lseek as that avoids using errno.
--- tools/include/nolibc/dirent.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/include/nolibc/dirent.h +3 -3
@@ -86,9 +86,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)* readdir() can only return one entry at a time. * Make sure the non-returned ones are not skipped. */ - ret =lseek (fd, ldir->d_off,SEEK_SET ); -if (ret ==-1 ) -return errno; + ret =sys_lseek (fd, ldir->d_off,SEEK_SET ); +if (ret <0 ) +return -ret; entry->d_ino = ldir->d_ino;/* the destination should always be big enough */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 148/614 clk: qcom: gcc-qcs615: Update the SDCC clock to use shared_floor_ops
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 0820c9373369c83de5202871d02682d583a91a9c ]
Fix "gcc_sdcc2_apps_clk_src: rcg didn't update its configuration" during boot. This happens due to the floor_ops tries to update the rcg configuration even if the clock is not enabled.
The shared_floor_ops ensures that the RCG is safely parked and the new parent configuration is cached in the parked_cfg when the clock is off.
Ensure to use the ops for the other SDCC clock instances as well.
--- drivers/clk/qcom/gcc-qcs615.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/gcc-qcs615.c +3 -3
@@ -784,7 +784,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { .name = "gcc_sdcc1_apps_clk_src", .parent_data = gcc_parent_data_1, .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_floor_ops, + .ops = &clk_rcg2_shared_floor_ops, }, };
@@ -806,7 +806,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { .name = "gcc_sdcc1_ice_core_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_floor_ops, + .ops = &clk_rcg2_shared_floor_ops, }, };
@@ -830,7 +830,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .name = "gcc_sdcc2_apps_clk_src", .parent_data = gcc_parent_data_8, .num_parents = ARRAY_SIZE(gcc_parent_data_8), - .ops = &clk_rcg2_floor_ops, + .ops = &clk_rcg2_shared_floor_ops, }, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 149/614 soc: qcom: smem: fix hwspinlock resource leak in probe error paths
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit dc5db35073a19f6d3c30bea367b551c1a784ef8f ]
The hwspinlock acquired via hwspin_lock_request_specific() is not released on several error paths. This results in resource leakage when probe fails.
Switch to devm_hwspin_lock_request_specific() to automatically handle cleanup on probe failure. Remove the manual hwspin_lock_free() in qcom_smem_remove() as devm handles it automatically.
--- drivers/soc/qcom/smem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/soc/qcom/smem.c +1 -2
@@ -1190,7 +1190,7 @@ static int qcom_smem_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, hwlock_id,"failed to retrieve hwlock\n" ); - smem->hwlock =hwspin_lock_request_specific (hwlock_id); + smem->hwlock =devm_hwspin_lock_request_specific (&pdev->dev, hwlock_id);if (!smem->hwlock)return -ENXIO ;
@@ -1243,7 +1243,6 @@ static void qcom_smem_remove(struct platform_device *pdev) {platform_device_unregister (__smem->socinfo); -hwspin_lock_free (__smem->hwlock); __smem =NULL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 150/614 pinctrl: stm32: fix hwspinlock resource leak in probe function
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 002679f79ed605e543fbace465557317cd307c9a ]
In stm32_pctl_probe(), hwspin_lock_request_specific() is called to request a hwspinlock, but the acquired lock is not freed on multiple error paths after this call. This causes resource leakage when the function fails to initialize properly.
Use devm_hwspin_lock_request_specific() instead of hwspin_lock_request_specific() to automatically manage the hwspinlock resource lifecycle.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
@@ -1671,7 +1671,7 @@ int stm32_pctl_probe(struct platform_device *pdev)if (hwlock_id == -EPROBE_DEFER )return hwlock_id; }else { - pctl->hwlock =hwspin_lock_request_specific (hwlock_id); + pctl->hwlock =devm_hwspin_lock_request_specific (dev, hwlock_id); }spin_lock_init (&pctl->irqmux_lock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 151/614 drm: nova: select NOVA_CORE
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
[ Upstream commit 97ad568cd6a58804129ba071f3258b5c4782fb0d ]
The nova-drm driver does not provide any value without nova-core being selected as well, hence select NOVA_CORE.
--- drivers/gpu/drm/nova/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nova/Kconfig +1 -0
@@ -4,6 +4,7 @@ config DRM_NOVA depends on PCI depends on RUST select AUXILIARY_BUS + select NOVA_CORE default n help Choose this if you want to build the Nova DRM driver for Nvidia
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 152/614 accel/ivpu: Fix race condition when unbinding BOs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Rusinowicz <[email protected]>
[ Upstream commit 00812636df370bedf4e44a0c81b86ea96bca8628 ]
Fix 'Memory manager not clean during takedown' warning that occurs when ivpu_gem_bo_free() removes the BO from the BOs list before it gets unmapped. Then file_priv_unbind() triggers a warning in drm_mm_takedown() during context teardown.
Protect the unmapping sequence with bo_list_lock to ensure the BO is always fully unmapped when removed from the list. This ensures the BO is either fully unmapped at context teardown time or present on the list and unmapped by file_priv_unbind().
--- drivers/accel/ivpu/ivpu_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +2 -1
@@ -314,7 +314,6 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)mutex_lock (&vdev->bo_list_lock);list_del (&bo->bo_list_node); -mutex_unlock (&vdev->bo_list_lock);drm_WARN_ON (&vdev->drm, !drm_gem_is_imported (&bo->base.base) && !dma_resv_test_signaled (obj->resv,DMA_RESV_USAGE_READ ));
@@ -325,6 +324,8 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)ivpu_bo_unbind_locked (bo);ivpu_bo_unlock (bo); +mutex_unlock (&vdev->bo_list_lock); +drm_WARN_ON (&vdev->drm, bo->mmu_mapped);drm_WARN_ON (&vdev->drm, bo->ctx);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 153/614 pidfs: add missing PIDFD_INFO_SIZE_VER1
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 4061c43a99772c66c378cfacaa71550ab3b35909 ]
We grew struct pidfd_info not too long ago.
--- include/uapi/linux/pidfd.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/pidfd.h +1 -0
@@ -28,6 +28,7 @@#define PIDFD_INFO_COREDUMP (1UL << 4)/* Only returned if requested. */ #define PIDFD_INFO_SIZE_VER0 64/* sizeof first published struct */ +#define PIDFD_INFO_SIZE_VER1 72/* sizeof second published struct */ /* * Values for @coredump_mask in pidfd_info.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 154/614 pidfs: add missing BUILD_BUG_ON() assert on struct pidfd_info
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit d8fc51d8fa3b9894713e7eebcf574bee488fa3e1 ]
Validate that the size of struct pidfd_info is correctly updated.
--- fs/pidfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/pidfs.c +2 -0
@@ -306,6 +306,8 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)const struct cred *c;__u64 mask; +BUILD_BUG_ON (sizeof (struct pidfd_info ) !=PIDFD_INFO_SIZE_VER1 ); +if (!uinfo)return -EINVAL ;if (usize <PIDFD_INFO_SIZE_VER0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 155/614 arm64: dts: ti: k3-j784s4: Fix I2C pinmux pull configuration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aniket Limaye <[email protected]>
[ Upstream commit 671c852fc53d1b6f5eccdb03c1889a484c9d1996 ]
The I2C pins for some of the instances on J784S4/J742S2/AM69 are configured as PIN_INPUT_PULLUP while these pins are open-drain type and do not support internal pull-ups [0][1][2]. The pullup configuration bits in the corresponding padconfig registers are reserved and any writes to them have no effect and readback checks on those bits fail.
Update the pinmux settings to use PIN_INPUT instead of PIN_INPUT_PULLUP to reflect the correct hardware behaviour.
[0]: https://www.ti.com/lit/gpn/tda4ah-q1 (J784S4 Datasheet: Table 5-1. Pin Attributes) [1]: https://www.ti.com/lit/gpn/tda4ape-q1 (J742S2 Datasheet: Table 5-1. Pin Attributes) [2]: https://www.ti.com/lit/gpn/am69a (AM69 Datasheet: Table 5-1. Pin Attributes)
--- arch/arm64/boot/dts/ti/k3-am69-sk.dts | 8 ++++---- arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am69-sk.dts +4 -4
@@ -236,8 +236,8 @@ J784S4_IOPAD(0x0d4, PIN_OUTPUT, 11) /* (AN38) SPI0_CLK.UART8_TXD */ main_i2c0_pins_default: main-i2c0-default-pins { pinctrl-single,pins = < - J784S4_IOPAD(0x0e0, PIN_INPUT_PULLUP, 0) /* (AN36) I2C0_SCL */ - J784S4_IOPAD(0x0e4, PIN_INPUT_PULLUP, 0) /* (AP37) I2C0_SDA */ + J784S4_IOPAD(0x0e0, PIN_INPUT, 0) /* (AN36) I2C0_SCL */ + J784S4_IOPAD(0x0e4, PIN_INPUT, 0) /* (AP37) I2C0_SDA */ >; };
@@ -416,8 +416,8 @@ J784S4_WKUP_IOPAD(0x088, PIN_OUTPUT, 0) /* (J37) WKUP_GPIO0_12.MCU_UART0_TXD */ mcu_i2c0_pins_default: mcu-i2c0-default-pins { pinctrl-single,pins = < - J784S4_WKUP_IOPAD(0x0a0, PIN_INPUT_PULLUP, 0) /* (M35) MCU_I2C0_SCL */ - J784S4_WKUP_IOPAD(0x0a4, PIN_INPUT_PULLUP, 0) /* (G34) MCU_I2C0_SDA */ + J784S4_WKUP_IOPAD(0x0a0, PIN_INPUT, 0) /* (M35) MCU_I2C0_SCL */ + J784S4_WKUP_IOPAD(0x0a4, PIN_INPUT, 0) /* (G34) MCU_I2C0_SDA */ >; };
arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi +2 -2
@@ -270,8 +270,8 @@ J784S4_IOPAD(0x0d4, PIN_OUTPUT, 11) /* (AN38) SPI0_CLK.UART8_TXD */ main_i2c0_pins_default: main-i2c0-default-pins { pinctrl-single,pins = < - J784S4_IOPAD(0x0e0, PIN_INPUT_PULLUP, 0) /* (AN36) I2C0_SCL */ - J784S4_IOPAD(0x0e4, PIN_INPUT_PULLUP, 0) /* (AP37) I2C0_SDA */ + J784S4_IOPAD(0x0e0, PIN_INPUT, 0) /* (AN36) I2C0_SCL */ + J784S4_IOPAD(0x0e4, PIN_INPUT, 0) /* (AP37) I2C0_SDA */ >; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 156/614 i3c: fix refcount inconsistency in i3c_master_register
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 9d4f219807d5ac11fb1d596e4ddb09336b040067 ]
In i3c_master_register, a possible refcount inconsistency has been identified, causing possible resource leak.
Function of_node_get increases the refcount of parent->of_node. If function i3c_bus_init fails, the function returns immediately without a corresponding decrease, resulting in an inconsistent refcounter.
Move call i3c_bus_init() after device_initialize() to let callback i3c_masterdev_release() release of_node.
--- drivers/i3c/master.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i3c/master.c +4 -4
@@ -2883,10 +2883,6 @@ int i3c_master_register(struct i3c_master_controller *master,INIT_LIST_HEAD (&master->boardinfo.i2c);INIT_LIST_HEAD (&master->boardinfo.i3c); - ret =i3c_bus_init (i3cbus, master->dev.of_node); -if (ret) -return ret; -device_initialize (&master->dev);dev_set_name (&master->dev,"i3c-%d" , i3cbus->id);
@@ -2894,6 +2890,10 @@ int i3c_master_register(struct i3c_master_controller *master, master->dev.coherent_dma_mask = parent->coherent_dma_mask; master->dev.dma_parms = parent->dma_parms; + ret =i3c_bus_init (i3cbus, master->dev.of_node); +if (ret) + goto err_put_dev; + ret =of_populate_i3c_bus (master);if (ret) goto err_put_dev;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 157/614 i3c: master: svc: Prevent incomplete IBI transaction
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Chu <[email protected]>
[ Upstream commit 3a36273e5a07dda0ccec193800f3b78c3c0380af ]
If no free IBI slot is available, svc_i3c_master_handle_ibi returns immediately. This causes the STOP condition to be missed because the EmitStop request is sent when the transfer is not complete. To resolve this, svc_i3c_master_handle_ibi must wait for the transfer to complete before returning.
--- drivers/i3c/master/svc-i3c-master.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/i3c/master/svc-i3c-master.c +14 -8
@@ -406,21 +406,27 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,int ret, val;u8 *buf; - slot =i3c_generic_ibi_get_free_slot (data->ibi_pool); -if (!slot) -return -ENOSPC ; - - slot->len =0 ; - buf = slot->data; - +/* +* Wait for transfer to complete before returning. Otherwise, the EmitStop +* request might be sent when the transfer is not complete. +*/ ret =readl_relaxed_poll_timeout (master->regs +SVC_I3C_MSTATUS , val,SVC_I3C_MSTATUS_COMPLETE (val),0 ,1000 );if (ret) {dev_err (master->dev,"Timeout when polling for COMPLETE\n" ); -i3c_generic_ibi_recycle_slot (data->ibi_pool, slot);return ret; } + slot =i3c_generic_ibi_get_free_slot (data->ibi_pool); +if (!slot) { +dev_dbg (master->dev,"No free ibi slot, drop the data\n" ); +writel (SVC_I3C_MDATACTRL_FLUSHRB , master->regs +SVC_I3C_MDATACTRL ); +return -ENOSPC ; + } + + slot->len =0 ; + buf = slot->data; +while (SVC_I3C_MSTATUS_RXPEND (readl (master->regs +SVC_I3C_MSTATUS )) && slot->len <SVC_I3C_FIFO_SIZE ) { mdatactrl =readl (master->regs +SVC_I3C_MDATACTRL );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 158/614 random: use offstack cpumask when necessary
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 5d49f1a5bd358d24e5f88b23b46da833de1dbec8 ]
The entropy generation function keeps a local cpu mask on the stack, which can trigger warnings in configurations with a large number of CPUs:
drivers/char/random.c:1292:20: error: stack frame size (1288) exceeds limit (1280) in 'try_to_generate_entropy' [-Werror,-Wframe-larger-than]
Use the cpumask interface to dynamically allocate it in those configurations.
--- drivers/char/random.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/char/random.c +12 -7
@@ -1296,6 +1296,7 @@ static void __cold try_to_generate_entropy(void)struct entropy_timer_state *stack =PTR_ALIGN ((void *)stack_bytes,SMP_CACHE_BYTES );unsigned int i, num_different =0 ;unsigned long last =random_get_entropy (); +cpumask_var_t timer_cpus;int cpu =-1 ;for (i =0 ; i <NUM_TRIAL_SAMPLES -1 ; ++i) {
@@ -1310,13 +1311,15 @@ static void __cold try_to_generate_entropy(void)atomic_set (&stack->samples,0 );timer_setup_on_stack (&stack->timer, entropy_timer,0 ); +if (!alloc_cpumask_var (&timer_cpus,GFP_KERNEL )) + goto out; +while (!crng_ready () && !signal_pending (current)) {/* * Check !timer_pending() and then ensure that any previous callback has finished * executing by checking timer_delete_sync_try(), before queueing the next one. */ if (!timer_pending (&stack->timer) &&timer_delete_sync_try (&stack->timer) >=0 ) { -struct cpumask timer_cpus;unsigned int num_cpus;/*
@@ -1326,19 +1329,19 @@ static void __cold try_to_generate_entropy(void)preempt_disable ();/* Only schedule callbacks on timer CPUs that are online. */ -cpumask_and (&timer_cpus,housekeeping_cpumask (HK_TYPE_TIMER ), cpu_online_mask); - num_cpus =cpumask_weight (&timer_cpus); +cpumask_and (timer_cpus,housekeeping_cpumask (HK_TYPE_TIMER ), cpu_online_mask); + num_cpus =cpumask_weight (timer_cpus);/* In very bizarre case of misconfiguration, fallback to all online. */ if (unlikely (num_cpus ==0 )) { - timer_cpus = *cpu_online_mask; - num_cpus =cpumask_weight (&timer_cpus); + *timer_cpus = *cpu_online_mask; + num_cpus =cpumask_weight (timer_cpus); }/* Basic CPU round-robin, which avoids the current CPU. */ do { - cpu =cpumask_next (cpu, &timer_cpus); + cpu =cpumask_next (cpu, timer_cpus);if (cpu >= nr_cpu_ids) - cpu =cpumask_first (&timer_cpus); + cpu =cpumask_first (timer_cpus); }while (cpu ==smp_processor_id () && num_cpus >1 );/* Expiring the timer at `jiffies` means it's the next tick. */
@@ -1354,6 +1357,8 @@ static void __cold try_to_generate_entropy(void) }mix_pool_bytes (&stack->entropy,sizeof (stack->entropy)); +free_cpumask_var (timer_cpus); +out:timer_delete_sync (&stack->timer);timer_destroy_on_stack (&stack->timer); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 159/614 docs: kdoc: fix duplicate section warning message
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit e5e7ca66a7fc6b8073c30a048e1157b88d427980 ]
The python version of the kernel-doc parser emits some strange warnings with just a line number in certain cases:
$ ./scripts/kernel-doc -Wall -none 'include/linux/virtio_config.h' Warning: 174 Warning: 184 Warning: 190 Warning: include/linux/virtio_config.h:226 No description found for return value of '__virtio_test_bit' Warning: include/linux/virtio_config.h:259 No description found for return value of 'virtio_has_feature' Warning: include/linux/virtio_config.h:283 No description found for return value of 'virtio_has_dma_quirk' Warning: include/linux/virtio_config.h:392 No description found for return value of 'virtqueue_set_affinity'
I eventually tracked this down to the lone call of emit_msg() in the KernelEntry class, which looks like:
self.emit_msg(self.new_start_line, f"duplicate section name '{name}'\n")
This looks like all the other emit_msg calls. Unfortunately, the definition within the KernelEntry class takes only a message parameter and not a line number. The intended message is passed as the warning!
Pass the filename to the KernelEntry class, and use this to build the log message in the same way as the KernelDoc class does.
To avoid future errors, mark the warning parameter for both emit_msg definitions as a keyword-only argument. This will prevent accidentally passing a string as the warning parameter in the future.
Also fix the call in dump_section to avoid an unnecessary additional newline.
Message-ID: <20251030-jk-fix-kernel-doc-duplicate-return-warning-v2-1-ec4b5c662881@intel.com>
--- scripts/lib/kdoc/kdoc_parser.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
scripts/lib/kdoc/kdoc_parser.py +10 -6
@@ -274,6 +274,8 @@ class KernelEntry: self.leading_space = None + self.fname = fname + # State flags self.brcount = 0 self.declaration_start_line = ln + 1
@@ -288,9 +290,11 @@ class KernelEntry: return '\n'.join(self._contents) + '\n' # TODO: rename to emit_message after removal of kernel-doc.pl - def emit_msg(self, log_msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" + log_msg = f"{self.fname}:{ln} {msg}" + if not warning: self.config.log.info(log_msg) return
@@ -336,7 +340,7 @@ class KernelEntry: # Only warn on user-specified duplicate section names if name != SECTION_DEFAULT: self.emit_msg(self.new_start_line, - f"duplicate section name '{name}'\n") + f"duplicate section name '{name}'") # Treat as a new paragraph - add a blank line self.sections[name] += '\n' + contents else:
@@ -387,15 +391,15 @@ class KernelDoc: self.emit_msg(0, 'Python 3.7 or later is required for correct results') - def emit_msg(self, ln, msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" - log_msg = f"{self.fname}:{ln} {msg}" - if self.entry: - self.entry.emit_msg(log_msg, warning) + self.entry.emit_msg(ln, msg, warning=warning) return + log_msg = f"{self.fname}:{ln} {msg}" + if warning: self.config.log.warning(log_msg) else:
Signature · 1 line
2.51.0
Re: [PATCH 6.18 159/614] docs: kdoc: fix duplicate section warning message
Quoted 93 lines · Greg Kroah-Hartman
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit
e5e7ca66a7fc6b8073c30a048e1157b88d427980]The python version of the kernel-doc parser emits some strange warnings with just a line number in certain cases:
$ ./scripts/kernel-doc -Wall -none 'include/linux/virtio_config.h' Warning: 174 Warning: 184 Warning: 190 Warning: include/linux/virtio_config.h:226 No description found for return value of '__virtio_test_bit' Warning: include/linux/virtio_config.h:259 No description found for return value of 'virtio_has_feature' Warning: include/linux/virtio_config.h:283 No description found for return value of 'virtio_has_dma_quirk' Warning: include/linux/virtio_config.h:392 No description found for return value of 'virtqueue_set_affinity'I eventually tracked this down to the lone call of
emit_msg()in the KernelEntry class, which looks like:
self.emit_msg(self.new_start_line, f"duplicate section name '{name}'\n")This looks like all the other
emit_msgcalls. Unfortunately, the definition within the KernelEntry class takes only a message parameter and not a line number. The intended message is passed as the warning!Pass the filename to the KernelEntry class, and use this to build the log message in the same way as the KernelDoc class does.
To avoid future errors, mark the warning parameter for both
emit_msgdefinitions as a keyword-only argument. This will prevent accidentally passing a string as the warning parameter in the future.Also fix the call in
dump_sectionto avoid an unnecessary additional newline.Fixes e3b42e94cf10 ("scripts/lib/kdoc/kdoc_parser.py: move kernel entry to a class")Signed-off-by Jacob Keller <[email protected]>Signed-off-by Jonathan Corbet <[email protected]>Message-ID: <20251030-jk-fix-kernel-doc-duplicate-return-warning-v2-1-ec4b5c662881@intel.com>
Signed-off-by Sasha Levin <[email protected]>--- scripts/lib/kdoc/kdoc_parser.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)scripts/lib/kdoc/kdoc_parser.py +7
-5@@ -274,6 +274,8 @@ class KernelEntry: self.leading_space = None + self.fname = fname + # State flags self.brcount = 0 self.declaration_start_line = ln + 1@@ -288,9 +290,11 @@ class KernelEntry: return '\n'.join(self._contents) + '\n' # TODO: rename to emit_message after removal of kernel-doc.pl - def emit_msg(self, log_msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" + log_msg = f"{self.fname}:{ln} {msg}" + if not warning: self.config.log.info(log_msg) return@@ -336,7 +340,7 @@ class KernelEntry: # Only warn on user-specified duplicate section names if name != SECTION_DEFAULT: self.emit_msg(self.new_start_line, - f"duplicate section name '{name}'\n") + f"duplicate section name '{name}'") # Treat as a new paragraph - add a blank line self.sections[name] += '\n' + contents else:@@ -387,15 +391,15 @@ class KernelDoc: self.emit_msg(0, 'Python 3.7 or later is required for correct results') - def emit_msg(self, ln, msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" - log_msg = f"{self.fname}:{ln} {msg}" -
scripts/lib/kdoc/kdoc_parser.py class KernelDoc: · line 405
Quoted 10 lines
scripts/lib/kdoc/kdoc_parser.py +3
-1if self.entry: - self.entry.emit_msg(log_msg, warning) + self.entry.emit_msg(ln, msg, warning=warning) return + log_msg = f"{self.fname}:{ln} {msg}" + if warning: self.config.log.warning(log_msg) else:
On 6.18.2-rc1 and 6.17.13-rc2, this patch causes amd64 kernel builds with my usual configs to fail with the following error:
CC drivers/gpu/drm/i915/i915_driver.o
Traceback (most recent call last):
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/./scripts/kernel-doc.py", line 339, in <module>
main()
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/./scripts/kernel-doc.py", line 310, in main
kfiles.parse(args.files, export_file=args.export_file)
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_files.py", line 222, in parse
self.parse_file(fname)
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_files.py", line 120, in parse_file
export_table, entries = doc.parse_kdoc()
^^^^^^^^^^^^^^^^
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py", line 1648, in parse_kdoc
self.state_actions[self.state](self, ln, line)
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py", line 1123, in process_normal
self.reset_state(ln)
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py", line 447, in reset_state
self.entry = KernelEntry(self.config, ln)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py", line 277, in __init__
self.fname = fname
^^^^^
NameError: name 'fname' is not defined
make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/i915/i915_driver.o] Error 1
make[6]: *** Deleting file 'drivers/gpu/drm/i915/i915_driver.o'
make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/i915] Error 2
make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
make[1]: *** [/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/Makefile:2010: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Here is a minimal config to reproduce (make a .config with just these 6 lines, then run make olddefconfig):
CONFIG_64BIT=yCONFIG_EXPERT=yCONFIG_PCI=yCONFIG_DRM=yCONFIG_DRM_I915=yCONFIG_DRM_I915_WERROR=y
This bug happens if and only if CONFIG_DRM_I915_WERROR=y. (By the way, allyesconfig and allmodconfig set CONFIG_COMPILE_TEST=y, which disables CONFIG_DRM_I915_DEBUG and CONFIG_DRM_I915_WERROR. So neither allyesconfig nor allmodconfig reproduce this.)
It happens whether building for amd64 or i386 (so CONFIG_64BIT=y is not strictly necessary). It happens on both fully updated Debian 12 Bookworm and fully updated Debian 13 Trixie. It happens both when compiling natively on amd64 and when cross-compiling from an arm64 system.
It happens on 6.18.2-rc1 and 6.17.13-rc2, but not on 6.19-rc1. Also, if I revert this patch on 6.18.2-rc1 or 6.17.13-rc2, the bug no longer reproduces.
Signature · 1 line
-Barry K. Nathan <[email protected]>
Greg Kroah-Hartman
maintainerRe: [PATCH 6.18 159/614] docs: kdoc: fix duplicate section warning message
Quoted 158 lines · Barry K. Nathan
Quoted 86 lines · Greg Kroah-Hartman
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit
e5e7ca66a7fc6b8073c30a048e1157b88d427980]The python version of the kernel-doc parser emits some strange warnings with just a line number in certain cases:
$ ./scripts/kernel-doc -Wall -none 'include/linux/virtio_config.h' Warning: 174 Warning: 184 Warning: 190 Warning: include/linux/virtio_config.h:226 No description found for return value of '__virtio_test_bit' Warning: include/linux/virtio_config.h:259 No description found for return value of 'virtio_has_feature' Warning: include/linux/virtio_config.h:283 No description found for return value of 'virtio_has_dma_quirk' Warning: include/linux/virtio_config.h:392 No description found for return value of 'virtqueue_set_affinity'I eventually tracked this down to the lone call of
emit_msg()in the KernelEntry class, which looks like:
self.emit_msg(self.new_start_line, f"duplicate section name '{name}'\n")This looks like all the other
emit_msgcalls. Unfortunately, the definition within the KernelEntry class takes only a message parameter and not a line number. The intended message is passed as the warning!Pass the filename to the KernelEntry class, and use this to build the log message in the same way as the KernelDoc class does.
To avoid future errors, mark the warning parameter for both
emit_msgdefinitions as a keyword-only argument. This will prevent accidentally passing a string as the warning parameter in the future.Also fix the call in
dump_sectionto avoid an unnecessary additional newline.Fixes e3b42e94cf10 ("scripts/lib/kdoc/kdoc_parser.py: move kernel entry to a class")Signed-off-by Jacob Keller <[email protected]>Signed-off-by Jonathan Corbet <[email protected]>Message-ID: <20251030-jk-fix-kernel-doc-duplicate-return-warning-v2-1-ec4b5c662881@intel.com>
Signed-off-by Sasha Levin <[email protected]>--- scripts/lib/kdoc/kdoc_parser.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)scripts/lib/kdoc/kdoc_parser.py +7
-4@@ -274,6 +274,8 @@ class KernelEntry: self.leading_space = None + self.fname = fname + # State flags self.brcount = 0 self.declaration_start_line = ln + 1@@ -288,9 +290,11 @@ class KernelEntry: return '\n'.join(self._contents) + '\n' # TODO: rename to emit_message after removal of kernel-doc.pl - def emit_msg(self, log_msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" + log_msg = f"{self.fname}:{ln} {msg}" + if not warning: self.config.log.info(log_msg) return@@ -336,7 +340,7 @@ class KernelEntry: # Only warn on user-specified duplicate section names if name != SECTION_DEFAULT: self.emit_msg(self.new_start_line, - f"duplicate section name '{name}'\n") + f"duplicate section name '{name}'") # Treat as a new paragraph - add a blank line self.sections[name] += '\n' + contents else:@@ -387,15 +391,15 @@ class KernelDoc: self.emit_msg(0, 'Python 3.7 or later is required for correct results') - def emit_msg(self, ln, msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" - log_msg = f"{self.fname}:{ln} {msg}"scripts/lib/kdoc/kdoc_parser.py class KernelDoc: · line 402
Quoted 10 lines
scripts/lib/kdoc/kdoc_parser.py +3
-2- if self.entry: - self.entry.emit_msg(log_msg, warning) + self.entry.emit_msg(ln, msg, warning=warning) return + log_msg = f"{self.fname}:{ln} {msg}" + if warning: self.config.log.warning(log_msg) else:On 6.18.2-rc1 and 6.17.13-rc2, this patch causes amd64 kernel builds with my usual configs to fail with the following error:
CC
drivers/gpu/drm/i915/i915_driver.o
Traceback (most recent call last):
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/./scripts/kernel-doc.py",
line 339, in <module>main()File "
/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/./scripts/kernel-doc.py",
line 310, in main
kfiles.parse(args.files, export_file=args.export_file)
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_files.py",
line 222, in parse
self.parse_file(fname)
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_files.py",
line 120, inparse_file
export_table, entries =doc.parse_kdoc()
^^^^^^^^^^^^^^^^
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py",
line 1648, inparse_kdoc
self.state_actions[self.state](self, ln, line)
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py",
line 1123, inprocess_normal
self.reset_state(ln)
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py",
line 447, inreset_state
self.entry =KernelEntry(self.config, ln)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/scripts/lib/kdoc/kdoc_parser.py",
line 277, in__init__
self.fname = fname
^^^^^
NameError: name 'fname' is not defined
make[6]: *** [scripts/Makefile.build:287:drivers/gpu/drm/i915/i915_driver.o] Error 1
make[6]: *** Deleting file 'drivers/gpu/drm/i915/i915_driver.o'
make[5]: *** [scripts/Makefile.build:556:drivers/gpu/drm/i915] Error 2 make[4]: *** [scripts/Makefile.build:556:drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:556:drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
make[1]: *** [/home/barryn/src/linux/build-amd64/linux-6.18.2-rc1/Makefile:2010: .] Error
2
make: *** [Makefile:248: __sub-make] Error 2Here is a minimal config to reproduce (make a .config with just these 6 lines, then run
make olddefconfig):
CONFIG_64BIT=yCONFIG_EXPERT=yCONFIG_PCI=yCONFIG_DRM=yCONFIG_DRM_I915=yCONFIG_DRM_I915_WERROR=yThis bug happens if and only if
CONFIG_DRM_I915_WERROR=y. (By the way, allyesconfig and allmodconfig setCONFIG_COMPILE_TEST=y, which disablesCONFIG_DRM_I915_DEBUGandCONFIG_DRM_I915_WERROR. So neither allyesconfig nor allmodconfig reproduce this.)
Quoted 8 lines
It happens whether building for amd64 or i386 (so
CONFIG_64BIT=yis not strictly necessary). It happens on both fully updated Debian 12 Bookworm and fully updated Debian 13 Trixie. It happens both when compiling natively on amd64 and when cross-compiling from an arm64 system.It happens on 6.18.2-rc1 and 6.17.13-rc2, but not on 6.19-rc1. Also, if I revert this patch on 6.18.2-rc1 or 6.17.13-rc2, the bug no longer reproduces.
Thanks, I'll go drop this from all queues.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 160/614 wifi: ath12k: fix potential memory leak in ath12k_wow_arp_ns_offload()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit be5febd51c478bc8e24ad3480435f2754a403b14 ]
When the call to ath12k_wmi_arp_ns_offload() fails, the temporary memory allocation for offload is not freed before returning. Fix that by freeing offload in the error path.
--- drivers/net/wireless/ath/ath12k/wow.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath12k/wow.c +1 -0
@@ -758,6 +758,7 @@ static int ath12k_wow_arp_ns_offload(struct ath12k *ar, bool enable)if (ret) {ath12k_warn (ar->ab,"failed to set arp ns offload vdev %i: enable %d, ret %d\n" , arvif->vdev_id, enable, ret); +kfree (offload);return ret; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 161/614 wifi: ath12k: fix reusing m3 memory
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 00575bb44b2c2aa53d0a768de2b80c9c1af0174d ]
During firmware recovery or suspend/resume, m3 memory could be reused if the size of the new m3 binary is equal to or less than that of the existing memory. There will be issues for the latter case, since m3_mem->size will be updated with a smaller value and this value is eventually used in the free path, where the original total size should be used instead.
To fix it, add a new member in m3_mem_region structure to track the original memory size and use it in free path.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
--- drivers/net/wireless/ath/ath12k/qmi.c | 11 +++++++---- drivers/net/wireless/ath/ath12k/qmi.h | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/qmi.c +7 -4
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include <linux/elf.h>
@@ -3114,9 +3114,10 @@ static void ath12k_qmi_m3_free(struct ath12k_base *ab)if (!m3_mem->vaddr)return ; -dma_free_coherent (ab->dev, m3_mem->size, +dma_free_coherent (ab->dev, m3_mem->total_size, m3_mem->vaddr, m3_mem->paddr); m3_mem->vaddr =NULL ; + m3_mem->total_size =0 ; m3_mem->size =0 ; }
@@ -3152,7 +3153,7 @@ static int ath12k_qmi_m3_load(struct ath12k_base *ab)/* In recovery/resume cases, M3 buffer is not freed, try to reuse that */ if (m3_mem->vaddr) { -if (m3_mem->size >= m3_len) +if (m3_mem->total_size >= m3_len) goto skip_m3_alloc;/* Old buffer is too small, free and reallocate */
@@ -3164,11 +3165,13 @@ static int ath12k_qmi_m3_load(struct ath12k_base *ab) GFP_KERNEL);if (!m3_mem->vaddr) {ath12k_err (ab,"failed to allocate memory for M3 with size %zu\n" , - fw->size); + m3_len); ret = -ENOMEM ; goto out; } + m3_mem->total_size = m3_len; + skip_m3_alloc:memcpy (m3_mem->vaddr, m3_data, m3_len); m3_mem->size = m3_len;
drivers/net/wireless/ath/ath12k/qmi.h +4 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #ifndef ATH12K_QMI_H
@@ -120,6 +120,9 @@ struct target_info { };struct m3_mem_region { +/* total memory allocated */ +u32 total_size; +/* actual memory being used */ u32 size;dma_addr_t paddr;void *vaddr;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 162/614 wifi: ath12k: fix error handling in creating hardware group
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 088a099690e4c0d291db505013317ab5dd58b4d5 ]
In ath12k_core_init() when ath12k_core_hw_group_create() fails, ath12k_core_hw_group_destroy() is called where for each device below path would get executed
ath12k_core_soc_destroy() ath12k_qmi_deinit_service() qmi_handle_release()
This results in kernel crash in case one of the device fails at qmi_handle_init() when creating hardware group:
ath12k_pci 0000:10:00.0: failed to initialize qmi handle ath12k_pci 0000:10:00.0: failed to initialize qmi :-517 ath12k_pci 0000:10:00.0: failed to create soc core: -517 ath12k_pci 0000:10:00.0: unable to create hw group
BUG: unable to handle page fault for address: ffffffffffffffb7 RIP: 0010:qmi_handle_release Call Trace: <TASK> ath12k_qmi_deinit_service ath12k_core_hw_group_destroy ath12k_core_init ath12k_pci_probe
The detailed reason is, when qmi_handle_init() fails for a device ab->qmi.handle is not correctly initialized. Then ath12k_core_hw_group_create() returns failure, since error handing is done for all device, eventually qmi_handle_release() is called for the issue device and finally kernel crashes due to the uninitialized ab->qmi.handle.
Fix this by moving error handling to ath12k_core_hw_group_create(), this way the issue device can be skipped.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/core.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +17 -5
@@ -2106,14 +2106,27 @@ static int ath12k_core_hw_group_create(struct ath12k_hw_group *ag) ret =ath12k_core_soc_create (ab);if (ret) {mutex_unlock (&ab->core_lock); -ath12k_err (ab,"failed to create soc core: %d\n" , ret); -return ret; +ath12k_err (ab,"failed to create soc %d core: %d\n" , i, ret); + goto destroy; }mutex_unlock (&ab->core_lock); }return 0 ; + +destroy: +for (i--; i >=0 ; i--) { + ab = ag->ab[i]; +if (!ab) +continue ; + +mutex_lock (&ab->core_lock); +ath12k_core_soc_destroy (ab); +mutex_unlock (&ab->core_lock); + } + +return ret; }void ath12k_core_hw_group_set_mlo_capable (struct ath12k_hw_group *ag)
@@ -2188,7 +2201,7 @@ int ath12k_core_init(struct ath12k_base *ab)if (ret) {mutex_unlock (&ag->mutex);ath12k_warn (ab,"unable to create hw group\n" ); - goto err_destroy_hw_group; + goto err_unassign_hw_group; } }
@@ -2196,8 +2209,7 @@ int ath12k_core_init(struct ath12k_base *ab)return 0 ; -err_destroy_hw_group: -ath12k_core_hw_group_destroy (ab->ag); +err_unassign_hw_group:ath12k_core_hw_group_unassign (ab); err_unregister_notifier:ath12k_core_panic_notifier_unregister (ab);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 163/614 wifi: ath12k: enforce vdev limit in ath12k_mac_vdev_create()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rameshkumar Sundaram <[email protected]>
[ Upstream commit 448bf7b51426bcca54b5ac1ddd1045a36c9d1dea ]
Currently, vdev limit check is performed only in ath12k_mac_assign_vif_to_vdev(). If the host has already created maximum number of vdevs for the radio (ar) and a scan request arrives for the same radio, ath12k_mac_initiate_hw_scan() attempts to create a vdev without checking the limit, causing firmware asserts.
Centralize the vdev limit guard by moving the check into ath12k_mac_vdev_create() so that all callers obey the limit. While doing this, update the condition from num_created_vdevs > (TARGET_NUM_VDEVS(ab) - 1) to num_created_vdevs >= TARGET_NUM_VDEVS(ab) for clarity and to eliminate unnecessary arithmetic.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +6 -6
@@ -9687,6 +9687,12 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)if (vif->type ==NL80211_IFTYPE_MONITOR && ar->monitor_vdev_created)return -EINVAL ; +if (ar->num_created_vdevs >=TARGET_NUM_VDEVS (ab)) { +ath12k_warn (ab,"failed to create vdev, reached max vdev limit %d\n" , +TARGET_NUM_VDEVS (ab)); +return -ENOSPC ; + } + link_id = arvif->link_id;if (link_id <IEEE80211_MLD_MAX_NUM_LINKS ) {
@@ -10046,12 +10052,6 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,if (arvif->is_created) goto flush; -if (ar->num_created_vdevs > (TARGET_NUM_VDEVS (ab) -1 )) { -ath12k_warn (ab,"failed to create vdev, reached max vdev limit %d\n" , -TARGET_NUM_VDEVS (ab)); - goto unlock; - } - ret =ath12k_mac_vdev_create (ar, arvif);if (ret) {ath12k_warn (ab,"failed to create vdev %pM ret %d" , vif->addr, ret);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 164/614 wifi: ath12k: unassign arvif on scan vdev create failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rameshkumar Sundaram <[email protected]>
[ Upstream commit e70515039d44be61b6a73aafb401d141b0034d12 ]
During scan and remain-on-channel requests, a scan link vif (arvif) is assigned and a temporary vdev is created. If vdev creation fails, the assigned arvif is left attached until the virtual interface is removed, leaving a stale link in ahvif.
Fix this by freeing the stale arvif and resetting the corresponding link in ahvif by calling ath12k_mac_unassign_link_vif() when vdev creation fails.
While at it, propagate the actual error code from ath12k_mac_vdev_create() instead of returning -EINVAL in ath12k_mac_initiate_hw_scan().
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/mac.c +3 -1
@@ -5059,7 +5059,8 @@ static int ath12k_mac_initiate_hw_scan(struct ieee80211_hw *hw, ret =ath12k_mac_vdev_create (ar, arvif);if (ret) {ath12k_warn (ar->ab,"unable to create scan vdev %d\n" , ret); -return -EINVAL ; +ath12k_mac_unassign_link_vif (arvif); +return ret; } }
@@ -12895,6 +12896,7 @@ static int ath12k_mac_op_remain_on_channel(struct ieee80211_hw *hw,if (ret) {ath12k_warn (ar->ab,"unable to create scan vdev for roc: %d\n" , ret); +ath12k_mac_unassign_link_vif (arvif);return ret; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 165/614 interconnect: qcom: msm8996: add missing link to SLAVE_USB_HS
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 8cf9b43f6b4d90e19a9341edefdd46842d4adb55 ]
Quoted 1 line
From the initial submission the interconnect driver missed the link from
SNOC_PNOC to the USB 2 configuration space. Add missing link in order to let the platform configure and utilize this path.
--- drivers/interconnect/qcom/msm8996.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/msm8996.c +1 -0
@@ -552,6 +552,7 @@ static struct qcom_icc_node mas_venus_vmem = {static const u16 mas_snoc_pnoc_links[] = {MSM8996_SLAVE_BLSP_1 ,MSM8996_SLAVE_BLSP_2 , +MSM8996_SLAVE_USB_HS ,MSM8996_SLAVE_SDCC_1 ,MSM8996_SLAVE_SDCC_2 ,MSM8996_SLAVE_SDCC_4 ,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 166/614 arm64: dts: qcom: msm8996: add interconnect paths to USB2 controller
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 242f7558e7bf54cb63c06506f7b0630dd67d45a4 ]
Add the missing interconnects to the USB2 host. The Fixes tag points to the commit which broke probing of the USB host on that platform.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -3496,6 +3496,9 @@ usb2: usb@76f8800 { <&gcc GCC_USB20_MASTER_CLK>; assigned-clock-rates = <19200000>, <60000000>; + interconnects = <&pnoc MASTER_USB_HS &bimc SLAVE_EBI_CH0>, + <&bimc MASTER_AMPSS_M0 &pnoc SLAVE_USB_HS>; + interconnect-names = "usb-ddr", "apps-usb"; power-domains = <&gcc USB30_GDSC>; qcom,select-utmi-as-pipe-clk; status = "disabled";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 167/614 accel/amdxdna: Fix incorrect command state for timed out job
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit 6fb7f298883246e21f60f971065adcb789ae6eba ]
When a command times out, mark it as ERT_CMD_STATE_TIMEOUT. Any other commands that are canceled due to this timeout should be marked as ERT_CMD_STATE_ABORT.
--- drivers/accel/amdxdna/aie2_ctx.c | 15 +++++++++++++-- drivers/accel/amdxdna/amdxdna_ctx.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +13 -2
@@ -204,10 +204,13 @@ aie2_sched_resp_handler(void *handle, void __iomem *data, size_t size) cmd_abo = job->cmd_bo; -if (unlikely (!data)) +if (unlikely (job->job_timeout)) { +amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_TIMEOUT ); + ret = -EINVAL ; goto out; + } -if (unlikely (size !=sizeof (u32))) { +if (unlikely (!data) ||unlikely (size !=sizeof (u32))) {amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_ABORT ); ret = -EINVAL ; goto out;
@@ -260,6 +263,13 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size)int ret =0 ; cmd_abo = job->cmd_bo; + +if (unlikely (job->job_timeout)) { +amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_TIMEOUT ); + ret = -EINVAL ; + goto out; + } +if (unlikely (!data) ||unlikely (size !=sizeof (u32) *3 )) {amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_ABORT ); ret = -EINVAL ;
@@ -362,6 +372,7 @@ aie2_sched_job_timedout(struct drm_sched_job *sched_job) xdna = hwctx->client->xdna;trace_xdna_job (sched_job, hwctx->name,"job timedout" , job->seq); + job->job_timeout = true;mutex_lock (&xdna->dev_lock);aie2_hwctx_stop (xdna, hwctx, sched_job);
drivers/accel/amdxdna/amdxdna_ctx.h +1 -0
@@ -105,6 +105,7 @@ struct amdxdna_sched_job {/* user can wait on this fence */ struct dma_fence *out_fence;bool job_done; +bool job_timeout;u64 seq;struct amdxdna_gem_obj *cmd_bo;size_t bo_cnt;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 168/614 interconnect: debugfs: Fix incorrect error handling for NULL path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 6bfe104fd0f94d0248af22c256ce725ee087157b ]
The icc_commit_set() function, used by the debugfs interface, checks the validity of the global cur_path pointer using IS_ERR_OR_NULL(). However, in the specific case where cur_path is NULL, while IS_ERR_OR_NULL(NULL) correctly evaluates to true, the subsequent call to PTR_ERR(NULL) returns 0.
This causes the function to return a success code (0) instead of an error, misleading the user into believing their bandwidth request was successfully committed when, in fact, no operation was performed.
Fix this by adding an explicit check to return -EINVAL if cur_path is NULL. This prevents silent failures and ensures that an invalid operational sequence is immediately and clearly reported as an error.
--- drivers/interconnect/debugfs-client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/interconnect/debugfs-client.c +6 -1
@@ -117,7 +117,12 @@ static int icc_commit_set(void *data, u64 val)mutex_lock (&debugfs_lock); -if (IS_ERR_OR_NULL (cur_path)) { +if (!cur_path) { + ret = -EINVAL ; + goto out; + } + +if (IS_ERR (cur_path)) { ret =PTR_ERR (cur_path); goto out; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 169/614 arm64: dts: renesas: sparrow-hawk: Fix full-size DP connector node name and labels
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 9d22a34a016313137b9e534a918f1f9aa790aa69 ]
The DisplayPort connector on Retronix R-Car V4H Sparrow Hawk board is a full-size DisplayPort connector. Fix the copy-paste error and update the DT node name and labels accordingly. No functional change.
--- arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts +3 -3
@@ -119,13 +119,13 @@ memory@600000000 { }; /* Page 27 / DSI to Display */ - mini-dp-con { + dp-con { compatible = "dp-connector"; label = "CN6"; type = "full-size"; port { - mini_dp_con_in: endpoint { + dp_con_in: endpoint { remote-endpoint = <&sn65dsi86_out>; }; };
@@ -407,7 +407,7 @@ sn65dsi86_in: endpoint { port@1 { reg = <1>; sn65dsi86_out: endpoint { - remote-endpoint = <&mini_dp_con_in>; + remote-endpoint = <&dp_con_in>; }; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 170/614 cgroup: add cgroup namespace to tree after owner is set
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 768b1565d9d1e1eebf7567f477f7f46c05a98a4d ]
Otherwise we trip VFS_WARN_ON_ONC() in __ns_tree_add_raw().
--- kernel/cgroup/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/namespace.c +1 -1
@@ -30,7 +30,6 @@ static struct cgroup_namespace *alloc_cgroup_ns(void) ret =ns_common_init (new_ns);if (ret)return ERR_PTR (ret); -ns_tree_add (new_ns);return no_free_ptr (new_ns); }
@@ -86,6 +85,7 @@ struct cgroup_namespace *copy_cgroup_ns(u64 flags, new_ns->ucounts = ucounts; new_ns->root_cset = cset; +ns_tree_add (new_ns);return new_ns; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 171/614 drm/imagination: Fix reference to devm_platform_get_and_ioremap_resource()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f1aa93005d0d6fb3293ca9c3eb08d1d1557117bf ]
The call to devm_platform_ioremap_resource() was replaced by a call to devm_platform_get_and_ioremap_resource(), but the comment referring to the function's possible returned error codes was not updated.
--- drivers/gpu/drm/imagination/pvr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_device.c +1 -1
@@ -48,7 +48,7 @@* * Return: * * 0 on success, or -* * Any error returned by devm_platform_ioremap_resource(). +* * Any error returned by devm_platform_get_and_ioremap_resource(). */ static int pvr_device_reg_init (struct pvr_device *pvr_dev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 172/614 perf lock contention: Load kernel map before lookup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 553d18c98a896094b99a01765b9698b204183d49 ]
On some machines, it caused troubles when it tried to find kernel symbols. I think it's because kernel modules and kallsyms are messed up during load and split.
Basically we want to make sure the kernel map is loaded and the code has it in the lock_contention_read(). But recently we added more lookups in the lock_contention_prepare() which is called before _read().
Also the kernel map (kallsyms) may not be the first one in the group like on ARM. Let's use machine__kernel_map() rather than just loading the first map.
--- tools/perf/util/bpf_lock_contention.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/bpf_lock_contention.c +3 -3
@@ -184,6 +184,9 @@ int lock_contention_prepare(struct lock_contention *con)struct evlist *evlist = con->evlist;struct target *target = con->target; +/* make sure it loads the kernel map before lookup */ +map__load (machine__kernel_map (con->machine)); + skel =lock_contention_bpf__open ();if (!skel) {pr_err ("Failed to open lock-contention BPF skeleton\n" );
@@ -749,9 +752,6 @@ int lock_contention_read(struct lock_contention *con)bpf_prog_test_run_opts (prog_fd, &opts); } -/* make sure it loads the kernel map */ -maps__load_first (machine->kmaps); - prev_key =NULL ;while (!bpf_map_get_next_key (fd, prev_key, &key)) {s64 ls_key;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 173/614 perf record: skip synthesize event when open evsel failed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
[ Upstream commit 163e5f2b96632b7fb2eaa965562aca0dbdf9f996 ]
When using perf record with the --overwrite option, a segmentation fault occurs if an event fails to open. For example:
perf record -e cycles-ct -F 1000 -a --overwrite
Error:
cycles-ct:H: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'
perf: Segmentation fault
#0 0x6466b6 in dump_stack debug.c:366
#1 0x646729 in sighandler_dump_stack debug.c:378
#2 0x453fd1 in sigsegv_handler builtin-record.c:722
#3 0x7f8454e65090 in __restore_rt libc-2.32.so[54090]
#4 0x6c5671 in __perf_event__synthesize_id_index synthetic-events.c:1862
#5 0x6c5ac0 in perf_event__synthesize_id_index synthetic-events.c:1943
#6 0x458090 in record__synthesize builtin-record.c:2075
#7 0x45a85a in __cmd_record builtin-record.c:2888
#8 0x45deb6 in cmd_record builtin-record.c:4374
#9 0x4e5e33 in run_builtin perf.c:349
#10 0x4e60bf in handle_internal_command perf.c:401
#11 0x4e6215 in run_argv perf.c:448
#12 0x4e653a in main perf.c:555
#13 0x7f8454e4fa72 in __libc_start_main libc-2.32.so[3ea72]
#14 0x43a3ee in _start ??:0The --overwrite option implies --tail-synthesize, which collects non-sample events reflecting the system status when recording finishes. However, when evsel opening fails (e.g., unsupported event 'cycles-ct'), session->evlist is not initialized and remains NULL. The code unconditionally calls record__synthesize() in the error path, which iterates through the NULL evlist pointer and causes a segfault.
To fix it, move the record__synthesize() call inside the error check block, so it's only called when there was no error during recording, ensuring that evlist is properly initialized.
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -2883,11 +2883,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) rec->bytes_written +=off_cpu_write (rec->session);record__read_lost_samples (rec); -record__synthesize (rec, true);/* this will be recalculated during process_buildids() */ rec->samples =0 ;if (!err) { +record__synthesize (rec, true);if (!rec->timestamp_filename) {record__finish_output (rec); }else {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 174/614 clk: qcom: tcsrcc-glymur: Update register offsets for clock refs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit a4aa1ceb89f5c0d27a55671d88699cf5eae7331b ]
Update the register offsets for all the clock ref branches to match the new address mapping in the TCSR subsystem.
--- drivers/clk/qcom/tcsrcc-glymur.c | 54 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-)
drivers/clk/qcom/tcsrcc-glymur.c +27 -27
@@ -28,10 +28,10 @@ enum { };static struct clk_branch tcsr_edp_clkref_en = { - .halt_reg =0x1c , + .halt_reg =0x60 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x1c , + .enable_reg =0x60 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_edp_clkref_en" ,
@@ -45,10 +45,10 @@ static struct clk_branch tcsr_edp_clkref_en = { };static struct clk_branch tcsr_pcie_1_clkref_en = { - .halt_reg =0x4 , + .halt_reg =0x48 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x4 , + .enable_reg =0x48 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_pcie_1_clkref_en" ,
@@ -62,10 +62,10 @@ static struct clk_branch tcsr_pcie_1_clkref_en = { };static struct clk_branch tcsr_pcie_2_clkref_en = { - .halt_reg =0x8 , + .halt_reg =0x4c , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x8 , + .enable_reg =0x4c , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_pcie_2_clkref_en" ,
@@ -79,10 +79,10 @@ static struct clk_branch tcsr_pcie_2_clkref_en = { };static struct clk_branch tcsr_pcie_3_clkref_en = { - .halt_reg =0x10 , + .halt_reg =0x54 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x10 , + .enable_reg =0x54 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_pcie_3_clkref_en" ,
@@ -96,10 +96,10 @@ static struct clk_branch tcsr_pcie_3_clkref_en = { };static struct clk_branch tcsr_pcie_4_clkref_en = { - .halt_reg =0x14 , + .halt_reg =0x58 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x14 , + .enable_reg =0x58 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_pcie_4_clkref_en" ,
@@ -113,10 +113,10 @@ static struct clk_branch tcsr_pcie_4_clkref_en = { };static struct clk_branch tcsr_usb2_1_clkref_en = { - .halt_reg =0x28 , + .halt_reg =0x6c , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x28 , + .enable_reg =0x6c , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb2_1_clkref_en" ,
@@ -130,10 +130,10 @@ static struct clk_branch tcsr_usb2_1_clkref_en = { };static struct clk_branch tcsr_usb2_2_clkref_en = { - .halt_reg =0x2c , + .halt_reg =0x70 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x2c , + .enable_reg =0x70 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb2_2_clkref_en" ,
@@ -147,10 +147,10 @@ static struct clk_branch tcsr_usb2_2_clkref_en = { };static struct clk_branch tcsr_usb2_3_clkref_en = { - .halt_reg =0x30 , + .halt_reg =0x74 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x30 , + .enable_reg =0x74 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb2_3_clkref_en" ,
@@ -164,10 +164,10 @@ static struct clk_branch tcsr_usb2_3_clkref_en = { };static struct clk_branch tcsr_usb2_4_clkref_en = { - .halt_reg =0x44 , + .halt_reg =0x88 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x44 , + .enable_reg =0x88 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb2_4_clkref_en" ,
@@ -181,10 +181,10 @@ static struct clk_branch tcsr_usb2_4_clkref_en = { };static struct clk_branch tcsr_usb3_0_clkref_en = { - .halt_reg =0x20 , + .halt_reg =0x64 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x20 , + .enable_reg =0x64 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb3_0_clkref_en" ,
@@ -198,10 +198,10 @@ static struct clk_branch tcsr_usb3_0_clkref_en = { };static struct clk_branch tcsr_usb3_1_clkref_en = { - .halt_reg =0x24 , + .halt_reg =0x68 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x24 , + .enable_reg =0x68 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb3_1_clkref_en" ,
@@ -215,10 +215,10 @@ static struct clk_branch tcsr_usb3_1_clkref_en = { };static struct clk_branch tcsr_usb4_1_clkref_en = { - .halt_reg =0x0 , + .halt_reg =0x44 , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x0 , + .enable_reg =0x44 , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb4_1_clkref_en" ,
@@ -232,10 +232,10 @@ static struct clk_branch tcsr_usb4_1_clkref_en = { };static struct clk_branch tcsr_usb4_2_clkref_en = { - .halt_reg =0x18 , + .halt_reg =0x5c , .halt_check =BRANCH_HALT_DELAY , .clkr = { - .enable_reg =0x18 , + .enable_reg =0x5c , .enable_mask =BIT (0 ), .hw.init = &(const struct clk_init_data ) { .name ="tcsr_usb4_2_clkref_en" ,
@@ -268,7 +268,7 @@ static const struct regmap_config tcsr_cc_glymur_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = 0x44, + .max_register = 0x94, .fast_io = true, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 175/614 timers/migration: Convert "while" loops to use "for"
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 6c181b5667eea3e6564d334443536a5974190e15 ]
Both the "do while" and "while" loops in tmigr_setup_groups() eventually mimic the behaviour of "for" loops.
Simplify accordingly.
Stable-dep-of: 5eb579dfd46b ("timers/migration: Fix imbalanced NUMA trees")
--- kernel/time/timer_migration.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
kernel/time/timer_migration.c +13 -10
@@ -1642,22 +1642,23 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,static int tmigr_setup_groups (unsigned int cpu,unsigned int node) {struct tmigr_group *group, *child, **stack; -int top =0 , err =0 , i =0 ; +int i, top =0 , err =0 ;struct list_head *lvllist; stack =kcalloc (tmigr_hierarchy_levels,sizeof (*stack),GFP_KERNEL );if (!stack)return -ENOMEM ; - do { +for (i =0 ; i < tmigr_hierarchy_levels; i++) { group =tmigr_get_group (cpu, node, i);if (IS_ERR (group)) { err =PTR_ERR (group); + i--;break ; } top = i; - stack[i++] = group; + stack[i] = group;/* * When booting only less CPUs of a system than CPUs are
@@ -1667,16 +1668,18 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)* be different from tmigr_hierarchy_levels, contains only a * single group. */ -if (group->parent ||list_is_singular (&tmigr_level_list[i -1 ])) +if (group->parent ||list_is_singular (&tmigr_level_list[i]))break ; + } - }while (i < tmigr_hierarchy_levels); - -/* Assert single root */ -WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top])); +/* Assert single root without parent */ +if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels)) +return -EINVAL ; +if (WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top]))) +return -EINVAL ; -while (i >0 ) { - group = stack[--i]; +for (; i >=0 ; i--) { + group = stack[i];if (err <0 ) {list_del (&group->list);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 176/614 timers/migration: Remove locking on group connection
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit fa9620355d4192200f15cb3d97c6eb9c02442249 ]
Initializing the tmc's group, the group's number of children and the group's parent can all be done without locking because:
1) Reading the group's parent and its group mask is done locklessly.
2) The connections prepared for a given CPU hierarchy are visible to the target CPU once online, thanks to the CPU hotplug enforced memory ordering.
3) In case of a newly created upper level, the new root and its connections and initialization are made visible by the CPU which made the connections. When that CPUs goes idle in the future, the new link is published by tmigr_inactive_up() through the atomic RmW on ->migr_state.
4) If CPUs were still walking up the active hierarchy, they could observe the new root earlier. In this case the ordering is enforced by an early initialization of the group mask and by barriers that maintain address dependency as explained in:
b729cc1ec21a ("timers/migration: Fix another race between hotplug and idle entry/exit") de3ced72a792 ("timers/migration: Enforce group initialization visibility to tree walkers")
5) Timers are propagated by a chain of group locking from the bottom to the top. And while doing so, the tree also propagates groups links and initialization. Therefore remote expiration, which also relies on group locking, will observe those links and initialization while holding the root lock before walking the tree remotely and update remote timers. This is especially important for migrators in the active hierarchy that may observe the new root early.
Therefore the locking is unnecessary at initialization. If anything, it just brings confusion. Remove it.
Stable-dep-of: 5eb579dfd46b ("timers/migration: Fix imbalanced NUMA trees")
--- kernel/time/timer_migration.c | 10 ---------- 1 file changed, 10 deletions(-)
kernel/time/timer_migration.c +0 -10
@@ -1573,9 +1573,6 @@ static void tmigr_connect_child_parent(struct tmigr_group *child, {struct tmigr_walk data; -raw_spin_lock_irq (&child->lock); -raw_spin_lock_nested (&parent->lock,SINGLE_DEPTH_NESTING ); -if (activate) {/* * @child is the old top and @parent the new one. In this
@@ -1596,9 +1593,6 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,*/ smp_store_release (&child->parent, parent); -raw_spin_unlock (&parent->lock); -raw_spin_unlock_irq (&child->lock); -trace_tmigr_connect_child_parent (child);if (!activate)
@@ -1695,13 +1689,9 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)if (i ==0 ) {struct tmigr_cpu *tmc =per_cpu_ptr (&tmigr_cpu, cpu); -raw_spin_lock_irq (&group->lock); - tmc->tmgroup = group; tmc->groupmask =BIT (group->num_children++); -raw_spin_unlock_irq (&group->lock); -trace_tmigr_connect_cpu_parent (tmc);/* There are no children that need to be connected */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 177/614 timers/migration: Fix imbalanced NUMA trees
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 5eb579dfd46b4949117ecb0f1ba2f12d3dc9a6f2 ]
When a CPU from a new node boots, the old root may happen to be connected to the new root even if their node mismatch, as depicted in the following scenario:
1) CPU 0 boots and creates the first group for node 0.
[GRP0:0]
node 0
|
CPU 02) CPU 1 from node 1 boots and creates a new top that corresponds to node 1, but it also connects the old root from node 0 to the new root from node 1 by mistake.
[GRP1:0]
node 1
/ \
/ \ [GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0 CPU 1
3) This eventually leads to an imbalanced tree where some node 0 CPUs migrate node 1 timers (and vice versa) way before reaching the crossnode groups, resulting in more frequent remote memory accesses than expected.
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:1]
node 1 node 0
/ \ |
/ \ [...]
[GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0... CPU 1...
A balanced tree should only contain groups having children that belong to the same node:
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:0]
node 0 node 1
/ \ / \
/ \ / \ [GRP0:0] [...] [...] [GRP0:1]
node 0 node 1
| |
CPU 0... CPU 1...
In order to fix this, the hierarchy must be unfolded up to the crossnode level as soon as a node mismatch is detected. For example the stage 2 above should lead to this layout:
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:1]
node 0 node 1
/ \
/ \
[GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0 CPU 1This means that not only GRP1:0 must be created but also GRP1:1 and GRP2:0 in order to prepare a balanced tree for next CPUs to boot.
--- kernel/time/timer_migration.c | 231 +++++++++++++++++++--------------- 1 file changed, 127 insertions(+), 104 deletions(-)
kernel/time/timer_migration.c +127 -104
@@ -420,6 +420,8 @@ static struct list_head *tmigr_level_list __read_mostly;static unsigned int tmigr_hierarchy_levels__read_mostly ;static unsigned int tmigr_crossnode_level__read_mostly ; +static struct tmigr_group *tmigr_root; + static DEFINE_PER_CPU(struct tmigr_cpu, tmigr_cpu);#define TMIGR_NONE 0xFF
@@ -522,11 +524,9 @@ struct tmigr_walk {typedef bool (*up_f )(struct tmigr_group *,struct tmigr_group *,struct tmigr_walk *); -static void __walk_groups (up_f up,struct tmigr_walk *data, -struct tmigr_cpu *tmc) +static void __walk_groups_from (up_f up,struct tmigr_walk *data, +struct tmigr_group *child,struct tmigr_group *group) { -struct tmigr_group *child =NULL , *group = tmc->tmgroup; - do { WARN_ON_ONCE(group->level >= tmigr_hierarchy_levels);
@@ -544,6 +544,12 @@ static void __walk_groups(up_f up, struct tmigr_walk *data, }while (group); } +static void __walk_groups (up_f up,struct tmigr_walk *data, +struct tmigr_cpu *tmc) +{ +__walk_groups_from (up, data,NULL , tmc->tmgroup); +} +static void walk_groups (up_f up,struct tmigr_walk *data,struct tmigr_cpu *tmc) {lockdep_assert_held (&tmc->lock);
@@ -1498,21 +1504,6 @@ static void tmigr_init_group(struct tmigr_group *group, unsigned int lvl, s.seq =0 ;atomic_set (&group->migr_state, s.state); -/* -* If this is a new top-level, prepare its groupmask in advance. -* This avoids accidents where yet another new top-level is -* created in the future and made visible before the current groupmask. -*/ -if (list_empty (&tmigr_level_list[lvl])) { - group->groupmask =BIT (0 ); -/* -* The previous top level has prepared its groupmask already, -* simply account it as the first child. -*/ -if (lvl >0 ) - group->num_children =1 ; - } -timerqueue_init_head (&group->events);timerqueue_init (&group->groupevt.nextevt); group->groupevt.nextevt.expires =KTIME_MAX ;
@@ -1567,22 +1558,51 @@ static struct tmigr_group *tmigr_get_group(unsigned int cpu, int node,return group; } +static bool tmigr_init_root (struct tmigr_group *group,bool activate) +{ +if (!group->parent && group != tmigr_root) { +/* +* This is the new top-level, prepare its groupmask in advance +* to avoid accidents where yet another new top-level is +* created in the future and made visible before this groupmask. +*/ + group->groupmask =BIT (0 ); +WARN_ON_ONCE (activate); + +return true; + } + +return false; + +} +static void tmigr_connect_child_parent (struct tmigr_group *child,struct tmigr_group *parent,bool activate) { -struct tmigr_walk data; +if (tmigr_init_root (parent, activate)) { +/* +* The previous top level had prepared its groupmask already, +* simply account it in advance as the first child. If some groups +* have been created between the old and new root due to node +* mismatch, the new root's child will be intialized accordingly. +*/ + parent->num_children =1 ; + } -if (activate) { +/* Connecting old root to new root ? */ +if (!parent->parent && activate) {/* -* @child is the old top and @parent the new one. In this -* case groupmask is pre-initialized and @child already -* accounted, along with its new sibling corresponding to the -* CPU going up. +* @child is the old top, or in case of node mismatch, some +* intermediate group between the old top and the new one in +* @parent. In this case the @child must be pre-accounted above +* as the first child. Its new inactive sibling corresponding +* to the CPU going up has been accounted as the second child. */ -WARN_ON_ONCE (child->groupmask !=BIT (0 ) || parent->num_children !=2 ); +WARN_ON_ONCE (parent->num_children !=2 ); + child->groupmask =BIT (0 ); }else { -/* Adding @child for the CPU going up to @parent. */ +/* Common case adding @child for the CPU going up to @parent. */ child->groupmask =BIT (parent->num_children++); }
@@ -1594,56 +1614,28 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,smp_store_release (&child->parent, parent);trace_tmigr_connect_child_parent (child); - -if (!activate) -return ; - -/* -* To prevent inconsistent states, active children need to be active in -* the new parent as well. Inactive children are already marked inactive -* in the parent group: -* -* * When new groups were created by tmigr_setup_groups() starting from -* the lowest level (and not higher then one level below the current -* top level), then they are not active. They will be set active when -* the new online CPU comes active. -* -* * But if a new group above the current top level is required, it is -* mandatory to propagate the active state of the already existing -* child to the new parent. So tmigr_connect_child_parent() is -* executed with the formerly top level group (child) and the newly -* created group (parent). -* -* * It is ensured that the child is active, as this setup path is -* executed in hotplug prepare callback. This is exectued by an -* already connected and !idle CPU. Even if all other CPUs go idle, -* the CPU executing the setup will be responsible up to current top -* level group. And the next time it goes inactive, it will release -* the new childmask and parent to subsequent walkers through this -* @child. Therefore propagate active state unconditionally. -*/ - data.childmask = child->groupmask; - -/* -* There is only one new level per time (which is protected by -* tmigr_mutex). When connecting the child and the parent and set the -* child active when the parent is inactive, the parent needs to be the -* uppermost level. Otherwise there went something wrong! -*/ -WARN_ON (!tmigr_active_up (parent, child, &data) && parent->parent); } -static int tmigr_setup_groups (unsigned int cpu,unsigned int node) +static int tmigr_setup_groups (unsigned int cpu,unsigned int node, +struct tmigr_group *start,bool activate) {struct tmigr_group *group, *child, **stack; -int i, top =0 , err =0 ; -struct list_head *lvllist; +int i, top =0 , err =0 , start_lvl =0 ; +bool root_mismatch = false; stack =kcalloc (tmigr_hierarchy_levels,sizeof (*stack),GFP_KERNEL );if (!stack)return -ENOMEM ; -for (i =0 ; i < tmigr_hierarchy_levels; i++) { +if (start) { + stack[start->level] = start; + start_lvl = start->level +1 ; + } + +if (tmigr_root) + root_mismatch = tmigr_root->numa_node != node; + +for (i = start_lvl; i < tmigr_hierarchy_levels; i++) { group =tmigr_get_group (cpu, node, i);if (IS_ERR (group)) { err =PTR_ERR (group);
@@ -1656,23 +1648,25 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)/* * When booting only less CPUs of a system than CPUs are -* available, not all calculated hierarchy levels are required. +* available, not all calculated hierarchy levels are required, +* unless a node mismatch is detected. * * The loop is aborted as soon as the highest level, which might * be different from tmigr_hierarchy_levels, contains only a -* single group. +* single group, unless the nodes mismatch below tmigr_crossnode_level */ -if (group->parent ||list_is_singular (&tmigr_level_list[i])) +if (group->parent) +break ; +if ((!root_mismatch || i >= tmigr_crossnode_level) && +list_is_singular (&tmigr_level_list[i]))break ; }/* Assert single root without parent */ if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels))return -EINVAL ; -if (WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top]))) -return -EINVAL ; -for (; i >=0 ; i--) { +for (; i >= start_lvl; i--) { group = stack[i];if (err <0 ) {
@@ -1692,48 +1686,63 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) tmc->tmgroup = group; tmc->groupmask =BIT (group->num_children++); +tmigr_init_root (group, activate); +trace_tmigr_connect_cpu_parent (tmc);/* There are no children that need to be connected */ continue ; }else { child = stack[i -1 ]; -/* Will be activated at online time */ -tmigr_connect_child_parent (child, group, false); +tmigr_connect_child_parent (child, group, activate); } + } -/* check if uppermost level was newly created */ -if (top != i) -continue ; - -WARN_ON_ONCE (top ==0 ); +if (err <0 ) + goto out; - lvllist = &tmigr_level_list[top]; +if (activate) { +struct tmigr_walk data;/* -* Newly created root level should have accounted the upcoming -* CPU's child group and pre-accounted the old root. +* To prevent inconsistent states, active children need to be active in +* the new parent as well. Inactive children are already marked inactive +* in the parent group: +* +* * When new groups were created by tmigr_setup_groups() starting from +* the lowest level, then they are not active. They will be set active +* when the new online CPU comes active. +* +* * But if new groups above the current top level are required, it is +* mandatory to propagate the active state of the already existing +* child to the new parents. So tmigr_active_up() activates the +* new parents while walking up from the old root to the new. +* +* * It is ensured that @start is active, as this setup path is +* executed in hotplug prepare callback. This is executed by an +* already connected and !idle CPU. Even if all other CPUs go idle, +* the CPU executing the setup will be responsible up to current top +* level group. And the next time it goes inactive, it will release +* the new childmask and parent to subsequent walkers through this +* @child. Therefore propagate active state unconditionally. */ -if (group->num_children ==2 &&list_is_singular (lvllist)) { -/* -* The target CPU must never do the prepare work, except -* on early boot when the boot CPU is the target. Otherwise -* it may spuriously activate the old top level group inside -* the new one (nevertheless whether old top level group is -* active or not) and/or release an uninitialized childmask. -*/ -WARN_ON_ONCE (cpu ==raw_smp_processor_id ()); - - lvllist = &tmigr_level_list[top -1 ]; -list_for_each_entry (child, lvllist, list) { -if (child->parent) -continue ; +WARN_ON_ONCE (!start->parent); + data.childmask = start->groupmask; +__walk_groups_from (tmigr_active_up, &data, start, start->parent); + } -tmigr_connect_child_parent (child, group, true); - } +/* Root update */ +if (list_is_singular (&tmigr_level_list[top])) { + group =list_first_entry (&tmigr_level_list[top], +typeof (*group), list); +WARN_ON_ONCE (group->parent); +if (tmigr_root) { +/* Old root should be the same or below */ +WARN_ON_ONCE (tmigr_root->level > top); } + tmigr_root = group; } - +out:kfree (stack);return err;
@@ -1741,12 +1750,26 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)static int tmigr_add_cpu (unsigned int cpu) { +struct tmigr_group *old_root = tmigr_root;int node =cpu_to_node (cpu);int ret; -mutex_lock (&tmigr_mutex); - ret =tmigr_setup_groups (cpu, node); -mutex_unlock (&tmigr_mutex); +guard (mutex)(&tmigr_mutex); + + ret =tmigr_setup_groups (cpu, node,NULL , false); + +/* Root has changed? Connect the old one to the new */ +if (ret >=0 && old_root && old_root != tmigr_root) { +/* +* The target CPU must never do the prepare work, except +* on early boot when the boot CPU is the target. Otherwise +* it may spuriously activate the old top level group inside +* the new one (nevertheless whether old top level group is +* active or not) and/or release an uninitialized childmask. +*/ +WARN_ON_ONCE (cpu ==raw_smp_processor_id ()); + ret =tmigr_setup_groups (-1 , old_root->numa_node, old_root, true); + }return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 178/614 power: supply: rt5033_charger: Fix device node reference leaks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 6cdc4d488c2f3a61174bfba4e8cc4ac92c219258 ]
The device node pointers np_conn and np_edev, obtained from of_parse_phandle() and of_get_parent() respectively, are not released. This results in a reference count leak.
Add of_node_put() calls after the last use of these device nodes to properly release their references and fix the leaks.
--- drivers/power/supply/rt5033_charger.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/rt5033_charger.c +2 -0
@@ -701,6 +701,8 @@ static int rt5033_charger_probe(struct platform_device *pdev) np_conn =of_parse_phandle (pdev->dev.of_node,"richtek,usb-connector" ,0 ); np_edev =of_get_parent (np_conn); charger->edev =extcon_find_edev_by_node (np_edev); +of_node_put (np_edev); +of_node_put (np_conn);if (IS_ERR (charger->edev)) {dev_warn (charger->dev,"no extcon device found in device-tree\n" ); goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 179/614 power: supply: cw2015: Check devm_delayed_work_autocancel() return code
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 92ec7e7b86ec0aff9cd7db64d9dce50a0ea7c542 ]
Since devm_delayed_work_autocancel() may fail, add return code check and exit cw_bat_probe() on error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/cw2015_battery.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/power/supply/cw2015_battery.c +7 -1
@@ -699,7 +699,13 @@ static int cw_bat_probe(struct i2c_client *client)if (!cw_bat->battery_workqueue)return -ENOMEM ; -devm_delayed_work_autocancel (&client->dev, &cw_bat->battery_delay_work, cw_bat_work); + ret =devm_delayed_work_autocancel (&client->dev, &cw_bat->battery_delay_work, cw_bat_work); +if (ret) { +dev_err_probe (&client->dev, ret, +"Failed to register delayed work\n" ); +return ret; + } +queue_delayed_work (cw_bat->battery_workqueue, &cw_bat->battery_delay_work,msecs_to_jiffies (10 ));return 0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 180/614 power: supply: max17040: Check iio_read_channel_processed() return code
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 2c68ac48c52ad146523f32b01d70009622bf81aa ]
Since iio_read_channel_processed() may fail, return its exit code on error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/max17040_battery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/power/supply/max17040_battery.c +5 -1
@@ -388,6 +388,7 @@ static int max17040_get_property(struct power_supply *psy, union power_supply_propval *val) {struct max17040_chip *chip =power_supply_get_drvdata (psy); +int ret;switch (psp) {case POWER_SUPPLY_PROP_ONLINE :
@@ -410,7 +411,10 @@ static int max17040_get_property(struct power_supply *psy,if (!chip->channel_temp)return -ENODATA ; -iio_read_channel_processed (chip->channel_temp, &val->intval); + ret =iio_read_channel_processed (chip->channel_temp, &val->intval); +if (ret) +return ret; + val->intval /=100 ;/* Convert from milli- to deci-degree */ break ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 181/614 power: supply: rt9467: Return error on failure in rt9467_set_value_from_ranges()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 8b27fe2d8d2380118c343629175385ff587e2fe4 ]
The return value of rt9467_set_value_from_ranges() when setting AICL VTH is not checked, even though it may fail.
Log error and return from rt9467_run_aicl() on fail.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/rt9467-charger.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/power/supply/rt9467-charger.c +4 -0
@@ -588,6 +588,10 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) aicl_vth = mivr_vth + RT9467_AICLVTH_GAP_uV; ret =rt9467_set_value_from_ranges (data,F_AICL_VTH ,RT9467_RANGE_AICL_VTH , aicl_vth); +if (ret) { +dev_err (data->dev,"Failed to set AICL VTH\n" ); +return ret; + }/* Trigger AICL function */ ret =regmap_field_write (data->rm_field[F_AICL_MEAS ],1 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 182/614 power: supply: rt9467: Prevent using uninitialized local variable in rt9467_set_value_from_ranges()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 15aca30cc6c69806054b896a2ccf7577239cb878 ]
There is a typo in rt9467_set_value_from_ranges() that can cause leaving local variable sel with an undefined value which is then used in regmap_field_write().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/rt9467-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt9467-charger.c +1 -1
@@ -376,7 +376,7 @@ static int rt9467_set_value_from_ranges(struct rt9467_chg_data *data,if (rsel ==RT9467_RANGE_VMIVR ) { ret =linear_range_get_selector_high (range, value, &sel, &found);if (ret) - value = range->max_sel; + sel = range->max_sel; }else {linear_range_get_selector_within (range, value, &sel); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 183/614 power: supply: wm831x: Check wm831x_set_bits() return value
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit ea14bae6df18942bccb467fcf5ff33ca677b8253 ]
Since wm831x_set_bits() may return error, log failure and exit from wm831x_usb_limit_change() in such case.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/wm831x_power.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/power/supply/wm831x_power.c +8 -2
@@ -144,6 +144,7 @@ static int wm831x_usb_limit_change(struct notifier_block *nb, struct wm831x_power, usb_notify);unsigned int i, best; +int ret;/* Find the highest supported limit */ best =0 ;
@@ -156,8 +157,13 @@ static int wm831x_usb_limit_change(struct notifier_block *nb,dev_dbg (wm831x_power->wm831x->dev,"Limiting USB current to %umA" , wm831x_usb_limits[best]); -wm831x_set_bits (wm831x_power->wm831x,WM831X_POWER_STATE , -WM831X_USB_ILIM_MASK , best); + ret =wm831x_set_bits (wm831x_power->wm831x,WM831X_POWER_STATE , +WM831X_USB_ILIM_MASK , best); +if (ret <0 ) { +dev_err (wm831x_power->wm831x->dev, +"Failed to set USB current limit: %d\n" , ret); +return ret; + }return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 184/614 power: supply: qcom_battmgr: clamp charge control thresholds
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 8809980fdc8a86070667032fa4005ee83f1c62f3 ]
The sysfs API documentation says that drivers "round written values to the nearest supported value" for charge_control_end_threshold.
Let's do this for both thresholds, as userspace (e.g. upower) generally does not expect these writes to fail at all.
--- drivers/power/supply/qcom_battmgr.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/power/supply/qcom_battmgr.c +2 -12
@@ -678,12 +678,7 @@ static int qcom_battmgr_set_charge_start_threshold(struct qcom_battmgr *battmgr,u32 target_soc, delta_soc;int ret; -if (start_soc <CHARGE_CTRL_START_THR_MIN || - start_soc >CHARGE_CTRL_START_THR_MAX ) { -dev_err (battmgr->dev,"charge control start threshold exceed range: [%u - %u]\n" , -CHARGE_CTRL_START_THR_MIN ,CHARGE_CTRL_START_THR_MAX ); -return -EINVAL ; - } + start_soc =clamp (start_soc,CHARGE_CTRL_START_THR_MIN ,CHARGE_CTRL_START_THR_MAX );/* * If the new start threshold is larger than the old end threshold,
@@ -716,12 +711,7 @@ static int qcom_battmgr_set_charge_end_threshold(struct qcom_battmgr *battmgr, iu32 delta_soc =CHARGE_CTRL_DELTA_SOC ;int ret; -if (end_soc <CHARGE_CTRL_END_THR_MIN || - end_soc >CHARGE_CTRL_END_THR_MAX ) { -dev_err (battmgr->dev,"charge control end threshold exceed range: [%u - %u]\n" , -CHARGE_CTRL_END_THR_MIN ,CHARGE_CTRL_END_THR_MAX ); -return -EINVAL ; - } + end_soc =clamp (end_soc,CHARGE_CTRL_END_THR_MIN ,CHARGE_CTRL_END_THR_MAX );if (battmgr->info.charge_ctrl_start && end_soc > battmgr->info.charge_ctrl_start) delta_soc = end_soc - battmgr->info.charge_ctrl_start;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 185/614 power: supply: qcom_battmgr: support disabling charge control
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 446fcf494691da4e685923e5fad02b163955fc0e ]
Existing userspace (in particular, upower) disables charge control by setting the start threshold to 0 and the stop threshold to 100.
Handle that by actually setting the enable bit to 0 when a start threshold of 0 was requested.
--- drivers/power/supply/qcom_battmgr.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/power/supply/qcom_battmgr.c +8 -4
@@ -257,6 +257,7 @@ struct qcom_battmgr_info {unsigned int capacity_warning;unsigned int cycle_count;unsigned int charge_count; +bool charge_ctrl_enable;unsigned int charge_ctrl_start;unsigned int charge_ctrl_end;char model_number[BATTMGR_STRING_LEN ];
@@ -659,13 +660,13 @@ static int qcom_battmgr_bat_get_property(struct power_supply *psy, }static int qcom_battmgr_set_charge_control (struct qcom_battmgr *battmgr, -u32 target_soc,u32 delta_soc) +bool enable,u32 target_soc,u32 delta_soc) {struct qcom_battmgr_charge_ctrl_request request = { .hdr.owner =cpu_to_le32 (PMIC_GLINK_OWNER_BATTMGR ), .hdr.type =cpu_to_le32 (PMIC_GLINK_REQ_RESP ), .hdr.opcode =cpu_to_le32 (BATTMGR_CHG_CTRL_LIMIT_EN ), - .enable =cpu_to_le32 (1 ), + .enable =cpu_to_le32 (enable), .target_soc =cpu_to_le32 (target_soc), .delta_soc =cpu_to_le32 (delta_soc), };
@@ -677,6 +678,7 @@ static int qcom_battmgr_set_charge_start_threshold(struct qcom_battmgr *battmgr, {u32 target_soc, delta_soc;int ret; +bool enable = start_soc !=0 ; start_soc =clamp (start_soc,CHARGE_CTRL_START_THR_MIN ,CHARGE_CTRL_START_THR_MAX );
@@ -696,9 +698,10 @@ static int qcom_battmgr_set_charge_start_threshold(struct qcom_battmgr *battmgr, }mutex_lock (&battmgr->lock); - ret =qcom_battmgr_set_charge_control (battmgr, target_soc, delta_soc); + ret =qcom_battmgr_set_charge_control (battmgr, enable, target_soc, delta_soc);mutex_unlock (&battmgr->lock);if (!ret) { + battmgr->info.charge_ctrl_enable = enable; battmgr->info.charge_ctrl_start = start_soc; battmgr->info.charge_ctrl_end = target_soc; }
@@ -710,6 +713,7 @@ static int qcom_battmgr_set_charge_end_threshold(struct qcom_battmgr *battmgr, i {u32 delta_soc =CHARGE_CTRL_DELTA_SOC ;int ret; +bool enable = battmgr->info.charge_ctrl_enable; end_soc =clamp (end_soc,CHARGE_CTRL_END_THR_MIN ,CHARGE_CTRL_END_THR_MAX );
@@ -717,7 +721,7 @@ static int qcom_battmgr_set_charge_end_threshold(struct qcom_battmgr *battmgr, i delta_soc = end_soc - battmgr->info.charge_ctrl_start;mutex_lock (&battmgr->lock); - ret =qcom_battmgr_set_charge_control (battmgr, end_soc, delta_soc); + ret =qcom_battmgr_set_charge_control (battmgr, enable, end_soc, delta_soc);mutex_unlock (&battmgr->lock);if (!ret) { battmgr->info.charge_ctrl_start = end_soc - delta_soc;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 186/614 power: supply: apm_power: only unset own apm_get_power_status
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahelenia Ziemiańska <[email protected]>
[ Upstream commit bd44ea12919ac4e83c9f3997240fe58266aa8799 ]
Mirroring drivers/macintosh/apm_emu.c, this means that
modprobe apm_power && modprobe $anotherdriver && modprobe -r apm_power
leaves $anotherdriver's apm_get_power_status instead of deleting it.
--- drivers/power/supply/apm_power.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/apm_power.c +2 -1
@@ -364,7 +364,8 @@ static int __init apm_battery_init(void) static void __exit apm_battery_exit(void) { - apm_get_power_status =NULL ; +if (apm_get_power_status == apm_battery_apm_get_power_status) + apm_get_power_status =NULL ; }module_init (apm_battery_init);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 187/614 scsi: target: Do not write NUL characters into ASCII configfs output
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit c03b55f235e283cae49c88b9602fd11096b92eba ]
NUL characters are not allowed in ASCII configfs output. Hence this patch.
--- drivers/target/target_core_configfs.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_configfs.c +0 -1
@@ -2772,7 +2772,6 @@ static ssize_t target_lu_gp_members_show(struct config_item *item, char *page) cur_len =snprintf (buf,LU_GROUP_NAME_BUF ,"%s/%s\n" ,config_item_name (&hba->hba_group.cg_item),config_item_name (&dev->dev_group.cg_item)); - cur_len++;/* Extra byte for NULL terminator */ if ((cur_len + len) >PAGE_SIZE || cur_len >LU_GROUP_NAME_BUF ) { pr_warn("Ran out of lu_gp_show_attr"
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 188/614 scsi: target: Fix LUN/device R/W and total command stats
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
[ Upstream commit 95aa2041c654161d1b5c1eca5379d67d91ef1cf2 ]
In commit 9cf2317b795d ("scsi: target: Move I/O path stats to per CPU") I saw we sometimes use %u and also misread the spec. As a result I thought all the stats were supposed to be 32-bit only. However, for the majority of cases we support currently, the spec specifies u64 bit stats. This patch converts the stats changed in the commit above to u64.
--- drivers/target/target_core_stat.c | 24 ++++++++++++------------ include/target/target_core_base.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/target/target_core_stat.c +12 -12
@@ -282,7 +282,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 cmds =0 ; +u64 cmds =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -290,7 +290,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item, }/* scsiLuNumCommands */ -return snprintf (page,PAGE_SIZE ,"%u\n" , cmds); +return snprintf (page,PAGE_SIZE ,"%llu\n" , cmds); } static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,
@@ -299,7 +299,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 bytes =0 ; +u64 bytes =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -307,7 +307,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item, }/* scsiLuReadMegaBytes */ -return snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); +return snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 ); } static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,
@@ -316,7 +316,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 bytes =0 ; +u64 bytes =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -324,7 +324,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item, }/* scsiLuWrittenMegaBytes */ -return snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); +return snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 ); }static ssize_t target_stat_lu_resets_show (struct config_item *item,char *page)
@@ -1044,7 +1044,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 cmds =0 ; +u64 cmds =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1059,7 +1059,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item, }/* scsiAuthIntrOutCommands */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , cmds); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , cmds);rcu_read_unlock ();return ret; }
@@ -1073,7 +1073,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 bytes =0 ; +u64 bytes =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1088,7 +1088,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item, }/* scsiAuthIntrReadMegaBytes */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 );rcu_read_unlock ();return ret; }
@@ -1102,7 +1102,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 bytes =0 ; +u64 bytes =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1117,7 +1117,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item, }/* scsiAuthIntrWrittenMegaBytes */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 );rcu_read_unlock ();return ret; }
include/target/target_core_base.h +6 -6
@@ -671,9 +671,9 @@ struct se_lun_acl { };struct se_dev_entry_io_stats { -u32 total_cmds; -u32 read_bytes; -u32 write_bytes; +u64 total_cmds; +u64 read_bytes; +u64 write_bytes; };struct se_dev_entry {
@@ -806,9 +806,9 @@ struct se_device_queue { };struct se_dev_io_stats { -u32 total_cmds; -u32 read_bytes; -u32 write_bytes; +u64 total_cmds; +u64 read_bytes; +u64 write_bytes; };struct se_device {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 189/614 fs/9p: Dont open remote file with APPEND mode when writeback cache is used
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tingmao Wang <[email protected]>
[ Upstream commit a63dd8fd137933551bfd9aeeeaa942f04c7aad65 ]
When page cache is used, writebacks are done on a page granularity, and it is expected that the underlying filesystem (such as v9fs) should respect the write position. However, currently v9fs will passthrough O_APPEND to the server even on cached mode. This causes data corruption if a sync or fstat gets between two writes to the same file.
This patch removes the APPEND flag from the open request we send to the server when writeback caching is involved. I believe keeping server-side APPEND is probably fine for uncached mode (even if two fds are opened, one without O_APPEND and one with it, this should still be fine since they would use separate fid for the writes).
Message-ID: <[email protected]>
--- fs/9p/vfs_file.c | 11 ++++++++--- fs/9p/vfs_inode.c | 3 +-- fs/9p/vfs_inode_dotl.c | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-)
fs/9p/vfs_file.c +8 -3
@@ -43,14 +43,18 @@ int v9fs_file_open(struct inode *inode, struct file *file)struct v9fs_session_info *v9ses;struct p9_fid *fid;int omode; +int o_append;p9_debug (P9_DEBUG_VFS ,"inode: %p file: %p\n" , inode, file); v9ses =v9fs_inode2v9ses (inode); -if (v9fs_proto_dotl (v9ses)) +if (v9fs_proto_dotl (v9ses)) { omode =v9fs_open_to_dotl_flags (file->f_flags); -else + o_append =P9_DOTL_APPEND ; + }else { omode =v9fs_uflags2omode (file->f_flags,v9fs_proto_dotu (v9ses)); + o_append =P9_OAPPEND ; + } fid = file->private_data;if (!fid) { fid =v9fs_fid_clone (file_dentry (file));
@@ -58,9 +62,10 @@ int v9fs_file_open(struct inode *inode, struct file *file)return PTR_ERR (fid);if ((v9ses->cache &CACHE_WRITEBACK ) && (omode &P9_OWRITE )) { -int writeback_omode = (omode & ~P9_OWRITE ) |P9_ORDWR ; +int writeback_omode = (omode & ~(P9_OWRITE | o_append)) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, try opening O_RDWR\n" ); + err =p9_client_open (fid, writeback_omode);if (err <0 ) {p9_debug (P9_DEBUG_CACHE ,"could not open O_RDWR, disabling caches\n" );
fs/9p/vfs_inode.c +1 -2
@@ -786,7 +786,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, p9_omode =v9fs_uflags2omode (flags,v9fs_proto_dotu (v9ses));if ((v9ses->cache &CACHE_WRITEBACK ) && (p9_omode &P9_OWRITE )) { - p9_omode = (p9_omode & ~P9_OWRITE ) |P9_ORDWR ; + p9_omode = (p9_omode & ~(P9_OWRITE |P9_OAPPEND )) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, creating w/ O_RDWR\n" ); }
@@ -1393,4 +1393,3 @@ static const struct inode_operations v9fs_symlink_inode_operations = { .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, }; -
fs/9p/vfs_inode_dotl.c +1 -1
@@ -282,7 +282,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, }if ((v9ses->cache &CACHE_WRITEBACK ) && (p9_omode &P9_OWRITE )) { - p9_omode = (p9_omode & ~P9_OWRITE ) |P9_ORDWR ; + p9_omode = (p9_omode & ~(P9_OWRITE |P9_DOTL_APPEND )) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, creating w/ O_RDWR\n" ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 190/614 drm/panthor: Handle errors returned by drm_sched_entity_init()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit bb7939e332c64c4ef33974a0eae4f3841acfa8eb ]
In practice it's not going to fail because we're passing the current sanity checks done by drm_sched_entity_init(), and that's the only reason it would return an error, but better safe than sorry.
--- drivers/gpu/drm/panthor/panthor_sched.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_sched.c +2 -0
@@ -3403,6 +3403,8 @@ group_create_queue(struct panthor_group *group, drm_sched = &queue->scheduler; ret =drm_sched_entity_init (&queue->entity,0 , &drm_sched,1 ,NULL ); +if (ret) + goto err_free_queue;return queue;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 191/614 drm/panthor: Fix group_free_queue() for partially initialized queues
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 94a6d20feadbbe24e8a7b1c56394789ea5358fcc ]
group_free_queue() can be called on a partially initialized queue object if something fails in group_create_queue(). Make sure we don't call drm_sched_entity_destroy() on an entity that hasn't been initialized.
--- drivers/gpu/drm/panthor/panthor_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_sched.c +2 -1
@@ -895,7 +895,8 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *if (IS_ERR_OR_NULL (queue))return ; -drm_sched_entity_destroy (&queue->entity); +if (queue->entity.fence_context) +drm_sched_entity_destroy (&queue->entity);if (queue->scheduler.ops)drm_sched_fini (&queue->scheduler);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 192/614 drm/panthor: Fix UAF race between device unplug and FW event processing
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ketil Johnsen <[email protected]>
[ Upstream commit 7051f6ba968fa69918d72cc26de4d6cf7ea05b90 ]
The function panthor_fw_unplug() will free the FW memory sections. The problem is that there could still be pending FW events which are yet not handled at this point. process_fw_events_work() can in this case try to access said freed memory.
Simply call disable_work_sync() to both drain and prevent future invocation of process_fw_events_work().
--- drivers/gpu/drm/panthor/panthor_sched.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
@@ -3859,6 +3859,7 @@ void panthor_sched_unplug(struct panthor_device *ptdev)struct panthor_scheduler *sched = ptdev->scheduler;cancel_delayed_work_sync (&sched->tick_work); +disable_work_sync (&sched->fw_events_work);mutex_lock (&sched->lock);if (sched->pm.has_ref) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 193/614 drm/panthor: Fix race with suspend during unplug
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ketil Johnsen <[email protected]>
[ Upstream commit 08be57e6e8aa20ea5a6dd2552e38ac168d6a9b11 ]
There is a race between panthor_device_unplug() and panthor_device_suspend() which can lead to IRQ handlers running on a powered down GPU. This is how it can happen:
- unplug routine calls drm_dev_unplug()
- panthor_device_suspend() can now execute, and will skip a lot of important work because the device is currently marked as unplugged.
- IRQs will remain active in this case and IRQ handlers can therefore try to access a powered down GPU.
The fix is simply to take the PM ref in panthor_device_unplug() a little bit earlier, before drm_dev_unplug().
--- drivers/gpu/drm/panthor/panthor_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panthor/panthor_device.c +2 -2
@@ -83,6 +83,8 @@ void panthor_device_unplug(struct panthor_device *ptdev)return ; } +drm_WARN_ON (&ptdev->base,pm_runtime_get_sync (ptdev->base.dev) <0 ); +/* Call drm_dev_unplug() so any access to HW blocks happening after * that point get rejected. */
@@ -93,8 +95,6 @@ void panthor_device_unplug(struct panthor_device *ptdev)*/ mutex_unlock (&ptdev->unplug.lock); -drm_WARN_ON (&ptdev->base,pm_runtime_get_sync (ptdev->base.dev) <0 ); -/* Now, try to cleanly shutdown the GPU before the device resources * get reclaimed. */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 194/614 drm/panthor: Fix UAF on kernel BO VA nodes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 98dd5143447af0ee33551776d8b2560c35d0bc4a ]
If the MMU is down, panthor_vm_unmap_range() might return an error. We expect the page table to be updated still, and if the MMU is blocked, the rest of the GPU should be blocked too, so no risk of accessing physical memory returned to the system (which the current code doesn't cover for anyway).
Proceed with the rest of the cleanup instead of bailing out and leaving the va_node inserted in the drm_mm, which leads to UAF when other adjacent nodes are removed from the drm_mm tree.
--- drivers/gpu/drm/panthor/panthor_gem.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panthor/panthor_gem.c +3 -11
@@ -86,7 +86,6 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)void panthor_kernel_bo_destroy (struct panthor_kernel_bo *bo) {struct panthor_vm *vm; -int ret;if (IS_ERR_OR_NULL (bo))return ;
@@ -94,18 +93,11 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) vm = bo->vm;panthor_kernel_bo_vunmap (bo); -if (drm_WARN_ON (bo->obj->dev, -to_panthor_bo (bo->obj)->exclusive_vm_root_gem !=panthor_vm_root_gem (vm))) - goto out_free_bo; - - ret =panthor_vm_unmap_range (vm, bo->va_node.start, bo->va_node.size); -if (ret) - goto out_free_bo; - +drm_WARN_ON (bo->obj->dev, +to_panthor_bo (bo->obj)->exclusive_vm_root_gem !=panthor_vm_root_gem (vm)); +panthor_vm_unmap_range (vm, bo->va_node.start, bo->va_node.size);panthor_vm_free_va (vm, &bo->va_node);drm_gem_object_put (bo->obj); - -out_free_bo:panthor_vm_put (vm);kfree (bo); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 195/614 firmware: ti_sci: Set IO Isolation only if the firmware is capable
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richard (TI.com) <[email protected]>
[ Upstream commit 999e9bc953e321651d69556fdd5dfd178f96f128 ]
Prevent calling ti_sci_cmd_set_io_isolation() on firmware that does not support the IO_ISOLATION capability. Add the MSG_FLAG_CAPS_IO_ISOLATION capability flag and check it before attempting to set IO isolation during suspend/resume operations.
Without this check, systems with older firmware may experience undefined behavior or errors when entering/exiting suspend states.
--- drivers/firmware/ti_sci.c | 21 +++++++++++++-------- drivers/firmware/ti_sci.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/firmware/ti_sci.c +13 -8
@@ -3751,9 +3751,11 @@ static int __maybe_unused ti_sci_suspend_noirq(struct device *dev)struct ti_sci_info *info =dev_get_drvdata (dev);int ret =0 ; - ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_ENABLE ); -if (ret) -return ret; +if (info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ) { + ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_ENABLE ); +if (ret) +return ret; + }return 0 ; }
@@ -3767,9 +3769,11 @@ static int __maybe_unused ti_sci_resume_noirq(struct device *dev)u8 pin;u8 mode; - ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_DISABLE ); -if (ret) -return ret; +if (info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ) { + ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_DISABLE ); +if (ret) +return ret; + } ret =ti_sci_msg_cmd_lpm_wake_reason (&info->handle, &source, &time, &pin, &mode);/* Do not fail to resume on error as the wake reason is not critical */
@@ -3928,11 +3932,12 @@ static int ti_sci_probe(struct platform_device *pdev) }ti_sci_msg_cmd_query_fw_caps (&info->handle, &info->fw_caps); -dev_dbg (dev,"Detected firmware capabilities: %s%s%s%s\n" , +dev_dbg (dev,"Detected firmware capabilities: %s%s%s%s%s\n" , info->fw_caps &MSG_FLAG_CAPS_GENERIC ?"Generic" :"" , info->fw_caps &MSG_FLAG_CAPS_LPM_PARTIAL_IO ?" Partial-IO" :"" , info->fw_caps &MSG_FLAG_CAPS_LPM_DM_MANAGED ?" DM-Managed" :"" , - info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ?" LPM-Abort" :"" + info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ?" LPM-Abort" :"" , + info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ?" IO-Isolation" :"" );ti_sci_setup_ops (info);
drivers/firmware/ti_sci.h +2 -0
@@ -149,6 +149,7 @@ struct ti_sci_msg_req_reboot {* MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM * MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM * MSG_FLAG_CAPS_LPM_ABORT: Abort entry to LPM +* MSG_FLAG_CAPS_IO_ISOLATION: IO Isolation support * * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS * providing currently available SOC/firmware capabilities. SoC that don't
@@ -160,6 +161,7 @@ struct ti_sci_msg_resp_query_fw_caps {#define MSG_FLAG_CAPS_LPM_PARTIAL_IO TI_SCI_MSG_FLAG(4)#define MSG_FLAG_CAPS_LPM_DM_MANAGED TI_SCI_MSG_FLAG(5)#define MSG_FLAG_CAPS_LPM_ABORT TI_SCI_MSG_FLAG(9) +#define MSG_FLAG_CAPS_IO_ISOLATION TI_SCI_MSG_FLAG(7)#define MSG_MASK_CAPS_LPM GENMASK_ULL(4, 1)u64 fw_caps; } __packed;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 196/614 ns: add NS_COMMON_INIT()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit d915fe20e5cba4bd50e41e792a32dcddc7490e25 ]
Add an initializer that can be used for the ns common initialization for static namespace such as most init namespaces.
Stable-dep-of: 3dd50c58664e ("ns: initialize ns_list_node for initial namespaces")
--- include/linux/ns_common.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/linux/ns_common.h +10 -0
@@ -119,6 +119,16 @@ void __ns_common_free(struct ns_common *ns); struct user_namespace *: CLONE_NEWUSER, \ struct uts_namespace *: CLONE_NEWUTS) +#define NS_COMMON_INIT(nsname, refs) \ +{ \ + .ns_type = ns_common_type(&nsname), \ + .ns_id = 0, \ + .inum = ns_init_inum(&nsname), \ + .ops = to_ns_operations(&nsname), \ + .stashed = NULL, \ + .__ns_ref = REFCOUNT_INIT(refs), \ +} + #define ns_common_init(__ns) \ __ns_common_init(to_ns_common(__ns), \ ns_common_type(__ns), \
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 197/614 ns: initialize ns_list_node for initial namespaces
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 3dd50c58664e2684bd610a57bf3ab713cbb0ea91 ]
Make sure that the list is always initialized for initial namespaces.
--- include/linux/ns_common.h | 1 + 1 file changed, 1 insertion(+)
include/linux/ns_common.h +1 -0
@@ -127,6 +127,7 @@ void __ns_common_free(struct ns_common *ns); .ops = to_ns_operations(&nsname), \ .stashed = NULL, \ .__ns_ref = REFCOUNT_INIT(refs), \ + .ns_list_node = LIST_HEAD_INIT(nsname.ns.ns_list_node), \ }#define ns_common_init (__ns) \
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 198/614 iommu/amd: Fix potential out-of-bounds read in iommu_mmio_show
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Songtang Liu <[email protected]>
[ Upstream commit a0c7005333f9a968abb058b1d77bbcd7fb7fd1e7 ]
In iommu_mmio_write(), it validates the user-provided offset with the
check: iommu->dbg_mmio_offset > iommu->mmio_phys_end - 4. This assumes a 4-byte access. However, the corresponding show handler, iommu_mmio_show(), uses readq() to perform an 8-byte (64-bit) read.
If a user provides an offset equal to mmio_phys_end - 4, the check passes, and will lead to a 4-byte out-of-bounds read.
Fix this by adjusting the boundary check to use sizeof(u64), which corresponds to the size of the readq() operation.
--- drivers/iommu/amd/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/debugfs.c +1 -1
@@ -37,7 +37,7 @@ static ssize_t iommu_mmio_write(struct file *filp, const char __user *ubuf,if (ret)return ret; -if (iommu->dbg_mmio_offset > iommu->mmio_phys_end -4 ) { +if (iommu->dbg_mmio_offset > iommu->mmio_phys_end -sizeof (u64)) { iommu->dbg_mmio_offset =-1 ;return -EINVAL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 199/614 cleanup: fix scoped_class()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 4e97bae1b412cd6ed8053b3d8a242122952985cc ]
This is a class, not a guard so why on earth is it checking for guard pointers or conditional lock acquisition? None of it makes any sense at all.
I'm not sure what happened back then. Maybe I had a brief psychedelic period that I completely forgot about and spaced out into a zone where that initial macro implementation made any sense at all.
--- include/linux/cleanup.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
include/linux/cleanup.h +8 -7
@@ -290,15 +290,16 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ class_##_name##_t var __cleanup(class_##_name##_destructor) = \ class_##_name##_constructor -#define scoped_class(_name, var, args) \ - for (CLASS(_name, var)(args); \ -__guard_ptr (_name)(&var) || !__is_cond_ptr (_name); \ - ({ goto _label; })) \ -if (0 ) { \ -_label: \ -break ; \ +#define __scoped_class(_name, var, _label, args...) \ + for (CLASS(_name, var)(args); ; ({ goto _label; })) \ +if (0 ) { \ +_label: \ +break ; \ } else +#define scoped_class(_name, var, args...) \ + __scoped_class(_name, var, __UNIQUE_ID(label), args) +/* * DEFINE_GUARD(name, type, lock, unlock): * trivial wrapper around DEFINE_CLASS() above specifically
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 200/614 drm/xe: Enforce correct user fence signaling order using
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Brost <[email protected]>
[ Upstream commit adda4e855ab6409a3edaa585293f1f2069ab7299 ]
Prevent application hangs caused by out-of-order fence signaling when user fences are attached. Use drm_syncobj (via dma-fence-chain) to guarantee that each user fence signals in order, regardless of the signaling order of the attached fences. Ensure user fence writebacks to user space occur in the correct sequence.
v7:
- Skip drm_syncbj create of error (CI)
--- drivers/gpu/drm/xe/xe_exec_queue.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_exec_queue.c +3 -0
@@ -344,6 +344,9 @@ void xe_exec_queue_destroy(struct kref *ref) struct xe_exec_queue *q = container_of(ref, struct xe_exec_queue, refcount);struct xe_exec_queue *eq, *next; +if (q->ufence_syncobj) +drm_syncobj_put (q->ufence_syncobj); +if (q->ufence_syncobj)drm_syncobj_put (q->ufence_syncobj);
Signature · 1 line
2.51.0
Re: [PATCH 6.18 200/614] drm/xe: Enforce correct user fence signaling order using
Hi Folks,
This is an incorrect merge resolution followed by the patch already been applied.
Please skip this patch.
Thanks,
Thomas
Quoted 46 lines · Greg Kroah-Hartman
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Brost <[email protected]>
[ Upstream commit
adda4e855ab6409a3edaa585293f1f2069ab7299]Prevent application hangs caused by out-of-order fence signaling when user fences are attached. Use
drm_syncobj(via dma-fence-chain) to guarantee that each user fence signals in order, regardless of the signaling order of the attached fences. Ensure user fence writebacks to
user space occur in the correct sequence.v7:
- Skipdrm_syncbjcreate of error (CI)Fixes dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for IntelGPUs")
Signed-off-by Matthew Brost <[email protected]>Reviewed-by Thomas Hellström <[email protected]>Link:
https://patch.msgid.link/[email protected]Signed-off-by Sasha Levin <[email protected]>---
drivers/gpu/drm/xe/xe_exec_queue.c | 3 +++1 file changed, 3 insertions(+)drivers/gpu/drm/xe/xe_exec_queue.c +0
-0@@ -344,6 +344,9 @@ void xe_exec_queue_destroy(struct kref *ref)struct
xe_exec_queue*q =container_of(ref, struct xe_exec_queue, refcount);
structxe_exec_queue*eq, *next;drivers/gpu/drm/xe/xe_exec_queue.c +3
-0+if (q->ufence_syncobj) +drm_syncobj_put (q->ufence_syncobj); +if (
q->ufence_syncobj)drm_syncobj_put(q->ufence_syncobj);
Greg Kroah-Hartman
maintainerPATCH 201/614 spi: tegra210-quad: Fix timeout handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <[email protected]>
[ Upstream commit b4e002d8a7cee3b1d70efad0e222567f92a73000 ]
When the CPU that the QSPI interrupt handler runs on (typically CPU 0) is excessively busy, it can lead to rare cases of the IRQ thread not running before the transfer timeout is reached.
While handling the timeouts, any pending transfers are cleaned up and the message that they correspond to is marked as failed, which leaves the curr_xfer field pointing at stale memory.
To avoid this, clear curr_xfer to NULL upon timeout and check for this condition when the IRQ thread is finally run.
While at it, also make sure to clear interrupts on failure so that new interrupts can be run.
A better, more involved, fix would move the interrupt clearing into a hard IRQ handler. Ideally we would also want to signal that the IRQ thread no longer needs to be run after the timeout is hit to avoid the extra check for a valid transfer.
--- drivers/spi/spi-tegra210-quad.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/spi/spi-tegra210-quad.c +20 -2
@@ -1024,8 +1024,10 @@ static void tegra_qspi_handle_error(struct tegra_qspi *tqspi)dev_err (tqspi->dev,"error in transfer, fifo status 0x%08x\n" , tqspi->status_reg);tegra_qspi_dump_regs (tqspi);tegra_qspi_flush_fifos (tqspi, true); -if (device_reset (tqspi->dev) <0 ) +if (device_reset (tqspi->dev) <0 ) {dev_warn_once (tqspi->dev,"device reset failed\n" ); +tegra_qspi_mask_clear_irq (tqspi); + } }static void tegra_qspi_transfer_end (struct spi_device *spi)
@@ -1176,9 +1178,11 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, }/* Reset controller if timeout happens */ -if (device_reset (tqspi->dev) <0 ) +if (device_reset (tqspi->dev) <0 ) {dev_warn_once (tqspi->dev,"device reset failed\n" ); +tegra_qspi_mask_clear_irq (tqspi); + } ret = -EIO ; goto exit; }
@@ -1200,11 +1204,13 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,tegra_qspi_transfer_end (spi);spi_transfer_delay_exec (xfer); } + tqspi->curr_xfer =NULL ; transfer_phase++; } ret =0 ; exit: + tqspi->curr_xfer =NULL ; msg->status = ret;return ret;
@@ -1290,6 +1296,8 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi, msg->actual_length += xfer->len + dummy_bytes; complete_xfer: + tqspi->curr_xfer =NULL ; +if (ret <0 ) {tegra_qspi_transfer_end (spi);spi_transfer_delay_exec (xfer);
@@ -1395,6 +1403,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi)tegra_qspi_calculate_curr_xfer_param (tqspi, t);tegra_qspi_start_cpu_based_transfer (tqspi, t); exit: + tqspi->curr_xfer =NULL ;spin_unlock_irqrestore (&tqspi->lock, flags);return IRQ_HANDLED ; }
@@ -1480,6 +1489,15 @@ static irqreturn_t tegra_qspi_isr_thread(int irq, void *context_data) {struct tegra_qspi *tqspi = context_data; +/* +* Occasionally the IRQ thread takes a long time to wake up (usually +* when the CPU that it's running on is excessively busy) and we have +* already reached the timeout before and cleaned up the timed out +* transfer. Avoid any processing in that case and bail out early. +*/ +if (!tqspi->curr_xfer) +return IRQ_NONE ; + tqspi->status_reg =tegra_qspi_readl (tqspi,QSPI_FIFO_STATUS );if (tqspi->cur_direction &DATA_DIR_TX )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 202/614 libbpf: Fix parsing of multi-split BTF
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Maguire <[email protected]>
[ Upstream commit 4f596acc260e691a2e348f64230392f3472feea3 ]
When creating multi-split BTF we correctly set the start string offset to be the size of the base string section plus the base BTF start string offset; the latter is needed for multi-split BTF since the offset is non-zero there.
Unfortunately the BTF parsing case needed that logic and it was missed.
--- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/btf.c +2 -2
@@ -1061,7 +1061,7 @@ static struct btf *btf_new(const void *data, __u32 size, struct btf *base_btf, bif (base_btf) { btf->base_btf = base_btf; btf->start_id =btf__type_cnt (base_btf); - btf->start_str_off = base_btf->hdr->str_len; + btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off; }if (is_mmap) {
@@ -5818,7 +5818,7 @@ void btf_set_base_btf(struct btf *btf, const struct btf *base_btf) { btf->base_btf = (struct btf *)base_btf; btf->start_id =btf__type_cnt (base_btf); - btf->start_str_off = base_btf->hdr->str_len; + btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off; }int btf__relocate (struct btf *btf,const struct btf *base_btf)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 203/614 ARM: dts: am33xx: Add missing serial console speed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9c95fc710b0d05f797db9e26d56524efa74f8978 ]
Without a serial console speed specified in chosen/stdout-path in the DTB, the serial console uses the default speed of the serial driver, unless explicitly overridden in a legacy console= kernel command-line parameter.
After dropping "ti,omap3-uart" from the list of compatible values in DT, AM33xx serial ports can no longer be used with the legacy OMAP serial driver, but only with the OMAP-flavored 8250 serial driver (which is mutually-exclusive with the former). However, replacing CONFIG_SERIAL_OMAP=y by CONFIG_SERIAL_8250_OMAP=y (with/without enabling CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP) may not be sufficient to restore serial console functionality: the legacy OMAP serial driver defaults to 115200 bps, while the 8250 serial driver defaults to 9600 bps, causing no visible output on the serial console when no appropriate console= kernel command-line parameter is specified.
Fix this for all AM33xx boards by adding ":115200n8" to chosen/stdout-path. This requires replacing the "&uartN" reference by the corresponding "serialN" DT alias.
--- arch/arm/boot/dts/ti/omap/am335x-bone-common.dtsi | 2 +- arch/arm/boot/dts/ti/omap/am335x-boneblue.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-chiliboard.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-evm.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-evmsk.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-guardian.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-icev2.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-myirtech-myd.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-osd3358-sm-red.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-pdu001.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-pocketbeagle.dts | 2 +- arch/arm/boot/dts/ti/omap/am335x-sl50.dts | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/ti/omap/am335x-bone-common.dtsi +1 -1
@@ -16,7 +16,7 @@ memory@80000000 { }; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
arch/arm/boot/dts/ti/omap/am335x-boneblue.dts +1 -1
@@ -13,7 +13,7 @@ / { compatible = "ti,am335x-bone-blue", "ti,am33xx"; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
arch/arm/boot/dts/ti/omap/am335x-chiliboard.dts +1 -1
@@ -12,7 +12,7 @@ / { "ti,am33xx"; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
arch/arm/boot/dts/ti/omap/am335x-evm.dts +1 -1
@@ -23,7 +23,7 @@ memory@80000000 { }; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; vbat: fixedregulator0 {
arch/arm/boot/dts/ti/omap/am335x-evmsk.dts +1 -1
@@ -30,7 +30,7 @@ memory@80000000 { }; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; vbat: fixedregulator0 {
arch/arm/boot/dts/ti/omap/am335x-guardian.dts +1 -1
@@ -14,7 +14,7 @@ / { compatible = "bosch,am335x-guardian", "ti,am33xx"; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; tick-timer = &timer2; };
arch/arm/boot/dts/ti/omap/am335x-icev2.dts +1 -1
@@ -22,7 +22,7 @@ memory@80000000 { }; chosen { - stdout-path = &uart3; + stdout-path = "serial3:115200n8"; }; vbat: fixedregulator0 {
arch/arm/boot/dts/ti/omap/am335x-myirtech-myd.dts +1 -1
@@ -15,7 +15,7 @@ / { compatible = "myir,myd-am335x", "myir,myc-am335x", "ti,am33xx"; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; clk12m: clk12m {
arch/arm/boot/dts/ti/omap/am335x-osd3358-sm-red.dts +1 -1
@@ -147,7 +147,7 @@ simple-audio-card,codec { }; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
arch/arm/boot/dts/ti/omap/am335x-pdu001.dts +1 -1
@@ -21,7 +21,7 @@ / { compatible = "ti,am33xx"; chosen { - stdout-path = &uart3; + stdout-path = "serial3:115200n8"; }; cpus {
arch/arm/boot/dts/ti/omap/am335x-pocketbeagle.dts +1 -1
@@ -15,7 +15,7 @@ / { compatible = "ti,am335x-pocketbeagle", "ti,am335x-bone", "ti,am33xx"; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
arch/arm/boot/dts/ti/omap/am335x-sl50.dts +1 -1
@@ -25,7 +25,7 @@ memory@80000000 { }; chosen { - stdout-path = &uart0; + stdout-path = "serial0:115200n8"; }; leds {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 204/614 ARM: dts: am335x-netcom-plus-2xx: add missing GPIO labels
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yegor Yefremov <[email protected]>
[ Upstream commit d0c4b1723c419a18cb434903c7754954ecb51d35 ]
--- arch/arm/boot/dts/ti/omap/am335x-netcom-plus-2xx.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/ti/omap/am335x-netcom-plus-2xx.dts +4 -4
@@ -222,10 +222,10 @@ &gpio3 { "ModeA1", "ModeA2", "ModeA3", - "NC", - "NC", - "NC", - "NC", + "ModeB0", + "ModeB1", + "ModeB2", + "ModeB3", "NC", "NC", "NC",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 205/614 ARM: dts: omap3: beagle-xm: Correct obsolete TWL4030 power compatible
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit f7f3bc18300a230e0f1bfb17fc8889435c1e47f5 ]
The "ti,twl4030-power-beagleboard-xm" compatible string is obsolete and is not supported by any in-kernel driver. Currently, the kernel falls back to the second entry, "ti,twl4030-power-idle-osc-off", to bind a driver to this node.
Make this fallback explicit by removing the obsolete board-specific compatible. This preserves the existing functionality while making the DTS compliant with the new, stricter 'ti,twl.yaml' binding.
--- arch/arm/boot/dts/ti/omap/omap3-beagle-xm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/omap3-beagle-xm.dts +1 -1
@@ -291,7 +291,7 @@ codec { }; twl_power: power { - compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off"; + compatible = "ti,twl4030-power-idle-osc-off"; ti,use_poweroff; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 206/614 ARM: dts: omap3: n900: Correct obsolete TWL4030 power compatible
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit 3862123e9b56663c7a3e4a308e6e65bffe44f646 ]
The "ti,twl4030-power-n900" compatible string is obsolete and is not supported by any in-kernel driver. Currently, the kernel falls back to the second entry, "ti,twl4030-power-idle-osc-off", to bind a driver to this node.
Make this fallback explicit by removing the obsolete board-specific compatible. This preserves the existing functionality while making the DTS compliant with the new, stricter 'ti,twl.yaml' binding.
--- arch/arm/boot/dts/ti/omap/omap3-n900.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/omap3-n900.dts +1 -1
@@ -508,7 +508,7 @@ twl_audio: audio { }; twl_power: power { - compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; + compatible = "ti,twl4030-power-idle-osc-off"; ti,use_poweroff; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 207/614 entry,unwind/deferred: Fix unwind_reset_info() placement
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit cf76553aaa363620f58a6b6409bf544f4bcfa8de ]
Stephen reported that on KASAN builds he's seeing:
vmlinux.o: warning: objtool: user_exc_vmm_communication+0x15a: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_debug_user+0x182: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_int3+0x123: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: noist_exc_machine_check+0x17a: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: fred_exc_machine_check+0x17e: call to __kasan_check_read() leaves .noinstr.text section
This turns out to be atomic ops from unwind_reset_info() that have explicit instrumentation. Place unwind_reset_info() in the preceding instrumentation_begin() section.
--- include/linux/irq-entry-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irq-entry-common.h +1 -1
@@ -253,11 +253,11 @@ static __always_inline void exit_to_user_mode_prepare(struct pt_regs *regs) static __always_inline void exit_to_user_mode(void) {instrumentation_begin (); +unwind_reset_info ();trace_hardirqs_on_prepare ();lockdep_hardirqs_on_prepare ();instrumentation_end (); -unwind_reset_info ();user_enter_irqoff ();arch_exit_to_user_mode ();lockdep_hardirqs_on (CALLER_ADDR0 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 208/614 arm64: tegra: Add pinctrl definitions for pcie-ep nodes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit 21ef26d0e71f053e809926d45b86b0afbc3686bb ]
When the PCIe controller is running in endpoint mode, the controller initialization is triggered by a PERST# (PCIe reset) GPIO deassertion.
The driver has configured an IRQ to trigger when the PERST# GPIO changes state. Without the pinctrl definition, we do not get an IRQ when PERST# is deasserted, so the PCIe controller never gets initialized.
Add the missing definitions, so that the controller actually gets initialized.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +61 -0
@@ -9,6 +9,7 @@ #include <dt-bindings/power/tegra234-powergate.h> #include <dt-bindings/reset/tegra234-reset.h> #include <dt-bindings/thermal/tegra234-bpmp-thermal.h> +#include <dt-bindings/pinctrl/pinctrl-tegra.h> / { compatible = "nvidia,tegra234";
@@ -127,6 +128,56 @@ gpio: gpio@2200000 { pinmux: pinmux@2430000 { compatible = "nvidia,tegra234-pinmux"; reg = <0x0 0x2430000 0x0 0x19100>; + + pex_rst_c4_in_state: pinmux-pex-rst-c4-in { + pex_rst { + nvidia,pins = "pex_l4_rst_n_pl1"; + nvidia,function = "rsvd1"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_ENABLE>; + nvidia,enable-input = <TEGRA_PIN_ENABLE>; + }; + }; + + pex_rst_c5_in_state: pinmux-pex-rst-c5-in { + pex_rst { + nvidia,pins = "pex_l5_rst_n_paf1"; + nvidia,function = "rsvd1"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_ENABLE>; + nvidia,enable-input = <TEGRA_PIN_ENABLE>; + }; + }; + + pex_rst_c6_in_state: pinmux-pex-rst-c6-in { + pex_rst { + nvidia,pins = "pex_l6_rst_n_paf3"; + nvidia,function = "rsvd1"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_ENABLE>; + nvidia,enable-input = <TEGRA_PIN_ENABLE>; + }; + }; + + pex_rst_c7_in_state: pinmux-pex-rst-c7-in { + pex_rst { + nvidia,pins = "pex_l7_rst_n_pag1"; + nvidia,function = "rsvd1"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_ENABLE>; + nvidia,enable-input = <TEGRA_PIN_ENABLE>; + }; + }; + + pex_rst_c10_in_state: pinmux-pex-rst-c10-in { + pex_rst { + nvidia,pins = "pex_l10_rst_n_pag7"; + nvidia,function = "rsvd1"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_ENABLE>; + nvidia,enable-input = <TEGRA_PIN_ENABLE>; + }; + }; }; gpcdma: dma-controller@2600000 {
@@ -4630,6 +4681,8 @@ pcie-ep@140e0000 { <&bpmp TEGRA234_RESET_PEX2_CORE_10>; reset-names = "apb", "core"; + pinctrl-names = "default"; + pinctrl-0 = <&pex_rst_c10_in_state>; interrupts = <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ interrupt-names = "intr";
@@ -4881,6 +4934,8 @@ pcie-ep@14160000 { <&bpmp TEGRA234_RESET_PEX0_CORE_4>; reset-names = "apb", "core"; + pinctrl-names = "default"; + pinctrl-0 = <&pex_rst_c4_in_state>; interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ interrupt-names = "intr"; nvidia,bpmp = <&bpmp 4>;
@@ -5023,6 +5078,8 @@ pcie-ep@141a0000 { <&bpmp TEGRA234_RESET_PEX1_CORE_5>; reset-names = "apb", "core"; + pinctrl-names = "default"; + pinctrl-0 = <&pex_rst_c5_in_state>; interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ interrupt-names = "intr";
@@ -5115,6 +5172,8 @@ pcie-ep@141c0000 { <&bpmp TEGRA234_RESET_PEX1_CORE_6>; reset-names = "apb", "core"; + pinctrl-names = "default"; + pinctrl-0 = <&pex_rst_c6_in_state>; interrupts = <GIC_SPI 352 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ interrupt-names = "intr";
@@ -5207,6 +5266,8 @@ pcie-ep@141e0000 { <&bpmp TEGRA234_RESET_PEX2_CORE_7>; reset-names = "apb", "core"; + pinctrl-names = "default"; + pinctrl-0 = <&pex_rst_c7_in_state>; interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ interrupt-names = "intr";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 209/614 coresight: ETR: Fix ETR buffer use-after-free issue
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoqi Zhuang <[email protected]>
[ Upstream commit 35501ac3c7d40a7bb9568c2f89d6b56beaf9bed3 ]
When ETR is enabled as CS_MODE_SYSFS, if the buffer size is changed and enabled again, currently sysfs_buf will point to the newly allocated memory(buf_new) and free the old memory(buf_old). But the etr_buf that is being used by the ETR remains pointed to buf_old, not updated to buf_new. In this case, it will result in a memory use-after-free issue.
Fix this by checking ETR's mode before updating and releasing buf_old, if the mode is CS_MODE_SYSFS, then skip updating and releasing it.
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwtracing/coresight/coresight-tmc-etr.c +7 -0
@@ -1250,6 +1250,13 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)* with the lock released. */ raw_spin_lock_irqsave (&drvdata->spinlock, flags); + +/* +* If the ETR is already enabled, continue with the existing buffer. +*/ +if (coresight_get_mode (csdev) ==CS_MODE_SYSFS ) + goto out; + sysfs_buf =READ_ONCE (drvdata->sysfs_buf);if (!sysfs_buf || (sysfs_buf->size != drvdata->size)) {raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 210/614 x86/boot: Fix page table access in 5-level to 4-level paging transition
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit eb2266312507d7b757859e2227aa5c4ba6280ebe ]
When transitioning from 5-level to 4-level paging, the existing code incorrectly accesses page table entries by directly dereferencing CR3 and applying PAGE_MASK. This approach has several issues:
- __native_read_cr3() returns the raw CR3 register value, which on x86_64 includes not just the physical address but also flags. Bits above the physical address width of the system i.e. above __PHYSICAL_MASK_SHIFT) are also not masked.
- The PGD entry is masked by PAGE_SIZE which doesn't take into account the higher bits such as _PAGE_BIT_NOPTISHADOW.
Replace this with proper accessor functions:
- native_read_cr3_pa(): Uses CR3_ADDR_MASK to additionally mask metadata out of CR3 (like SME or LAM bits). All remaining bits are real address bits or reserved and must be 0.
- mask pgd value with PTE_PFN_MASK instead of PAGE_MASK, accounting for flags above bit 51 (_PAGE_BIT_NOPTISHADOW in particular). Bits below 51, but above the max physical address are reserved and must be 0.
--- arch/x86/boot/compressed/pgtable_64.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/boot/compressed/pgtable_64.c +7 -4
@@ -3,6 +3,7 @@#include <asm/bootparam.h> #include <asm/bootparam_utils.h> #include <asm/e820/types.h> +#include <asm/pgtable.h> #include <asm/processor.h> #include "../string.h" #include "efi.h"
@@ -168,9 +169,10 @@ asmlinkage void configure_5level_paging(struct boot_params *bp, void *pgtable)* For 4- to 5-level paging transition, set up current CR3 as * the first and the only entry in a new top-level page table. */ - *trampoline_32bit =__native_read_cr3 () | _PAGE_TABLE_NOENC; + *trampoline_32bit =native_read_cr3_pa () | _PAGE_TABLE_NOENC; }else { -unsigned long src; +u64 *new_cr3; +pgd_t *pgdp;/* * For 5- to 4-level paging transition, copy page table pointed
@@ -180,8 +182,9 @@ asmlinkage void configure_5level_paging(struct boot_params *bp, void *pgtable)* We cannot just point to the page table from trampoline as it * may be above 4G. */ - src = *(unsigned long *)__native_read_cr3 () &PAGE_MASK ; -memcpy (trampoline_32bit, (void *)src,PAGE_SIZE ); + pgdp = (pgd_t *)native_read_cr3_pa (); + new_cr3 = (u64 *)(native_pgd_val (pgdp[0 ]) &PTE_PFN_MASK ); +memcpy (trampoline_32bit, new_cr3,PAGE_SIZE ); }toggle_la57 (trampoline_32bit);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 211/614 efi/libstub: Fix page table access in 5-level to 4-level paging transition
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit 84361123413efc84b06f3441c6c827b95d902732 ]
When transitioning from 5-level to 4-level paging, the existing code incorrectly accesses page table entries by directly dereferencing CR3 and applying PAGE_MASK. This approach has several issues:
- __native_read_cr3() returns the raw CR3 register value, which on x86_64 includes not just the physical address but also flags Bits above the physical address width of the system (i.e. above __PHYSICAL_MASK_SHIFT) are also not masked.
- The pgd value is masked by PAGE_SIZE which doesn't take into account the higher bits such as _PAGE_BIT_NOPTISHADOW.
Replace this with proper accessor functions:
- native_read_cr3_pa(): Uses CR3_ADDR_MASK to additionally mask metadata out of CR3 (like SME or LAM bits). All remaining bits are real address bits or reserved and must be 0.
- mask pgd value with PTE_PFN_MASK instead of PAGE_MASK, accounting for flags above bit 51 (_PAGE_BIT_NOPTISHADOW in particular). Bits below 51, but above the max physical address are reserved and must be 0.
--- drivers/firmware/efi/libstub/x86-5lvl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/libstub/x86-5lvl.c +2 -2
@@ -66,7 +66,7 @@ void efi_5level_switch(void)bool have_la57 =native_read_cr4 () &X86_CR4_LA57 ;bool need_toggle = want_la57 ^ have_la57;u64 *pgt = (void *)la57_toggle +PAGE_SIZE ; -u64 *cr3 = (u64 *)__native_read_cr3 (); +pgd_t *cr3 = (pgd_t *)native_read_cr3_pa ();u64 *new_cr3;if (!la57_toggle || !need_toggle)
@@ -82,7 +82,7 @@ void efi_5level_switch(void) new_cr3[0 ] = (u64 )cr3 | _PAGE_TABLE_NOENC; }else {/* take the new root table pointer from the current entry #0 */ - new_cr3 = (u64 *)(cr3[0 ] &PAGE_MASK ); + new_cr3 = (u64 *)(native_pgd_val (cr3[0 ]) &PTE_PFN_MASK );/* copy the new root table if it is not 32-bit addressable */ if ((u64 )new_cr3 >U32_MAX )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 212/614 locktorture: Fix memory leak in param_set_cpumask()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit e52b43883d084a9af263c573f2a1bd1ca5088389 ]
With CONFIG_CPUMASK_OFFSTACK=y, the 'bind_writers' buffer is allocated via alloc_cpumask_var() in param_set_cpumask(). But it is not freed, when setting the module parameter multiple times by sysfs interface or removing module.
Below kmemleak trace is seen for this issue:
unreferenced object 0xffff888100aabff8 (size 8):
comm "bash", pid 323, jiffies 4295059233
hex dump (first 8 bytes):
07 00 00 00 00 00 00 00 ........
backtrace (crc ac50919):
__kmalloc_node_noprof+0x2e5/0x420
alloc_cpumask_var_node+0x1f/0x30
param_set_cpumask+0x26/0xb0 [locktorture]
param_attr_store+0x93/0x100
module_attr_store+0x1b/0x30
kernfs_fop_write_iter+0x114/0x1b0
vfs_write+0x300/0x410
ksys_write+0x60/0xd0
do_syscall_64+0xa4/0x260
entry_SYSCALL_64_after_hwframe+0x77/0x7fThis issue can be reproduced by:
insmod locktorture.ko bind_writers=1
rmmod locktorture
or:
insmod locktorture.ko bind_writers=1
echo 2 > /sys/module/locktorture/parameters/bind_writers
Considering that setting the module parameter 'bind_writers' or 'bind_readers' by sysfs interface has no real effect, set the parameter permissions to 0444. To fix the memory leak when removing module, free 'bind_writers' and 'bind_readers' memory in lock_torture_cleanup().
--- kernel/locking/locktorture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/locking/locktorture.c +6 -2
@@ -103,8 +103,8 @@ static const struct kernel_param_ops lt_bind_ops = { .get = param_get_cpumask, }; -module_param_cb (bind_readers, <_bind_ops, &bind_readers,0644 ); -module_param_cb (bind_writers, <_bind_ops, &bind_writers,0644 ); +module_param_cb (bind_readers, <_bind_ops, &bind_readers,0444 ); +module_param_cb (bind_writers, <_bind_ops, &bind_writers,0444 );long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask,bool dowarn);
@@ -1211,6 +1211,10 @@ static void lock_torture_cleanup(void) cxt.cur_ops->exit (); cxt.init_called = false; } + +free_cpumask_var (bind_readers); +free_cpumask_var (bind_writers); +torture_cleanup_end (); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 213/614 wifi: rtw89: usb: use common error path for skbs in rtw89_usb_rx_handler()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 28a45575289f3292aa9cb7bacae18ba3ee7a6adf ]
Allow adding rx_skb to rx_free_queue for later reuse on the common error handling path, otherwise free it.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/usb.c +3 -3
@@ -410,8 +410,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)if (skb_queue_len (&rtwusb->rx_queue) >=RTW89_USB_MAX_RXQ_LEN ) {rtw89_warn (rtwdev,"rx_queue overflow\n" ); -dev_kfree_skb_any (rx_skb); -continue ; + goto free_or_reuse; }memset (&desc_info,0 ,sizeof (desc_info));
@@ -422,7 +421,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)rtw89_debug (rtwdev,RTW89_DBG_HCI ,"failed to allocate RX skb of size %u\n" , desc_info.pkt_size); -continue ; + goto free_or_reuse; } pkt_offset = desc_info.offset + desc_info.rxd_len;
@@ -432,6 +431,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)rtw89_core_rx (rtwdev, &desc_info, skb); +free_or_reuse:if (skb_queue_len (&rtwusb->rx_free_queue) >=RTW89_USB_RX_SKB_NUM )dev_kfree_skb_any (rx_skb);else
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 214/614 wifi: rtw89: usb: fix leak in rtw89_usb_write_port()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 7543818e97d5d54b3b2f75f1c4dedee298d7d914 ]
When there is an attempt to write data and RTW89_FLAG_UNPLUGGED is set, this means device is disconnected and no urb is submitted. Return appropriate error code to the caller to properly free the allocated resources.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/usb.c +4 -3
@@ -256,7 +256,7 @@ static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,int ret;if (test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) -return 0 ; +return -ENODEV ; urb =usb_alloc_urb (0 ,GFP_ATOMIC );if (!urb)
@@ -305,8 +305,9 @@ static void rtw89_usb_ops_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch) ret =rtw89_usb_write_port (rtwdev, txch, skb->data, skb->len, txcb);if (ret) { -rtw89_err (rtwdev,"write port txch %d failed: %d\n" , - txch, ret); +if (ret != -ENODEV ) +rtw89_err (rtwdev,"write port txch %d failed: %d\n" , + txch, ret);skb_dequeue (&txcb->tx_ack_queue);kfree (txcb);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 215/614 perf annotate: Fix build with NO_SLANG=1
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 0e6c07a3c30cdc4509fc5e7dc490d4cc6e5c241a ]
The recent change for perf c2c annotate broke build without slang support like below.
builtin-annotate.c: In function 'hists__find_annotations':
builtin-annotate.c:522:73: error: 'NO_ADDR' undeclared (first use in this function); did you mean 'NR_ADDR'?
522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR);
| ^~~~~~~
| NR_ADDRbuiltin-annotate.c:522:73: note: each undeclared identifier is reported only once for each function it appears in
builtin-annotate.c:522:31: error: too many arguments to function 'hist_entry__tui_annotate'
522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR);
| ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from util/sort.h:6,
from builtin-annotate.c:28:
util/hist.h:756:19: note: declared here
756 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
| ^~~~~~~~~~~~~~~~~~~~~~~~
And I noticed that it missed to update the other side of #ifdef HAVE_SLANG_SUPPORT. Let's fix it.
--- tools/perf/util/hist.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/util/hist.h +6 -2
@@ -709,6 +709,8 @@ struct block_hist {struct hist_entry he; }; +#define NO_ADDR 0 +#ifdef HAVE_SLANG_SUPPORT #include "../ui/keysyms.h" void attr_to_script (char *buf,struct perf_event_attr *attr);
@@ -746,14 +748,16 @@ int evlist__tui_browse_hists(struct evlist *evlist __maybe_unused,static inline int __hist_entry__tui_annotate (struct hist_entry *he__maybe_unused ,struct map_symbol *ms__maybe_unused ,struct evsel *evsel__maybe_unused , -struct hist_browser_timer *hbt__maybe_unused ) +struct hist_browser_timer *hbt__maybe_unused , +u64 al_addr__maybe_unused ) {return 0 ; }static inline int hist_entry__tui_annotate (struct hist_entry *he__maybe_unused ,struct evsel *evsel__maybe_unused , -struct hist_browser_timer *hbt__maybe_unused ) +struct hist_browser_timer *hbt__maybe_unused , +u64 al_addr__maybe_unused ) {return 0 ; }
Signature · 1 line
2.51.0
Re: [PATCH 6.18 215/614] perf annotate: Fix build with NO_SLANG=1
Quoted 27 lines · Greg Kroah-Hartman
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit
0e6c07a3c30cdc4509fc5e7dc490d4cc6e5c241a]The recent change for perf c2c annotate broke build without slang support like below.
builtin-annotate.c: In function 'hists__find_annotations':
builtin-annotate.c:522:73: error: 'NO_ADDR' undeclared (first use in this function); did you mean 'NR_ADDR'?522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR); | ^~~~~~~ | NR_ADDRbuiltin-annotate.c:522:73: note: each undeclared identifier is reported only once for each function it appears in
builtin-annotate.c:522:31: error: too many arguments to function 'hist_entry__tui_annotate' 522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from util/sort.h:6, from builtin-annotate.c:28: util/hist.h:756:19: note: declared here 756 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, | ^~~~~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
And I noticed that it missed to update the other side of #ifdef
HAVE_SLANG_SUPPORT. Let's fix it.Cc Tianyou Li <[email protected]>Fixes cd3466cd2639783d ("perf c2c: Add annotation support to perf c2c report")
That fixes line ^^^ appears to be wrong, as now I see:builtin-annotate.c: In function ‘hists__find_annotations’:
builtin-annotate.c:522:10: error: too few arguments to function ‘hist_entry__tui_annotate’
key = hist_entry__tui_annotate(he, evsel, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~In file included from util/sort.h:6:0,
from builtin-annotate.c:28:util/hist.h:757:19: note: declared here
static inline int hist_entry__tui_annotate(struct hist_entry *he__maybe_unused,
^~~~~~~~~~~~~~~~~~~~~~~~
Because in util/hist.h, we now have:
int hist_entry__tui_annotate(struct hist_entry *he, struct evsel *evsel,
struct hist_browser_timer *hbt);
...
static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
struct evsel *evsel__maybe_unused,
struct hist_browser_timer
*hbt __maybe_unused,
u64 al_addr __maybe_unused)
{
return 0;
}Was it meant to be
?
Quoted 38 lines
Signed-off-by Namhyung Kim <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- tools/perf/util/hist.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/perf/util/hist.h +6
-2@@ -709,6 +709,8 @@ struct block_hist {struct hist_entry he; }; +#define NO_ADDR 0 +#ifdef HAVE_SLANG_SUPPORT #include "../ui/keysyms.h" void attr_to_script (char *buf,struct perf_event_attr *attr);@@ -746,14 +748,16 @@ int evlist__tui_browse_hists(struct evlist *evlist __maybe_unused,static inline int __hist_entry__tui_annotate (struct hist_entry *he__maybe_unused ,struct map_symbol *ms__maybe_unused ,struct evsel *evsel__maybe_unused , -struct hist_browser_timer *hbt__maybe_unused ) +struct hist_browser_timer *hbt__maybe_unused , +u64 al_addr__maybe_unused ) {return 0 ; }static inline int hist_entry__tui_annotate (struct hist_entry *he__maybe_unused ,struct evsel *evsel__maybe_unused , -struct hist_browser_timer *hbt__maybe_unused ) +struct hist_browser_timer *hbt__maybe_unused , +u64 al_addr__maybe_unused ) {return 0 ; }
Signature · 2 lines
js suse labs
Greg Kroah-Hartman
maintainerRe: [PATCH 6.18 215/614] perf annotate: Fix build with NO_SLANG=1
Quoted 67 lines · Jiri Slaby
Quoted 27 lines · Greg Kroah-Hartman
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit
0e6c07a3c30cdc4509fc5e7dc490d4cc6e5c241a]The recent change for perf c2c annotate broke build without slang support like below.
builtin-annotate.c: In function 'hists__find_annotations':
builtin-annotate.c:522:73: error: 'NO_ADDR' undeclared (first use in this function); did you mean 'NR_ADDR'?522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR); | ^~~~~~~ | NR_ADDRbuiltin-annotate.c:522:73: note: each undeclared identifier is reported only once for each function it appears in
builtin-annotate.c:522:31: error: too many arguments to function 'hist_entry__tui_annotate' 522 | key = hist_entry__tui_annotate(he, evsel, NULL, NO_ADDR); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from util/sort.h:6, from builtin-annotate.c:28: util/hist.h:756:19: note: declared here 756 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, | ^~~~~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
And I noticed that it missed to update the other side of #ifdef
HAVE_SLANG_SUPPORT. Let's fix it.Cc Tianyou Li <[email protected]>Fixes cd3466cd2639783d ("perf c2c: Add annotation support to perf c2c report")That fixes line ^^^ appears to be wrong, as now I see:
builtin-annotate.c: In function ‘hists__find_annotations’:
builtin-annotate.c:522:10: error: too few arguments to function ‘hist_entry__tui_annotate’key = hist_entry__tui_annotate(he, evsel, NULL); ^~~~~~~~~~~~~~~~~~~~~~~~In file included from
util/sort.h:6:0,
from builtin-annotate.c:28:util/hist.h:757:19: note: declared here
static inline int hist_entry__tui_annotate(structhist_entry*he__maybe_unused,^~~~~~~~~~~~~~~~~~~~~~~~Because in
util/hist.h, we now have:
int hist_entry__tui_annotate(structhist_entry*he, struct evsel *evsel,struct hist_browser_timer *hbt);...
static inline int hist_entry__tui_annotate(structhist_entry*he__maybe_unused,
struct evsel *evsel__maybe_unused,
structhist_browser_timer*hbt__maybe_unused,u64 al_addr __maybe_unused) { return 0; }
Quoted 3 lines
Was it meant to be
Fixes ad83f3b7155d perf c2c annotate: Start from the contention line?
Odd. Either way it should not have been backported to 6.18.y as neither of those are in that release (came out in 6.19-rc1.)
I'll go drop this commit from the queues, thanks!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 216/614 mfd: da9055: Fix missing regmap_del_irq_chip() in error path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 1b58acfd067ca16116b9234cd6b2d30cc8ab7502 ]
When da9055_device_init() fails after regmap_add_irq_chip() succeeds but mfd_add_devices() fails, the error handling path only calls mfd_remove_devices() but forgets to call regmap_del_irq_chip(). This results in a resource leak.
Fix this by adding regmap_del_irq_chip() to the error path so that resources are released properly.
--- drivers/mfd/da9055-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/da9055-core.c +1 -0
@@ -388,6 +388,7 @@ int da9055_device_init(struct da9055 *da9055) err:mfd_remove_devices (da9055->dev); +regmap_del_irq_chip (da9055->chip_irq, da9055->irq_data);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 217/614 wifi: ath12k: Fix timeout error during beacon stats retrieval
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Dharanenthiran <[email protected]>
[ Upstream commit 2977567b244f056d86658160659f06cd6c78ba3d ]
Currently, for beacon_stats, ath12k_mac_get_fw_stats() is called for each started BSS on the specified hardware. ath12k_mac_get_fw_stats() will wait for the fw_stats_done completion after fetching the requested data from firmware. For the beacon_stats, fw_stats_done completion will be set only when stats are received for all BSSes. However, for other stats like vdev_stats or pdev_stats, there is one request to the firmware for all enabled BSSes. Since beacon_stats is fetched individually for all BSSes enabled in that pdev, waiting for the completion event results in a timeout error when multiple BSSes are enabled.
Avoid this by completing the fw_stats_done immediately after updating the requested BSS's beacon stats in the list. Subsequently, this list will be used to display the beacon stats for all enabled BSSes in the requested pdev.
Additionally, remove 'num_bcn_recvd' from the ath12k_fw_stats struct as it is no longer needed.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.c | 2 -- drivers/net/wireless/ath/ath12k/core.h | 1 - drivers/net/wireless/ath/ath12k/wmi.c | 10 +--------- 3 files changed, 1 insertion(+), 12 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +0 -2
@@ -1,7 +1,6 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */
@@ -1250,7 +1249,6 @@ void ath12k_fw_stats_reset(struct ath12k *ar)spin_lock_bh (&ar->data_lock);ath12k_fw_stats_free (&ar->fw_stats); ar->fw_stats.num_vdev_recvd =0 ; - ar->fw_stats.num_bcn_recvd =0 ;spin_unlock_bh (&ar->data_lock); }
drivers/net/wireless/ath/ath12k/core.h +0 -1
@@ -644,7 +644,6 @@ struct ath12k_fw_stats {struct list_head vdevs;struct list_head bcn;u32 num_vdev_recvd; -u32 num_bcn_recvd; };struct ath12k_dbg_htt_stats {
drivers/net/wireless/ath/ath12k/wmi.c +1 -9
@@ -8418,18 +8418,10 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar,ath12k_warn (ab,"empty beacon stats" );return ; } -/* Mark end until we reached the count of all started VDEVs -* within the PDEV -*/ -if (ar->num_started_vdevs) - is_end = ((++ar->fw_stats.num_bcn_recvd) == - ar->num_started_vdevs);list_splice_tail_init (&stats->bcn, &ar->fw_stats.bcn); - -if (is_end) -complete (&ar->fw_stats_done); +complete (&ar->fw_stats_done); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 218/614 ext4: correct the checking of quota files before moving extents
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
[ Upstream commit a2e5a3cea4b18f6e2575acc444a5e8cce1fc8260 ]
The move extent operation should return -EOPNOTSUPP if any of the inodes is a quota inode, rather than requiring both to be quota inodes.
Message-ID: <[email protected]>
--- fs/ext4/move_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/move_extent.c +1 -1
@@ -485,7 +485,7 @@ mext_check_arguments(struct inode *orig_inode,return -ETXTBSY ; } -if (ext4_is_quota_file (orig_inode) &&ext4_is_quota_file (donor_inode)) { +if (ext4_is_quota_file (orig_inode) ||ext4_is_quota_file (donor_inode)) {ext4_debug ("ext4 move extent: The argument files should not be quota files [ino:orig %lu, donor %lu]\n" , orig_inode->i_ino, donor_inode->i_ino);return -EOPNOTSUPP ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 219/614 accel/amdxdna: Fix dma_fence leak when job is canceled
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit dea9f84776b96a703f504631ebe9fea07bd2c181 ]
Currently, dma_fence_put(job->fence) is called in job notification callback. However, if a job is canceled, the notification callback is never invoked, leading to a memory leak. Move dma_fence_put(job->fence) to the job cleanup function to ensure the fence is always released.
--- drivers/accel/amdxdna/aie2_ctx.c | 1 - drivers/accel/amdxdna/amdxdna_ctx.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/accel/amdxdna/aie2_ctx.c +0 -1
@@ -189,7 +189,6 @@ aie2_sched_notify(struct amdxdna_sched_job *job)up (&job->hwctx->priv->job_sem); job->job_done = true; -dma_fence_put (fence);mmput_async (job->mm);aie2_job_put (job); }
drivers/accel/amdxdna/amdxdna_ctx.c +1 -0
@@ -389,6 +389,7 @@ void amdxdna_sched_job_cleanup(struct amdxdna_sched_job *job)trace_amdxdna_debug_point (job->hwctx->name, job->seq,"job release" );amdxdna_arg_bos_put (job);amdxdna_gem_put_obj (job->cmd_bo); +dma_fence_put (job->fence); } int amdxdna_cmd_submit(struct amdxdna_client *client,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 220/614 hfs: fix potential use after free in hfs_correct_next_unused_CNID()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit c105e76bb17cf4b55fe89c6ad4f6a0e3972b5b08 ]
This code calls hfs_bnode_put(node) which drops the refcount and then dreferences "node" on the next line. It's only safe to use "node" when we're holding a reference so flip these two lines around.
--- fs/hfs/catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/catalog.c +1 -1
@@ -322,9 +322,9 @@ int hfs_correct_next_unused_CNID(struct super_block *sb, u32 cnid) } } + node_id = node->prev;hfs_bnode_put (node); - node_id = node->prev; }while (node_id >= leaf_head);return -ENOENT ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 221/614 arm64: dts: rockchip: Fix USB Type-C host mode for Radxa ROCK 5B+/5T
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUKAUMI Naoki <[email protected]>
[ Upstream commit fbf90d1b697faf61bb8b3ed72be6a8ebeb09de3d ]
The Radxa ROCK 5B+/5T USB Type-C port supports Dual Role Data and should also act as a host. However, currently, when acting as a host, only self-powered devices work.
Since the ROCK 5B+ supports Dual Role Power, set the power-role property to "dual" and the try-power-role property to "sink". (along with related properties)
The ROCK 5T should only support the "source" power-role.
This allows the port to act as a host, supply power to the port, and allow bus-powered devices to work.
Note that on the ROCK 5T, with this patch applied, it has been observed that some bus-powered devices do not work correctly. Also, it has been observed that after connecting a device (and the data-role switches to host), connecting a host device does not switch the data-role back to the device role. These issues should be addressed separately.
Note that there is a separate known issue where USB 3.0 SuperSpeed devices do not work when oriented in reverse. This issue should also be addressed separately. (USB 2.0/1.1 devices work in both orientations)
--- arch/arm64/boot/dts/rockchip/rk3588-rock-5b-5bp-5t.dtsi | 4 ++-- arch/arm64/boot/dts/rockchip/rk3588-rock-5b-plus.dts | 5 +++++ arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 4 ++++ arch/arm64/boot/dts/rockchip/rk3588-rock-5t.dts | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-rock-5b-5bp-5t.dtsi +2 -2
@@ -331,12 +331,12 @@ usb_con: connector { data-role = "dual"; /* fusb302 supports PD Rev 2.0 Ver 1.2 */ pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>; - power-role = "sink"; - try-power-role = "sink"; op-sink-microwatt = <1000000>; sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>, <PDO_VAR(5000, 20000, 5000)>; + source-pdos = + <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>; altmodes { displayport {
arch/arm64/boot/dts/rockchip/rk3588-rock-5b-plus.dts +5 -0
@@ -110,6 +110,11 @@ vcc5v0_host_en: vcc5v0-host-en { }; }; +&usb_con { + power-role = "dual"; + try-power-role = "sink"; +}; + &usbdp_phy0 { pinctrl-names = "default"; pinctrl-0 = <&usbc_sbu_dc>;
arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +4 -0
@@ -49,6 +49,10 @@ vcc5v0_host_en: vcc5v0-host-en { }; }; +&usb_con { + power-role = "sink"; +}; + &usbdp_phy0 { pinctrl-names = "default"; pinctrl-0 = <&usbc_sbu_dc>;
arch/arm64/boot/dts/rockchip/rk3588-rock-5t.dts +4 -0
@@ -130,6 +130,10 @@ usbc_sbu_dc: usbc-sbu-dc { }; }; +&usb_con { + power-role = "source"; +}; + &usbdp_phy0 { pinctrl-names = "default"; pinctrl-0 = <&usbc_sbu_dc>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 222/614 io_uring: use WRITE_ONCE for user shared memory
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 93e197e524b14d185d011813b72773a1a49d932d ]
IORING_SETUP_NO_MMAP rings remain user accessible even before the ctx setup is finalised, so use WRITE_ONCE consistently when initialising rings.
--- io_uring/io_uring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
io_uring/io_uring.c +6 -4
@@ -3623,10 +3623,6 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx,if (!(ctx->flags &IORING_SETUP_NO_SQARRAY )) ctx->sq_array = (u32 *)((char *)rings + sq_array_offset); - rings->sq_ring_mask = p->sq_entries -1 ; - rings->cq_ring_mask = p->cq_entries -1 ; - rings->sq_ring_entries = p->sq_entries; - rings->cq_ring_entries = p->cq_entries;if (p->flags &IORING_SETUP_SQE128 ) size =array_size (2 *sizeof (struct io_uring_sqe ), p->sq_entries);
@@ -3649,6 +3645,12 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx,return ret; } ctx->sq_sqes =io_region_get_ptr (&ctx->sq_region); + +memset (rings,0 ,sizeof (*rings)); +WRITE_ONCE (rings->sq_ring_mask, ctx->sq_entries -1 ); +WRITE_ONCE (rings->cq_ring_mask, ctx->cq_entries -1 ); +WRITE_ONCE (rings->sq_ring_entries, ctx->sq_entries); +WRITE_ONCE (rings->cq_ring_entries, ctx->cq_entries);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 223/614 perf/x86: Fix NULL event access and potential PEBS record loss
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit 7e772a93eb61cb6265bdd1c5bde17d0f2718b452 ]
When intel_pmu_drain_pebs_icl() is called to drain PEBS records, the perf_event_overflow() could be called to process the last PEBS record.
While perf_event_overflow() could trigger the interrupt throttle and stop all events of the group, like what the below call-chain shows.
perf_event_overflow()
-> __perf_event_overflow()
->__perf_event_account_interrupt()
-> perf_event_throttle_group()
-> perf_event_throttle()
-> event->pmu->stop()
-> x86_pmu_stop()The side effect of stopping the events is that all corresponding event pointers in cpuc->events[] array are cleared to NULL.
Assume there are two PEBS events (event a and event b) in a group. When intel_pmu_drain_pebs_icl() calls perf_event_overflow() to process the last PEBS record of PEBS event a, interrupt throttle is triggered and all pointers of event a and event b are cleared to NULL. Then intel_pmu_drain_pebs_icl() tries to process the last PEBS record of event b and encounters NULL pointer access.
To avoid this issue, move cpuc->events[] clearing from x86_pmu_stop() to x86_pmu_del(). It's safe since cpuc->active_mask or cpuc->pebs_enabled is always checked before access the event pointer from cpuc->events[].
--- arch/x86/events/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/events/core.c +3 -2
@@ -1344,6 +1344,7 @@ static void x86_pmu_enable(struct pmu *pmu) hwc->state |=PERF_HES_ARCH ;x86_pmu_stop (event,PERF_EF_UPDATE ); + cpuc->events[hwc->idx] =NULL ; }/*
@@ -1365,6 +1366,7 @@ static void x86_pmu_enable(struct pmu *pmu)* if cpuc->enabled = 0, then no wrmsr as * per x86_pmu_enable_event() */ + cpuc->events[hwc->idx] = event;x86_pmu_start (event,PERF_EF_RELOAD ); } cpuc->n_added =0 ;
@@ -1531,7 +1533,6 @@ static void x86_pmu_start(struct perf_event *event, int flags) event->hw.state =0 ; - cpuc->events[idx] = event;__set_bit (idx, cpuc->active_mask);static_call (x86_pmu_enable)(event);perf_event_update_userpage (event);
@@ -1610,7 +1611,6 @@ void x86_pmu_stop(struct perf_event *event, int flags)if (test_bit (hwc->idx, cpuc->active_mask)) {static_call (x86_pmu_disable)(event);__clear_bit (hwc->idx, cpuc->active_mask); - cpuc->events[hwc->idx] =NULL ;WARN_ON_ONCE (hwc->state &PERF_HES_STOPPED ); hwc->state |=PERF_HES_STOPPED ; }
@@ -1648,6 +1648,7 @@ static void x86_pmu_del(struct perf_event *event, int flags)* Not a TXN, therefore cleanup properly. */ x86_pmu_stop (event,PERF_EF_UPDATE ); + cpuc->events[event->hw.idx] =NULL ;for (i =0 ; i < cpuc->n_events; i++) {if (event == cpuc->event_list[i])
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 224/614 perf/x86/intel: Correct large PEBS flag check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit 5e4e355ae7cdeb0fef5dbe908866e1f895abfacc ]
current large PEBS flag check only checks if sample_regs_user contains unsupported GPRs but doesn't check if sample_regs_intr contains unsupported GPRs.
Of course, currently PEBS HW supports to sample all perf supported GPRs, the missed check doesn't cause real issue. But it won't be true any more after the subsequent patches support to sample SSP register. SSP sampling is not supported by adaptive PEBS HW and it would be supported until arch-PEBS HW. So correct this issue.
--- arch/x86/events/intel/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +3 -1
@@ -4029,7 +4029,9 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event)if (!event->attr.exclude_kernel) flags &= ~PERF_SAMPLE_REGS_USER ;if (event->attr.sample_regs_user & ~PEBS_GP_REGS ) - flags &= ~(PERF_SAMPLE_REGS_USER |PERF_SAMPLE_REGS_INTR ); + flags &= ~PERF_SAMPLE_REGS_USER ; +if (event->attr.sample_regs_intr & ~PEBS_GP_REGS ) + flags &= ~PERF_SAMPLE_REGS_INTR ;return flags; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 225/614 regulator: core: disable supply if enabling main regulator fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
[ Upstream commit fb1ebb10468da414d57153ddebaab29c38ef1a78 ]
For 'always-on' and 'boot-on' regulators, the set_machine_constraints() may enable supply before enabling the main regulator, however if the latter fails, the function returns with an error but the supply remains enabled.
When this happens, the regulator_register() function continues on the error path where it puts the supply regulator. Since enabling the supply is not balanced with a disable call, a warning similar to the following gets issued from _regulator_put():
[ 1.603889] WARNING: CPU: 2 PID: 44 at _regulator_put+0x8c/0xa0
[ 1.603908] Modules linked in:
[ 1.603926] CPU: 2 UID: 0 PID: 44 Comm: kworker/u16:3 Not tainted 6.18.0-rc4 #0 NONE
[ 1.603938] Hardware name: Qualcomm Technologies, Inc. IPQ9574/AP-AL02-C7 (DT)
[ 1.603945] Workqueue: async async_run_entry_fn
[ 1.603958] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1.603967] pc : _regulator_put+0x8c/0xa0
[ 1.603976] lr : _regulator_put+0x7c/0xa0
...
[ 1.604140] Call trace:
[ 1.604145] _regulator_put+0x8c/0xa0 (P)
[ 1.604156] regulator_register+0x2ec/0xbf0
[ 1.604166] devm_regulator_register+0x60/0xb0
[ 1.604178] rpm_reg_probe+0x120/0x208
[ 1.604187] platform_probe+0x64/0xa8
...In order to avoid this, change the set_machine_constraints() function to disable the supply if enabling the main regulator fails.
--- drivers/regulator/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/regulator/core.c +5 -0
@@ -1618,6 +1618,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)* and we have control then make sure it is enabled. */ if (rdev->constraints->always_on || rdev->constraints->boot_on) { +bool supply_enabled = false; +/* If we want to enable this regulator, make sure that we know * the supplying regulator. */
@@ -1637,11 +1639,14 @@ static int set_machine_constraints(struct regulator_dev *rdev) rdev->supply =NULL ;return ret; } + supply_enabled = true; } ret =_regulator_do_enable (rdev);if (ret <0 && ret != -EINVAL ) {rdev_err (rdev,"failed to enable: %pe\n" ,ERR_PTR (ret)); +if (supply_enabled) +regulator_disable (rdev->supply);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 226/614 md: delete mddev kobj before deleting gendisk kobj
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit cc394b94dc40b661efc9895665abf03640ffff2d ]
In sync del gendisk path, it deletes gendisk first and the directory /sys/block/md is removed. Then it releases mddev kobj in a delayed work. If we enable debug log in sysfs_remove_group, we can see the debug log 'sysfs group bitmap not found for kobject md'. It's the reason that the parent kobj has been deleted, so it can't find parent directory.
In creating path, it allocs gendisk first, then adds mddev kobj. So it should delete mddev kobj before deleting gendisk.
Before commit 9e59d609763f ("md: call del_gendisk in control path"), it releases mddev kobj first. If the kobj hasn't been deleted, it does clean job and deletes the kobj. Then it calls del_gendisk and releases gendisk kobj. So it doesn't need to call kobject_del to delete mddev kobj. After this patch, in sync del gendisk path, the sequence changes. So it needs to call kobject_del to delete mddev kobj.
After this patch, the sequence is:
1. kobject del mddev kobj
2. del_gendisk deletes gendisk kobj
3. mddev_delayed_delete releases mddev kobj
4. md_kobj_release releases gendisk kobj
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -941,8 +941,10 @@ void mddev_unlock(struct mddev *mddev)* do_md_stop. dm raid only uses md_stop to stop. So dm raid * doesn't need to check MD_DELETED when getting reconfig lock */ -if (test_bit (MD_DELETED , &mddev->flags)) +if (test_bit (MD_DELETED , &mddev->flags)) { +kobject_del (&mddev->kobj);del_gendisk (mddev->gendisk); + } } }EXPORT_SYMBOL_GPL (mddev_unlock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 227/614 md: fix rcu protection in md_wakeup_thread
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yun Zhou <[email protected]>
[ Upstream commit 0dc76205549b4c25705e54345f211b9f66e018a0 ]
We attempted to use RCU to protect the pointer 'thread', but directly passed the value when calling md_wakeup_thread(). This means that the RCU pointer has been acquired before rcu_read_lock(), which renders rcu_read_lock() ineffective and could lead to a use-after-free.
--- drivers/md/md.c | 14 ++++++-------- drivers/md/md.h | 8 +++++++- 2 files changed, 13 insertions(+), 9 deletions(-)
drivers/md/md.c +6 -8
@@ -99,7 +99,7 @@ static int remove_and_add_spares(struct mddev *mddev, struct md_rdev *this);static void mddev_detach (struct mddev *mddev);static void export_rdev (struct md_rdev *rdev,struct mddev *mddev); -static void md_wakeup_thread_directly (struct md_thread __rcu *thread); +static void md_wakeup_thread_directly (struct md_thread __rcu **thread);/* * Default number of read corrections we'll attempt on an rdev
@@ -5136,7 +5136,7 @@ static void stop_sync_thread(struct mddev *mddev, bool locked)* Thread might be blocked waiting for metadata update which will now * never happen */ -md_wakeup_thread_directly (mddev->sync_thread); +md_wakeup_thread_directly (&mddev->sync_thread);if (work_pending (&mddev->sync_work))flush_work (&mddev->sync_work);
@@ -8375,22 +8375,21 @@ static int md_thread(void *arg)return 0 ; } -static void md_wakeup_thread_directly (struct md_thread __rcu *thread) +static void md_wakeup_thread_directly (struct md_thread __rcu **thread) {struct md_thread *t;rcu_read_lock (); - t =rcu_dereference (thread); + t =rcu_dereference (*thread);if (t)wake_up_process (t->tsk);rcu_read_unlock (); } -void md_wakeup_thread (struct md_thread __rcu *thread) +void __md_wakeup_thread (struct md_thread __rcu *thread) {struct md_thread *t; -rcu_read_lock (); t =rcu_dereference (thread);if (t) {pr_debug ("md: waking up MD thread %s.\n" , t->tsk->comm);
@@ -8398,9 +8397,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)if (wq_has_sleeper (&t->wqueue))wake_up (&t->wqueue); } -rcu_read_unlock (); } -EXPORT_SYMBOL (md_wakeup_thread); +EXPORT_SYMBOL (__md_wakeup_thread);struct md_thread *md_register_thread (void (*run) (struct md_thread *),struct mddev *mddev,const char *name)
drivers/md/md.h +7 -1
@@ -882,6 +882,12 @@ struct md_io_clone {#define THREAD_WAKEUP 0 +#define md_wakeup_thread (thread) do { \ + rcu_read_lock(); \ + __md_wakeup_thread(thread); \ + rcu_read_unlock(); \ +} while (0) +static inline void safe_put_page (struct page *p) {if (p)put_page (p);
@@ -895,7 +901,7 @@ extern struct md_thread *md_register_thread(struct mddev *mddev, const char *name);extern void md_unregister_thread (struct mddev *mddev,struct md_thread __rcu **threadp); -extern void md_wakeup_thread (struct md_thread __rcu *thread); +extern void __md_wakeup_thread (struct md_thread __rcu *thread);extern void md_check_recovery (struct mddev *mddev);extern void md_reap_sync_thread (struct mddev *mddev);extern enum sync_action md_sync_action (struct mddev *mddev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 228/614 md: avoid repeated calls to del_gendisk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit 90e3bb44c0a86e245d8e5c6520206fa113acb1ee ]
There is a uaf problem which is found by case 23rdev-lifetime:
Oops: general protection fault, probably for non-canonical address 0xdead000000000122 RIP: 0010:bdi_unregister+0x4b/0x170 Call Trace: <TASK> __del_gendisk+0x356/0x3e0 mddev_unlock+0x351/0x360 rdev_attr_store+0x217/0x280 kernfs_fop_write_iter+0x14a/0x210 vfs_write+0x29e/0x550 ksys_write+0x74/0xf0 do_syscall_64+0xbb/0x380 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff5250a177e
The sequence is:
1. rdev remove path gets reconfig_mutex
2. rdev remove path release reconfig_mutex in mddev_unlock
3. md stop calls do_md_stop and sets MD_DELETED
4. rdev remove path calls del_gendisk because MD_DELETED is set
5. md stop path release reconfig_mutex and calls del_gendisk again
So there is a race condition we should resolve. This patch adds a flag MD_DO_DELETE to avoid the race condition.
--- drivers/md/md.c | 3 ++- drivers/md/md.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -941,7 +941,8 @@ void mddev_unlock(struct mddev *mddev)* do_md_stop. dm raid only uses md_stop to stop. So dm raid * doesn't need to check MD_DELETED when getting reconfig lock */ -if (test_bit (MD_DELETED , &mddev->flags)) { +if (test_bit (MD_DELETED , &mddev->flags) && + !test_and_set_bit (MD_DO_DELETE , &mddev->flags)) {kobject_del (&mddev->kobj);del_gendisk (mddev->gendisk); }
drivers/md/md.h +1 -0
@@ -354,6 +354,7 @@ enum mddev_flags {MD_HAS_MULTIPLE_PPLS ,MD_NOT_READY ,MD_BROKEN , +MD_DO_DELETE , MD_DELETED, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 229/614 nbd: defer config put in recv_work
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Qixing <[email protected]>
[ Upstream commit 9517b82d8d422d426a988b213fdd45c6b417b86d ]
There is one uaf issue in recv_work when running NBD_CLEAR_SOCK and NBD_CMD_RECONFIGURE:
nbd_genl_connect // conf_ref=2 (connect and recv_work A)
nbd_open // conf_ref=3
recv_work A done // conf_ref=2
NBD_CLEAR_SOCK // conf_ref=1
nbd_genl_reconfigure // conf_ref=2 (trigger recv_work B)
close nbd // conf_ref=1
recv_work B
config_put // conf_ref=0
atomic_dec(&config->recv_threads); -> UAF
Or only running NBD_CLEAR_SOCK:
nbd_genl_connect // conf_ref=2
nbd_open // conf_ref=3
NBD_CLEAR_SOCK // conf_ref=2
close nbd
nbd_release
config_put // conf_ref=1
recv_work
config_put // conf_ref=0
atomic_dec(&config->recv_threads); -> UAF
Commit 87aac3a80af5 ("nbd: call nbd_config_put() before notifying the waiter") moved nbd_config_put() to run before waking up the waiter in recv_work, in order to ensure that nbd_start_device_ioctl() would not be woken up while nbd->task_recv was still uncleared.
However, in nbd_start_device_ioctl(), after being woken up it explicitly calls flush_workqueue() to make sure all current works are finished. Therefore, there is no need to move the config put ahead of the wakeup.
Move nbd_config_put() to the end of recv_work, so that the reference is held for the whole lifetime of the worker thread. This makes sure the config cannot be freed while recv_work is still running, even if clear
+ reconfigure interleave.
In addition, we don't need to worry about recv_work dropping the last nbd_put (which causes deadlock):
path A (netlink with NBD_CFLAG_DESTROY_ON_DISCONNECT):
connect // nbd_refs=1 (trigger recv_work) open nbd // nbd_refs=2
NBD_CLEAR_SOCK
close nbd
nbd_release
nbd_disconnect_and_put
flush_workqueue // recv_work done
nbd_config_put
nbd_put // nbd_refs=1
nbd_put // nbd_refs=0
queue_workpath B (netlink without NBD_CFLAG_DESTROY_ON_DISCONNECT):
connect // nbd_refs=2 (trigger recv_work) open nbd // nbd_refs=3
NBD_CLEAR_SOCK // conf_refs=2
close nbd
nbd_release
nbd_config_put // conf_refs=1
nbd_put // nbd_refs=2
recv_work done // conf_refs=0, nbd_refs=1 rmmod // nbd_refs=0
Depends-on: e2daec488c57 ("nbd: Fix hungtask when nbd_config_put")
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -1024,9 +1024,9 @@ static void recv_work(struct work_struct *work)nbd_mark_nsock_dead (nbd, nsock,1 );mutex_unlock (&nsock->tx_lock); -nbd_config_put (nbd);atomic_dec (&config->recv_threads);wake_up (&config->recv_wq); +nbd_config_put (nbd);kfree (args); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 230/614 scsi: stex: Fix reboot_notifier leak in probe error path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 20da637eb545b04753e20c675cfe97b04c7b600b ]
In stex_probe(), register_reboot_notifier() is called at the beginning, but if any subsequent initialization step fails, the function returns without unregistering the notifier, resulting in a resource leak.
Add unregister_reboot_notifier() in the out_disable error path to ensure proper cleanup on all failure paths.
--- drivers/scsi/stex.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/stex.c +1 -0
@@ -1844,6 +1844,7 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_scsi_host_put:scsi_host_put (host); out_disable: +unregister_reboot_notifier (&stex_notifier);pci_disable_device (pdev);return err;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 231/614 scsi: smartpqi: Fix device resources accessed after device removal
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike McGowen <[email protected]>
[ Upstream commit b518e86d1a70a88f6592a7c396cf1b93493d1aab ]
Correct possible race conditions during device removal.
Previously, a scheduled work item to reset a LUN could still execute after the device was removed, leading to use-after-free and other resource access issues.
This race condition occurs because the abort handler may schedule a LUN reset concurrently with device removal via sdev_destroy(), leading to use-after-free and improper access to freed resources.
- Check in the device reset handler if the device is still present in the controller's SCSI device list before running; if not, the reset is skipped.
- Cancel any pending TMF work that has not started in sdev_destroy().
- Ensure device freeing in sdev_destroy() is done while holding the LUN reset mutex to avoid races with ongoing resets.
--- drivers/scsi/smartpqi/smartpqi_init.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +19 -0
@@ -6410,10 +6410,22 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_devstatic int pqi_device_reset_handler (struct pqi_ctrl_info *ctrl_info,struct pqi_scsi_dev *device,u8 lun,struct scsi_cmnd *scmd,u8 scsi_opcode) { +unsigned long flags;int rc;mutex_lock (&ctrl_info->lun_reset_mutex); +spin_lock_irqsave (&ctrl_info->scsi_device_list_lock, flags); +if (pqi_find_scsi_dev (ctrl_info, device->bus, device->target, device->lun) ==NULL ) { +dev_warn (&ctrl_info->pci_dev->dev, +"skipping reset of scsi %d:%d:%d:%u, device has been removed\n" , + ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); +spin_unlock_irqrestore (&ctrl_info->scsi_device_list_lock, flags); +mutex_unlock (&ctrl_info->lun_reset_mutex); +return 0 ; + } +spin_unlock_irqrestore (&ctrl_info->scsi_device_list_lock, flags); +dev_err (&ctrl_info->pci_dev->dev,"resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n" , ctrl_info->scsi_host->host_no, device->bus, device->target, lun, scmd, scsi_opcode);
@@ -6594,7 +6606,9 @@ static void pqi_sdev_destroy(struct scsi_device *sdev) {struct pqi_ctrl_info *ctrl_info;struct pqi_scsi_dev *device; +struct pqi_tmf_work *tmf_work;int mutex_acquired; +unsigned int lun;unsigned long flags; ctrl_info =shost_to_hba (sdev->host);
@@ -6621,8 +6635,13 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)mutex_unlock (&ctrl_info->scan_mutex); +for (lun =0 , tmf_work = device->tmf_work; lun <PQI_MAX_LUNS_PER_DEVICE ; lun++, tmf_work++) +cancel_work_sync (&tmf_work->work_struct); + +mutex_lock (&ctrl_info->lun_reset_mutex);pqi_dev_info (ctrl_info,"removed" , device);pqi_free_device (device); +mutex_unlock (&ctrl_info->lun_reset_mutex); }static int pqi_getpciinfo_ioctl (struct pqi_ctrl_info *ctrl_info,void __user *arg)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 232/614 staging: most: remove broken i2c driver
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 495df2da6944477d282d5cc0c13174d06e25b310 ]
The MOST I2C driver has been completely broken for five years without anyone noticing so remove the driver from staging.
Specifically, commit 723de0f9171e ("staging: most: remove device from interface structure") started requiring drivers to set the interface device pointer before registration, but the I2C driver was never updated which results in a NULL pointer dereference if anyone ever tries to probe it.
--- drivers/staging/most/Kconfig | 2 - drivers/staging/most/Makefile | 1 - drivers/staging/most/i2c/Kconfig | 13 -- drivers/staging/most/i2c/Makefile | 4 - drivers/staging/most/i2c/i2c.c | 374 ------------------------------ 5 files changed, 394 deletions(-) delete mode 100644 drivers/staging/most/i2c/Kconfig delete mode 100644 drivers/staging/most/i2c/Makefile delete mode 100644 drivers/staging/most/i2c/i2c.c
drivers/staging/most/Kconfig +0 -2
@@ -24,6 +24,4 @@ source "drivers/staging/most/video/Kconfig" source "drivers/staging/most/dim2/Kconfig" -source "drivers/staging/most/i2c/Kconfig" - endif
drivers/staging/most/Makefile +0 -1
@@ -3,4 +3,3 @@ obj-$(CONFIG_MOST_NET) += net/ obj-$(CONFIG_MOST_VIDEO) += video/ obj-$(CONFIG_MOST_DIM2) += dim2/ -obj-$(CONFIG_MOST_I2C) += i2c/
drivers/staging/most/i2c/Kconfig deleted +0 -13
@@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# MOST I2C configuration -# - -config MOST_I2C - tristate "I2C" - depends on I2C - help - Say Y here if you want to connect via I2C to network transceiver. - - To compile this driver as a module, choose M here: the - module will be called most_i2c.
drivers/staging/most/i2c/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MOST_I2C) += most_i2c.o - -most_i2c-objs := i2c.o
drivers/staging/most/i2c/i2c.c deleted +0 -374
374 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 233/614 iio: imu: bmi270: fix dev_err_probe error msg
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Gobbi <[email protected]>
[ Upstream commit 02f86101e430cce9a99a044b483c4ed5b91bb3b8 ]
The bmi270 can be connected to I2C or a SPI interface. If it is a SPI, during probe, if devm_regmap_init() fails, it should print the "spi" term rather "i2c".
--- drivers/iio/imu/bmi270/bmi270_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/bmi270/bmi270_spi.c +1 -1
@@ -60,7 +60,7 @@ static int bmi270_spi_probe(struct spi_device *spi) &bmi270_spi_regmap_config);if (IS_ERR (regmap))return dev_err_probe (dev,PTR_ERR (regmap), -"Failed to init i2c regmap" ); +"Failed to init spi regmap\n" );return bmi270_core_probe (dev, regmap, chip_info); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 234/614 dt-bindings: PCI: amlogic: Fix the register name of the DBI region
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 4813dea9e272ba0a57c50b8d51d440dd8e3ccdd7 ]
Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must have region for DWC controllers as it has the Root Port and controller specific registers, while ELBI has optional registers.
Hence, fix the binding. Though this is an ABI break, this change is needed to accurately describe the PCI memory map.
--- Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml +3 -3
@@ -36,13 +36,13 @@ properties: reg: items: - - description: External local bus interface registers + - description: Data Bus Interface registers - description: Meson designed configuration registers - description: PCIe configuration space reg-names: items: - - const: elbi + - const: dbi - const: cfg - const: config
@@ -113,7 +113,7 @@ examples: pcie: pcie@f9800000 { compatible = "amlogic,axg-pcie", "snps,dw-pcie"; reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>; - reg-names = "elbi", "cfg", "config"; + reg-names = "dbi", "cfg", "config"; interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>; clocks = <&pclk>, <&clk_port>, <&clk_phy>; clock-names = "pclk", "port", "general";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 235/614 RDMA/rtrs: server: Fix error handling in get_or_create_srv
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
[ Upstream commit a338d6e849ab31f32c08b4fcac11c0c72afbb150 ]
After device_initialize() is called, use put_device() to release the device according to kernel device management rules. While direct kfree() work in this case, using put_device() is more correct.
Found by code review.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -1450,7 +1450,7 @@ static struct rtrs_srv_sess *get_or_create_srv(struct rtrs_srv_ctx *ctx,kfree (srv->chunks); err_free_srv: -kfree (srv); +put_device (&srv->dev);return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 236/614 ARM: dts: stm32: stm32mp157c-phycore: Fix STMPE811 touchscreen node properties
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit e40b061cd379f4897e705d17cf1b4572ad0f3963 ]
Move st,adc-freq, st,mod-12b, st,ref-sel, and st,sample-time properties from the touchscreen subnode to the parent touch@44 node. These properties are defined in the st,stmpe.yaml schema for the parent node, not the touchscreen subnode, resolving the validation error about unevaluated properties.
--- .../boot/dts/st/stm32mp157c-phycore-stm32mp15-som.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/st/stm32mp157c-phycore-stm32mp15-som.dtsi +4 -4
@@ -185,13 +185,13 @@ touch@44 { interrupt-parent = <&gpioi>; vio-supply = <&v3v3>; vcc-supply = <&v3v3>; + st,sample-time = <4>; + st,mod-12b = <1>; + st,ref-sel = <0>; + st,adc-freq = <1>; touchscreen { compatible = "st,stmpe-ts"; - st,sample-time = <4>; - st,mod-12b = <1>; - st,ref-sel = <0>; - st,adc-freq = <1>; st,ave-ctrl = <1>; st,touch-det-delay = <2>; st,settling = <2>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 237/614 coresight: tmc: add the handle of the event to the path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carl Worth <[email protected]>
[ Upstream commit aaa5abcc9d44d2c8484f779ab46d242d774cabcb ]
The handle is essential for retrieving the AUX_EVENT of each CPU and is required in perf mode. It has been added to the coresight_path so that dependent devices can access it from the path when needed.
The existing bug can be reproduced with:
perf record -e cs_etm//k -C 0-9 dd if=/dev/zero of=/dev/null
Showing an oops as follows:
Unable to handle kernel paging request at virtual address 000f6e84934ed19e Call trace: tmc_etr_get_buffer+0x30/0x80 [coresight_tmc] (P) catu_enable_hw+0xbc/0x3d0 [coresight_catu] catu_enable+0x70/0xe0 [coresight_catu] coresight_enable_path+0xb0/0x258 [coresight]
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 3 ++- include/linux/coresight.h | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +1 -0
@@ -520,6 +520,7 @@ static void etm_event_start(struct perf_event *event, int flags) goto out; path =etm_event_cpu_path (event_data, cpu); + path->handle = handle;/* We need a sink, no need to continue without one */ sink =coresight_get_sink (path);if (WARN_ON_ONCE (!sink))
drivers/hwtracing/coresight/coresight-tmc-etr.c +2 -1
@@ -1334,7 +1334,8 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)struct etr_buf *tmc_etr_get_buffer (struct coresight_device *csdev,enum cs_mode mode,void *data) { -struct perf_output_handle *handle = data; +struct coresight_path *path = data; +struct perf_output_handle *handle = path->handle;struct etr_perf_buffer *etr_perf;switch (mode) {
include/linux/coresight.h +6 -4
@@ -332,12 +332,14 @@ static struct coresight_dev_list (var) = { \/** * struct coresight_path - data needed by enable/disable path -* @path_list: path from source to sink. -* @trace_id: trace_id of the whole path. +* @path_list: path from source to sink. +* @trace_id: trace_id of the whole path. +* @handle: handle of the aux_event. */ struct coresight_path { -struct list_head path_list; -u8 trace_id; +struct list_head path_list; +u8 trace_id; +struct perf_output_handle *handle; };enum cs_mode {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 238/614 ntfs3: init run lock for extend inode
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit be99c62ac7e7af514e4b13f83c891a3cccefaa48 ]
After setting the inode mode of $Extend to a regular file, executing the truncate system call will enter the do_truncate() routine, causing the run_lock uninitialized error reported by syzbot.
Prior to patch 4e8011ffec79, if the inode mode of $Extend was not set to a regular file, the do_truncate() routine would not be entered.
Add the run_lock initialization when loading $Extend.
syzbot reported:
INFO: trying to register non-static key.
Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 assign_lock_key+0x133/0x150 kernel/locking/lockdep.c:984 register_lock_class+0x105/0x320 kernel/locking/lockdep.c:1299 __lock_acquire+0x99/0xd20 kernel/locking/lockdep.c:5112 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 ntfs_set_size+0x140/0x200 fs/ntfs3/inode.c:860 ntfs_extend+0x1d9/0x970 fs/ntfs3/file.c:387 ntfs_setattr+0x2e8/0xbe0 fs/ntfs3/file.c:808
--- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/inode.c +1 -0
@@ -472,6 +472,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,/* Records in $Extend are not a files or general directories. */ inode->i_op = &ntfs_file_inode_operations; mode =S_IFREG ; +init_rwsem (&ni->file.run_lock); }else { err = -EINVAL ; goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 239/614 drm/panthor: Fix potential memleak of vma structure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akash Goel <[email protected]>
[ Upstream commit 4492d54d59872bb72e119ff9f77969ab4d8a0e6b ]
This commit addresses a memleak issue of panthor_vma (or drm_gpuva) structure in Panthor driver, that can happen if the GPU page table update operation to map the pages fail.
The issue is very unlikely to occur in practice.
v2: Add panthor_vm_op_ctx_return_vma() helper (Boris)
v3: Add WARN_ON_ONCE (Boris)
--- drivers/gpu/drm/panthor/panthor_mmu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_mmu.c +17 -1
@@ -1146,6 +1146,20 @@ static void panthor_vm_cleanup_op_ctx(struct panthor_vm_op_ctx *op_ctx, } } +static void +panthor_vm_op_ctx_return_vma (struct panthor_vm_op_ctx *op_ctx, +struct panthor_vma *vma) +{ +for (u32 i =0 ; i <ARRAY_SIZE (op_ctx->preallocated_vmas); i++) { +if (!op_ctx->preallocated_vmas[i]) { + op_ctx->preallocated_vmas[i] = vma; +return ; + } + } + +WARN_ON_ONCE (1 ); +} +static struct panthor_vma *panthor_vm_op_ctx_get_vma (struct panthor_vm_op_ctx *op_ctx) {
@@ -2085,8 +2099,10 @@ static int panthor_gpuva_sm_step_map(struct drm_gpuva_op *op, void *priv) ret =panthor_vm_map_pages (vm, op->map.va.addr,flags_to_prot (vma->flags), op_ctx->map.sgt, op->map.gem.offset, op->map.va.range); -if (ret) +if (ret) { +panthor_vm_op_ctx_return_vma (op_ctx, vma);return ret; + }/* Ref owned by the mapping now, clear the obj field so we don't release the * pinning/obj ref behind GPUVA's back.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 240/614 scsi: ufs: core: fix incorrect buffer duplication in ufshcd_read_string_desc()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bean Huo <[email protected]>
[ Upstream commit d794b499f948801f54d67ddbc34a6eac5a6d150a ]
The function ufshcd_read_string_desc() was duplicating memory starting from the beginning of struct uc_string_id, which included the length and type fields. As a result, the allocated buffer contained unwanted metadata in addition to the string itself.
The correct behavior is to duplicate only the Unicode character array in the structure. Update the code so that only the actual string content is copied into the new buffer.
--- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
@@ -3837,7 +3837,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, str[ret++] ='\0' ; }else { - str =kmemdup (uc_str, uc_str->len,GFP_KERNEL ); + str =kmemdup (uc_str->uc, uc_str->len,GFP_KERNEL );if (!str) { ret = -ENOMEM ; goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 241/614 md: delete md_redundancy_group when array is becoming inactive
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit 0ce112d9171ad766d4c6716951e73f91a0bfc184 ]
'md_redundancy_group' are created in md_run() and deleted in del_gendisk(), but these are not paired. Writing inactive/active to sysfs array_state can trigger md_run() multiple times without del_gendisk(), leading to duplicate creation as below:
sysfs: cannot create duplicate filename '/devices/virtual/block/md0/md/sync_action'
Call Trace: dump_stack_lvl+0x9f/0x120 dump_stack+0x14/0x20 sysfs_warn_dup+0x96/0xc0 sysfs_add_file_mode_ns+0x19c/0x1b0 internal_create_group+0x213/0x830 sysfs_create_group+0x17/0x20 md_run+0x856/0xe60 ? __x64_sys_openat+0x23/0x30 do_md_run+0x26/0x1d0 array_state_store+0x559/0x760 md_attr_store+0xc9/0x1e0 sysfs_kf_write+0x6f/0xa0 kernfs_fop_write_iter+0x141/0x2a0 vfs_write+0x1fc/0x5a0 ksys_write+0x79/0x180 __x64_sys_write+0x1d/0x30 x64_sys_call+0x2818/0x2880 do_syscall_64+0xa9/0x580 entry_SYSCALL_64_after_hwframe+0x4b/0x53 md: cannot register extra attributes for md0
Creation of it depends on 'pers', its lifecycle cannot be aligned with gendisk. So fix this issue by triggering 'md_redundancy_group' deletion when the array is becoming inactive.
--- drivers/md/md.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/md.c +4 -0
@@ -6872,6 +6872,10 @@ static int do_md_stop(struct mddev *mddev, int mode)if (!md_is_rdwr (mddev))set_disk_ro (disk,0 ); +if (mode ==2 && mddev->pers->sync_request && + mddev->to_remove ==NULL ) + mddev->to_remove = &md_redundancy_group; +__md_stop_writes (mddev);__md_stop (mddev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 242/614 md: init bioset in mddev_init
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit 381a3ce1c0ffed647c9b913e142b099c7e9d5afc ]
IO operations may be needed before md_run(), such as updating metadata after writing sysfs. Without bioset, this triggers a NULL pointer dereference as below:
BUG: kernel NULL pointer dereference, address: 0000000000000020 Call Trace: md_update_sb+0x658/0xe00 new_level_store+0xc5/0x120 md_attr_store+0xc9/0x1e0 sysfs_kf_write+0x6f/0xa0 kernfs_fop_write_iter+0x141/0x2a0 vfs_write+0x1fc/0x5a0 ksys_write+0x79/0x180 __x64_sys_write+0x1d/0x30 x64_sys_call+0x2818/0x2880 do_syscall_64+0xa9/0x580 entry_SYSCALL_64_after_hwframe+0x4b/0x53
Reproducer
``` mdadm -CR /dev/md0 -l1 -n2 /dev/sd[cd] echo inactive > /sys/block/md0/md/array_state echo 10 > /sys/block/md0/md/new_level ```
mddev_init() can only be called once per mddev, no need to test if bioset has been initialized anymore.
--- drivers/md/md.c | 69 +++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 36 deletions(-)
drivers/md/md.c +33 -36
@@ -730,6 +730,8 @@ static void mddev_clear_bitmap_ops(struct mddev *mddev)int mddev_init (struct mddev *mddev) { +int err =0 ; +if (!IS_ENABLED (CONFIG_MD_BITMAP )) mddev->bitmap_id =ID_BITMAP_NONE ;else
@@ -741,10 +743,23 @@ int mddev_init(struct mddev *mddev)if (percpu_ref_init (&mddev->writes_pending, no_op,PERCPU_REF_ALLOW_REINIT ,GFP_KERNEL )) { -percpu_ref_exit (&mddev->active_io); -return -ENOMEM ; + err = -ENOMEM ; + goto exit_acitve_io; } + err =bioset_init (&mddev->bio_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); +if (err) + goto exit_writes_pending; + + err =bioset_init (&mddev->sync_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); +if (err) + goto exit_bio_set; + + err =bioset_init (&mddev->io_clone_set,BIO_POOL_SIZE , + offsetof(struct md_io_clone , bio_clone),0 ); +if (err) + goto exit_sync_set; +/* We want to start with the refcount at zero */ percpu_ref_put (&mddev->writes_pending);
@@ -773,11 +788,24 @@ int mddev_init(struct mddev *mddev)INIT_WORK (&mddev->del_work, mddev_delayed_delete);return 0 ; + +exit_sync_set: +bioset_exit (&mddev->sync_set); +exit_bio_set: +bioset_exit (&mddev->bio_set); +exit_writes_pending: +percpu_ref_exit (&mddev->writes_pending); +exit_acitve_io: +percpu_ref_exit (&mddev->active_io); +return err; }EXPORT_SYMBOL_GPL (mddev_init);void mddev_destroy (struct mddev *mddev) { +bioset_exit (&mddev->bio_set); +bioset_exit (&mddev->sync_set); +bioset_exit (&mddev->io_clone_set);percpu_ref_exit (&mddev->active_io);percpu_ref_exit (&mddev->writes_pending); }
@@ -6387,29 +6415,9 @@ int md_run(struct mddev *mddev) nowait = nowait &&bdev_nowait (rdev->bdev); } -if (!bioset_initialized (&mddev->bio_set)) { - err =bioset_init (&mddev->bio_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); -if (err) -return err; - } -if (!bioset_initialized (&mddev->sync_set)) { - err =bioset_init (&mddev->sync_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); -if (err) - goto exit_bio_set; - } - -if (!bioset_initialized (&mddev->io_clone_set)) { - err =bioset_init (&mddev->io_clone_set,BIO_POOL_SIZE , - offsetof(struct md_io_clone , bio_clone),0 ); -if (err) - goto exit_sync_set; - } - pers =get_pers (mddev->level, mddev->clevel); -if (!pers) { - err = -EINVAL ; - goto abort; - } +if (!pers) +return -EINVAL ;if (mddev->level != pers->head.id) { mddev->level = pers->head.id; mddev->new_level = pers->head.id;
@@ -6420,8 +6428,7 @@ int md_run(struct mddev *mddev) pers->start_reshape == NULL) {/* This personality cannot handle reshaping... */ put_pers (pers); - err = -EINVAL ; - goto abort; +return -EINVAL ; }if (pers->sync_request) {
@@ -6548,12 +6555,6 @@ int md_run(struct mddev *mddev) mddev->private =NULL ;put_pers (pers);md_bitmap_destroy (mddev); -abort: -bioset_exit (&mddev->io_clone_set); -exit_sync_set: -bioset_exit (&mddev->sync_set); -exit_bio_set: -bioset_exit (&mddev->bio_set);return err; }EXPORT_SYMBOL_GPL (md_run);
@@ -6778,10 +6779,6 @@ static void __md_stop(struct mddev *mddev) mddev->private =NULL ;put_pers (pers);clear_bit (MD_RECOVERY_FROZEN , &mddev->recovery); - -bioset_exit (&mddev->bio_set); -bioset_exit (&mddev->sync_set); -bioset_exit (&mddev->io_clone_set); }void md_stop (struct mddev *mddev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 243/614 cpufreq/amd-pstate: Call cppc_set_auto_sel() only for online CPUs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautham R. Shenoy <[email protected]>
[ Upstream commit bb31fef0d03ed17d587b40e3458786be408fb9df ]
amd_pstate_change_mode_without_dvr_change() calls cppc_set_auto_sel() for all the present CPUs.
However, this callpath eventually calls cppc_set_reg_val() which accesses the per-cpu cpc_desc_ptr object. This object is initialized only for online CPUs via acpi_soft_cpu_online() --> __acpi_processor_start() --> acpi_cppc_processor_probe().
Hence, restrict calling cppc_set_auto_sel() to only the online CPUs.
--- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/amd-pstate.c +1 -1
@@ -1282,7 +1282,7 @@ static int amd_pstate_change_mode_without_dvr_change(int mode)if (cpu_feature_enabled (X86_FEATURE_CPPC ) || cppc_state ==AMD_PSTATE_ACTIVE )return 0 ; -for_each_present_cpu (cpu) { +for_each_online_cpu (cpu) {cppc_set_auto_sel (cpu, (cppc_state ==AMD_PSTATE_PASSIVE ) ?0 :1 ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 244/614 powerpc/kdump: Fix size calculation for hot-removed memory ranges
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit 7afe2383eff05f76f4ce2cfda658b7889c89f101 ]
The elfcorehdr segment in the kdump image stores information about the memory regions (called crash memory ranges) that the kdump kernel must capture.
When a memory hot-remove event occurs, the kernel regenerates the elfcorehdr for the currently loaded kdump image to remove the hot-removed memory from the crash memory ranges.
Call chain:remove_mem_range()update_crash_elfcorehdr()arch_crash_handle_hotplug_event()crash_handle_hotplug_event()
While removing the hot-removed memory from the crash memory ranges in remove_mem_range(), if the removed memory lies within an existing crash range, that range is split into two. During this split, the size of the second range was being calculated incorrectly.
This leads to dump capture failure with makedumpfile with below error:
$ makedumpfile -l -d 31 /proc/vmcore /tmp/vmcore
readpage_elf: Attempt to read non-existent page at 0xbbdab0000.
readmem: type_addr: 0, addr:c000000bbdab7f00, size:16validate_mem_section: Can't read mem_section array.readpage_elf: Attempt to read non-existent page at 0xbbdab0000.
readmem: type_addr: 0, addr:c000000bbdab7f00, size:8get_mm_sparsemem: Can't get the address of mem_section.
The updated crash memory range in PT_LOAD entry is holding incorrect data (checkout FileSiz and MemSiz):
readelf -a /proc/vmcore
<snip...>
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000b013d0000 0xc000000b80000000 0x0000000b80000000
0xffffffffc0000000 0xffffffffc0000000 RWE 0x0
<snip...>
Update the size calculation for the new crash memory range to fix this issue.
Note: This problem will not occur if the kdump kernel is loaded or reloaded after a memory hot-remove operation.
--- arch/powerpc/kexec/ranges.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kexec/ranges.c +1 -1
@@ -697,8 +697,8 @@ int remove_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)* two half. */ else { + size = mem_rngs->ranges[i].end - end +1 ; mem_rngs->ranges[i].end = base -1 ; - size = mem_rngs->ranges[i].end - end; ret =add_mem_range (mem_ranges, end +1 , size); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 245/614 powerpc/32: Fix unpaired stwcx. on interrupt exit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 10e1c77c3636d815db802ceef588522c2d2d947c ]
Commit b96bae3ae2cb ("powerpc/32: Replace ASM exception exit by C exception exit from ppc64") erroneouly copied to powerpc/32 the logic from powerpc/64 based on feature CPU_FTR_STCX_CHECKS_ADDRESS which is always 0 on powerpc/32.
Re-instate the logic implemented by commit b64f87c16f3c ("[POWERPC] Avoid unpaired stwcx. on some processors") which is based on CPU_FTR_NEED_PAIRED_STWCX feature.
--- arch/powerpc/kernel/entry_32.S | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/powerpc/kernel/entry_32.S +4 -6
@@ -263,10 +263,9 @@ interrupt_return: mtspr SPRN_SRR1,r12 BEGIN_FTR_SECTION + lwarx r0,0,r1 +END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) stwcx. r0,0,r1 /* to clear the reservation */ -FTR_SECTION_ELSE - lwarx r0,0,r1 -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) lwz r3,_CCR(r1) lwz r4,_LINK(r1)
@@ -306,10 +305,9 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) mtspr SPRN_SRR1,r12 BEGIN_FTR_SECTION + lwarx r0,0,r1 +END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) stwcx. r0,0,r1 /* to clear the reservation */ -FTR_SECTION_ELSE - lwarx r0,0,r1 -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) lwz r3,_LINK(r1) lwz r4,_CTR(r1)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 246/614 macintosh/mac_hid: fix race condition in mac_hid_toggle_emumouse
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 1e4b207ffe54cf33a4b7a2912c4110f89c73bf3f ]
The following warning appears when running syzkaller, and this issue also exists in the mainline code.
------------[ cut here ]------------ list_add double add: new=ffffffffa57eee28, prev=ffffffffa57eee28, next=ffffffffa5e63100. WARNING: CPU: 0 PID: 1491 at lib/list_debug.c:35 __list_add_valid_or_report+0xf7/0x130 Modules linked in: CPU: 0 PID: 1491 Comm: syz.1.28 Not tainted 6.6.0+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:__list_add_valid_or_report+0xf7/0x130 RSP: 0018:ff1100010dfb7b78 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffffffffa57eee18 RCX: ffffffff97fc9817 RDX: 0000000000040000 RSI: ffa0000002383000 RDI: 0000000000000001 RBP: ffffffffa57eee28 R08: 0000000000000001 R09: ffe21c0021bf6f2c R10: 0000000000000001 R11: 6464615f7473696c R12: ffffffffa5e63100 R13: ffffffffa57eee28 R14: ffffffffa57eee28 R15: ff1100010dfb7d48 FS: 00007fb14398b640(0000) GS:ff11000119600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000010d096005 CR4: 0000000000773ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 80000000 Call Trace: <TASK> input_register_handler+0xb3/0x210 mac_hid_start_emulation+0x1c5/0x290 mac_hid_toggle_emumouse+0x20a/0x240 proc_sys_call_handler+0x4c2/0x6e0 new_sync_write+0x1b1/0x2d0 vfs_write+0x709/0x950 ksys_write+0x12a/0x250 do_syscall_64+0x5a/0x110 entry_SYSCALL_64_after_hwframe+0x78/0xe2
The WARNING occurs when two processes concurrently write to the mac-hid emulation sysctl, causing a race condition in mac_hid_toggle_emumouse(). Both processes read old_val=0, then both try to register the input handler, leading to a double list_add of the same handler.
CPU0 CPU1
------------------------- -------------------------
vfs_write() //write 1 vfs_write() //write 1
proc_sys_write() proc_sys_write()
mac_hid_toggle_emumouse() mac_hid_toggle_emumouse()
old_val = *valp // old_val=0
old_val = *valp // old_val=0
mutex_lock_killable()
proc_dointvec() // *valp=1
mac_hid_start_emulation()
input_register_handler()
mutex_unlock()
mutex_lock_killable()
proc_dointvec()
mac_hid_start_emulation()
input_register_handler() //Trigger Warning
mutex_unlock()Fix this by moving the old_val read inside the mutex lock region.
--- drivers/macintosh/mac_hid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/macintosh/mac_hid.c +2 -1
@@ -187,13 +187,14 @@ static int mac_hid_toggle_emumouse(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = table->data; -int old_val = *valp; +int old_val;int rc; rc =mutex_lock_killable (&mac_hid_emumouse_mutex);if (rc)return rc; + old_val = *valp; rc =proc_dointvec (table, write, buffer, lenp, ppos);if (rc ==0 && write && *valp != old_val) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 247/614 wifi: cw1200: Fix potential memory leak in cw1200_bh_rx_helper()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 5e88e864118c20e63a1571d0ff0a152e5d684959 ]
In one of the error paths, the memory allocated for skb_rx is not freed. Fix that by freeing it before returning.
--- drivers/net/wireless/st/cw1200/bh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/st/cw1200/bh.c +4 -2
@@ -317,10 +317,12 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,if (wsm_id &0x0400 ) {int rc =wsm_release_tx_buffer (priv,1 ); -if (WARN_ON (rc <0 )) +if (WARN_ON (rc <0 )) { +dev_kfree_skb (skb_rx);return rc; -else if (rc >0 ) + }else if (rc >0 ) { *tx =1 ; + } }/* cw1200_wsm_rx takes care on SKB livetime */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 248/614 nbd: defer config unlock in nbd_genl_connect
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Qixing <[email protected]>
[ Upstream commit 1649714b930f9ea6233ce0810ba885999da3b5d4 ]
There is one use-after-free warning when running NBD_CMD_CONNECT and NBD_CLEAR_SOCK:
nbd_genl_connect
nbd_alloc_and_init_config // config_refs=1
nbd_start_device // config_refs=2
set NBD_RT_HAS_CONFIG_REF open nbd // config_refs=3
recv_work done // config_refs=2
NBD_CLEAR_SOCK // config_refs=1 close nbd // config_refs=0
refcount_inc -> uaf
------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 24 PID: 1014 at lib/refcount.c:25 refcount_warn_saturate+0x12e/0x290 nbd_genl_connect+0x16d0/0x1ab0 genl_family_rcv_msg_doit+0x1f3/0x310 genl_rcv_msg+0x44a/0x790
The issue can be easily reproduced by adding a small delay before refcount_inc(&nbd->config_refs) in nbd_genl_connect():
mutex_unlock(&nbd->config_lock);
if (!ret) {
set_bit(NBD_RT_HAS_CONFIG_REF, &config->runtime_flags);
+ printk("before sleep\n");
+ mdelay(5 * 1000);
+ printk("after sleep\n");
refcount_inc(&nbd->config_refs);
nbd_connect_reply(info, nbd->index);
}--- drivers/block/nbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/nbd.c +2 -1
@@ -2241,12 +2241,13 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info) ret =nbd_start_device (nbd); out: -mutex_unlock (&nbd->config_lock);if (!ret) {set_bit (NBD_RT_HAS_CONFIG_REF , &config->runtime_flags);refcount_inc (&nbd->config_refs);nbd_connect_reply (info, nbd->index); } +mutex_unlock (&nbd->config_lock); +nbd_config_put (nbd);if (put_dev)nbd_put (nbd);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 249/614 net: export netdev_get_by_index_lock()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Wei <[email protected]>
[ Upstream commit c07a491c1b735e0c27454ea5c27a446d43401b1e ]
Need to call netdev_get_by_index_lock() from io_uring/zcrx.c, but it is currently private to net. Export the function in linux/netdevice.h.
Stable-dep-of: b6c5f9454ef3 ("io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock")
--- include/linux/netdevice.h | 1 + net/core/dev.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
include/linux/netdevice.h +1 -0
@@ -3401,6 +3401,7 @@ struct net_device *dev_get_by_index(struct net *net, int ifindex);struct net_device *__dev_get_by_index (struct net *net,int ifindex);struct net_device *netdev_get_by_index (struct net *net,int ifindex,netdevice_tracker *tracker,gfp_t gfp); +struct net_device *netdev_get_by_index_lock (struct net *net,int ifindex);struct net_device *netdev_get_by_name (struct net *net,const char *name,netdevice_tracker *tracker,gfp_t gfp); struct net_device *netdev_get_by_flags_rcu(struct net *net, netdevice_tracker *tracker,
net/core/dev.h +0 -1
@@ -29,7 +29,6 @@ struct napi_struct * netdev_napi_by_id_lock(struct net *net, unsigned int napi_id);struct net_device *dev_get_by_napi_id (unsigned int napi_id); -struct net_device *netdev_get_by_index_lock (struct net *net,int ifindex);struct net_device *__netdev_put_lock (struct net_device *dev,struct net *net);struct net_device * netdev_xa_find_lock(struct net *net, struct net_device *dev,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 250/614 io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Wei <[email protected]>
[ Upstream commit b6c5f9454ef34fd2753ba7843ef4d9a295c43eee ]
netdev ops must be called under instance lock or rtnl_lock, but io_register_zcrx_ifq() isn't doing this for netdev_queue_get_dma_dev(). Fix this by taking the instance lock using netdev_get_by_index_lock().
Extended the instance lock section to include attaching a memory provider. Could not move io_zcrx_create_area() outside, since the dmabuf codepath IORING_ZCRX_AREA_DMABUF requires ifq->dev.
--- io_uring/zcrx.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
io_uring/zcrx.c +10 -6
@@ -599,29 +599,30 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,if (ret) goto err; - ifq->netdev =netdev_get_by_index (current->nsproxy->net_ns, reg.if_idx, - &ifq->netdev_tracker,GFP_KERNEL ); + ifq->netdev =netdev_get_by_index_lock (current->nsproxy->net_ns, reg.if_idx);if (!ifq->netdev) { ret = -ENODEV ; goto err; } +netdev_hold (ifq->netdev, &ifq->netdev_tracker,GFP_KERNEL ); ifq->dev =netdev_queue_get_dma_dev (ifq->netdev, reg.if_rxq);if (!ifq->dev) { ret = -EOPNOTSUPP ; - goto err; + goto netdev_put_unlock; }get_device (ifq->dev); ret =io_zcrx_create_area (ifq, &area);if (ret) - goto err; + goto netdev_put_unlock; mp_param.mp_ops = &io_uring_pp_zc_ops; mp_param.mp_priv = ifq; - ret =net_mp_open_rxq (ifq->netdev, reg.if_rxq, &mp_param); + ret =__net_mp_open_rxq (ifq->netdev, reg.if_rxq, &mp_param,NULL );if (ret) - goto err; + goto netdev_put_unlock; +netdev_unlock (ifq->netdev); ifq->if_rxq = reg.if_rxq; reg.zcrx_id = id;
@@ -640,6 +641,9 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx, goto err; }return 0 ; +netdev_put_unlock: +netdev_put (ifq->netdev, &ifq->netdev_tracker); +netdev_unlock (ifq->netdev); err: scoped_guard(mutex, &ctx->mmap_lock)xa_erase (&ctx->zcrx_ctxs, id);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 251/614 fs/ntfs3: Initialize allocated memory before use
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartlomiej Kubik <[email protected]>
[ Upstream commit a8a3ca23bbd9d849308a7921a049330dc6c91398 ]
KMSAN reports: Multiple uninitialized values detected:
- KMSAN: uninit-value in ntfs_read_hdr (3)
- KMSAN: uninit-value in bcmp (3)
Memory is allocated by __getname(), which is a wrapper for kmem_cache_alloc(). This memory is used before being properly cleared. Change kmem_cache_alloc() to kmem_cache_zalloc() to properly allocate and clear memory before use.
--- fs/ntfs3/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/ntfs3/inode.c +3 -4
@@ -1279,7 +1279,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, fa |=FILE_ATTRIBUTE_READONLY ;/* Allocate PATH_MAX bytes. */ - new_de =__getname (); + new_de =kmem_cache_zalloc (names_cachep,GFP_KERNEL );if (!new_de) { err = -ENOMEM ; goto out1;
@@ -1720,10 +1720,9 @@ int ntfs_link_inode(struct inode *inode, struct dentry *dentry)struct NTFS_DE *de;/* Allocate PATH_MAX bytes. */ - de =__getname (); + de =kmem_cache_zalloc (names_cachep,GFP_KERNEL );if (!de)return -ENOMEM ; -memset (de,0 ,PATH_MAX );/* Mark rw ntfs as dirty. It will be cleared at umount. */ ntfs_set_state (sbi,NTFS_DIRTY_DIRTY );
@@ -1759,7 +1758,7 @@ int ntfs_unlink_inode(struct inode *dir, const struct dentry *dentry)return -EINVAL ;/* Allocate PATH_MAX bytes. */ - de =__getname (); + de =kmem_cache_zalloc (names_cachep,GFP_KERNEL );if (!de)return -ENOMEM ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 252/614 coresight: Change device mode to atomic type
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 693d1eaca940f277af24c74873ef2313816ff444 ]
The device mode is defined as local type. This type cannot promise SMP-safe access.
Change to atomic type and impose relax ordering, which ensures the SMP-safe synchronisation and the ordering between the mode setting and relevant operations.
--- include/linux/coresight.h | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
include/linux/coresight.h +11 -14
@@ -251,15 +251,11 @@ struct coresight_trace_id_map {* by @coresight_ops. * @access: Device i/o access abstraction for this device. * @dev: The device entity associated to this component. -* @mode: This tracer's mode, i.e sysFS, Perf or disabled. This is -* actually an 'enum cs_mode', but is stored in an atomic type. -* This is always accessed through local_read() and local_set(), -* but wherever it's done from within the Coresight device's lock, -* a non-atomic read would also work. This is the main point of -* synchronisation between code happening inside the sysfs mode's -* coresight_mutex and outside when running in Perf mode. A compare -* and exchange swap is done to atomically claim one mode or the -* other. +* @mode: The device mode, i.e sysFS, Perf or disabled. This is actually +* an 'enum cs_mode' but stored in an atomic type. Access is always +* through atomic APIs, ensuring SMP-safe synchronisation between +* racing from sysFS and Perf mode. A compare-and-exchange +* operation is done to atomically claim one mode or the other. * @refcnt: keep track of what is in use. Only access this outside of the * device's spinlock when the coresight_mutex held and mode == * CS_MODE_SYSFS. Otherwise it must be accessed from inside the
@@ -288,7 +284,7 @@ struct coresight_device {const struct coresight_ops *ops;struct csdev_access access;struct device dev; -local_t mode; +atomic_t mode;int refcnt;bool orphan;/* sink specific fields */
@@ -623,13 +619,14 @@ static inline bool coresight_is_percpu_sink(struct coresight_device *csdev)static inline bool coresight_take_mode (struct coresight_device *csdev,enum cs_mode new_mode) { -return local_cmpxchg (&csdev->mode,CS_MODE_DISABLED , new_mode) == -CS_MODE_DISABLED ; +int curr =CS_MODE_DISABLED ; + +return atomic_try_cmpxchg_acquire (&csdev->mode, &curr, new_mode); }static inline enum cs_mode coresight_get_mode (struct coresight_device *csdev) { -return local_read (&csdev->mode); +return atomic_read_acquire (&csdev->mode); } static inline void coresight_set_mode(struct coresight_device *csdev,
@@ -645,7 +642,7 @@ static inline void coresight_set_mode(struct coresight_device *csdev,WARN (new_mode !=CS_MODE_DISABLED && current_mode !=CS_MODE_DISABLED && current_mode != new_mode,"Device already in use\n" ); -local_set (&csdev->mode, new_mode); +atomic_set_release (&csdev->mode, new_mode); }struct coresight_device *coresight_register (struct coresight_desc *desc);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 253/614 coresight: etm4x: Always set tracers device mode on target CPU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 28eee2158575aea8fee7807adb9248ceaf9196f1 ]
When enabling a tracer via SysFS interface, the device mode may be set by any CPU - not necessarily the target CPU. This can lead to race condition in SMP, and may result in incorrect mode values being read.
Consider the following example, where CPU0 attempts to enable the tracer on CPU1 (the target CPU):
CPU0 CPU1
etm4_enable()
` coresight_take_mode(SYSFS)
` etm4_enable_sysfs()
` smp_call_function_single() ----> etm4_enable_hw_smp_call()
/
/ CPU idle:
/ etm4_cpu_save()
/ ` coresight_get_mode()
Failed to enable h/w / ^^^
` coresight_set_mode(DISABLED) <-' Read the intermediate SYSFS mode
In this case, CPU0 initiates the operation by taking the SYSFS mode to avoid conflicts with the Perf mode. It then sends an IPI to CPU1 to configure the tracer registers. If any error occurs during this process, CPU0 rolls back by setting the mode to DISABLED.
However, if CPU1 enters an idle state during this time, it might read the intermediate SYSFS mode. As a result, the CPU PM flow could wrongly save and restore tracer context that is actually disabled.
To resolve the issue, this commit moves the device mode setting logic on the target CPU. This ensures that the device mode is only modified by the target CPU, eliminating race condition between mode writes and reads across CPUs.
An additional change introduces the etm4_disable_sysfs_smp_call() function for SMP calls, which disables the tracer and explicitly set the mode to DISABLED during SysFS operations. Rename etm4_disable_hw_smp_call() to etm4_disable_sysfs_smp_call() for naming consistency.
The flow is updated with this change:
CPU0 CPU1
etm4_enable()
` etm4_enable_sysfs()
` smp_call_function_single() ----> etm4_enable_hw_smp_call()
` coresight_take_mode(SYSFS)
Failed, set back to DISABLED
` coresight_set_mode(DISABLED)
CPU idle:
etm4_cpu_save()
` coresight_get_mode()
^^^
Read out the DISABLED mode--- .../coresight/coresight-etm4x-core.c | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +38 -22
@@ -589,13 +589,26 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)return rc; } -static void etm4_enable_hw_smp_call (void *info) +static void etm4_enable_sysfs_smp_call (void *info) {struct etm4_enable_arg *arg = info; +struct coresight_device *csdev;if (WARN_ON (!arg))return ; + + csdev = arg->drvdata->csdev; +if (!coresight_take_mode (csdev,CS_MODE_SYSFS )) { +/* Someone is already using the tracer */ + arg->rc = -EBUSY ; +return ; + } + arg->rc =etm4_enable_hw (arg->drvdata); + +/* The tracer didn't start */ +if (arg->rc) +coresight_set_mode (csdev,CS_MODE_DISABLED ); }/*
@@ -808,13 +821,14 @@ static int etm4_enable_perf(struct coresight_device *csdev,struct perf_event *event, struct coresight_path *path) { - int ret = 0; struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); +int ret; -if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ())) { - ret = -EINVAL ; - goto out; - } +if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ())) +return -EINVAL ; + +if (!coresight_take_mode (csdev,CS_MODE_PERF )) +return -EBUSY ;/* Configure the tracer based on the session's specifics */ ret =etm4_parse_event_config (csdev, event);
@@ -830,6 +844,9 @@ static int etm4_enable_perf(struct coresight_device *csdev, ret =etm4_enable_hw (drvdata); out: +/* Failed to start tracer; roll back to DISABLED mode */ +if (ret) +coresight_set_mode (csdev,CS_MODE_DISABLED );return ret; }
@@ -861,7 +878,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa*/ arg.drvdata = drvdata; ret =smp_call_function_single (drvdata->cpu, - etm4_enable_hw_smp_call, &arg,1 ); + etm4_enable_sysfs_smp_call, &arg,1 );if (!ret) ret = arg.rc;if (!ret)
@@ -882,11 +899,6 @@ static int etm4_enable(struct coresight_device *csdev, struct perf_event *event, {int ret; -if (!coresight_take_mode (csdev, mode)) { -/* Someone is already using the tracer */ -return -EBUSY ; - } -switch (mode) {case CS_MODE_SYSFS : ret =etm4_enable_sysfs (csdev, path);
@@ -898,10 +910,6 @@ static int etm4_enable(struct coresight_device *csdev, struct perf_event *event, ret = -EINVAL ; } -/* The tracer didn't start */ -if (ret) -coresight_set_mode (csdev,CS_MODE_DISABLED ); -return ret; }
@@ -953,10 +961,9 @@ static void etm4_disable_trace_unit(struct etmv4_drvdata *drvdata)isb (); } -static void etm4_disable_hw (void *info) +static void etm4_disable_hw (struct etmv4_drvdata *drvdata) {u32 control; -struct etmv4_drvdata *drvdata = info;struct etmv4_config *config = &drvdata->config;struct coresight_device *csdev = drvdata->csdev;struct csdev_access *csa = &csdev->access;
@@ -993,6 +1000,15 @@ static void etm4_disable_hw(void *info) "cpu: %d disable smp call done\n", drvdata->cpu); } +static void etm4_disable_sysfs_smp_call (void *info) +{ +struct etmv4_drvdata *drvdata = info; + +etm4_disable_hw (drvdata); + +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +} +static int etm4_disable_perf (struct coresight_device *csdev,struct perf_event *event) {
@@ -1022,6 +1038,8 @@ static int etm4_disable_perf(struct coresight_device *csdev,/* TRCVICTLR::SSSTATUS, bit[9] */ filters->ssstatus = (control &BIT (9 )); +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +/* * perf will release trace ids when _free_aux() is * called at the end of the session.
@@ -1047,7 +1065,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev)* Executing etm4_disable_hw on the cpu whose ETM is being disabled * ensures that register writes occur when cpu is powered. */ -smp_call_function_single (drvdata->cpu, etm4_disable_hw, drvdata,1 ); +smp_call_function_single (drvdata->cpu, etm4_disable_sysfs_smp_call, + drvdata,1 );raw_spin_unlock (&drvdata->spinlock);
@@ -1087,9 +1106,6 @@ static void etm4_disable(struct coresight_device *csdev,etm4_disable_perf (csdev, event);break ; } - -if (mode) -coresight_set_mode (csdev,CS_MODE_DISABLED ); }static int etm4_resume_perf (struct coresight_device *csdev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 254/614 coresight: etm3x: Always set tracers device mode on target CPU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit ab3fde32afe6a77e5cc60f868e44e6e09424752b ]
The ETMv3 driver shares the same issue as ETMv4 regarding race conditions when accessing the device mode.
This commit applies the same fix: ensuring that the device mode is modified only by the target CPU to eliminate race conditions across CPUs.
--- .../coresight/coresight-etm3x-core.c | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-)
drivers/hwtracing/coresight/coresight-etm3x-core.c +40 -19
@@ -439,13 +439,26 @@ struct etm_enable_arg {int rc; }; -static void etm_enable_hw_smp_call (void *info) +static void etm_enable_sysfs_smp_call (void *info) {struct etm_enable_arg *arg = info; +struct coresight_device *csdev;if (WARN_ON (!arg))return ; + + csdev = arg->drvdata->csdev; +if (!coresight_take_mode (csdev,CS_MODE_SYSFS )) { +/* Someone is already using the tracer */ + arg->rc = -EBUSY ; +return ; + } + arg->rc =etm_enable_hw (arg->drvdata); + +/* The tracer didn't start */ +if (arg->rc) +coresight_set_mode (csdev,CS_MODE_DISABLED ); }static int etm_cpu_id (struct coresight_device *csdev)
@@ -465,16 +478,26 @@ static int etm_enable_perf(struct coresight_device *csdev, struct coresight_path *path) {struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); +int ret;if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ()))return -EINVAL ; +if (!coresight_take_mode (csdev,CS_MODE_PERF )) +return -EBUSY ; +/* Configure the tracer based on the session's specifics */ etm_parse_event_config (drvdata, event); drvdata->traceid = path->trace_id;/* And enable it */ -return etm_enable_hw (drvdata); + ret =etm_enable_hw (drvdata); + +/* Failed to start tracer; roll back to DISABLED mode */ +if (ret) +coresight_set_mode (csdev,CS_MODE_DISABLED ); + +return ret; }static int etm_enable_sysfs (struct coresight_device *csdev,struct coresight_path *path)
@@ -494,7 +517,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev, struct coresight_patif (cpu_online (drvdata->cpu)) { arg.drvdata = drvdata; ret =smp_call_function_single (drvdata->cpu, - etm_enable_hw_smp_call, &arg,1 ); + etm_enable_sysfs_smp_call, &arg,1 );if (!ret) ret = arg.rc;if (!ret)
@@ -517,12 +540,6 @@ static int etm_enable(struct coresight_device *csdev, struct perf_event *event, enum cs_mode mode, struct coresight_path *path) { int ret; -struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); - -if (!coresight_take_mode (csdev, mode)) { -/* Someone is already using the tracer */ -return -EBUSY ; - }switch (mode) {case CS_MODE_SYSFS :
@@ -535,17 +552,12 @@ static int etm_enable(struct coresight_device *csdev, struct perf_event *event, ret = -EINVAL ; } -/* The tracer didn't start */ -if (ret) -coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); -return ret; } -static void etm_disable_hw (void *info) +static void etm_disable_hw (struct etm_drvdata *drvdata) {int i; -struct etm_drvdata *drvdata = info;struct etm_config *config = &drvdata->config;struct coresight_device *csdev = drvdata->csdev;
@@ -567,6 +579,15 @@ static void etm_disable_hw(void *info) "cpu: %d disable smp call done\n", drvdata->cpu); } +static void etm_disable_sysfs_smp_call (void *info) +{ +struct etm_drvdata *drvdata = info; + +etm_disable_hw (drvdata); + +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +} +static void etm_disable_perf (struct coresight_device *csdev) {struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent);
@@ -588,6 +609,8 @@ static void etm_disable_perf(struct coresight_device *csdev)CS_LOCK (drvdata->csa.base); +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +/* * perf will release trace ids when _free_aux() * is called at the end of the session
@@ -612,7 +635,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev)* Executing etm_disable_hw on the cpu whose ETM is being disabled * ensures that register writes occur when cpu is powered. */ -smp_call_function_single (drvdata->cpu, etm_disable_hw, drvdata,1 ); +smp_call_function_single (drvdata->cpu, etm_disable_sysfs_smp_call, + drvdata,1 );spin_unlock (&drvdata->spinlock);cpus_read_unlock ();
@@ -652,9 +676,6 @@ static void etm_disable(struct coresight_device *csdev,WARN_ON_ONCE (mode);return ; } - -if (mode) -coresight_set_mode (csdev,CS_MODE_DISABLED ); }static const struct coresight_ops_source etm_source_ops = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 255/614 coresight: etm4x: Correct polling IDLE bit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 4dc4e22f9536341255f5de6047977a80ff47eaef ]
Since commit 4ff6039ffb79 ("coresight-etm4x: add isb() before reading the TRCSTATR"), the code has incorrectly been polling the PMSTABLE bit instead of the IDLE bit.
This commit corrects the typo.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +1 -1
@@ -1924,7 +1924,7 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcpdcr =etm4x_read32 (csa,TRCPDCR );/* wait for TRCSTATR.IDLE to go up */ -if (etm4x_wait_status (csa,TRCSTATR_PMSTABLE_BIT ,1 )) { +if (etm4x_wait_status (csa,TRCSTATR_IDLE_BIT ,1 )) {dev_err (etm_dev,"timeout while waiting for Idle Trace Status\n" );etm4_os_unlock (drvdata);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 256/614 coresight: etm4x: Add context synchronization before enabling trace
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 64eb04ae545294e105ad91714dc3167a0b660731 ]
According to the software usage PKLXF in Arm ARM (ARM DDI 0487 L.a), a Context synchronization event is required before enabling the trace unit.
An ISB is added to meet this requirement, particularly for guarding the operations in the flow:
etm4x_allow_trace()
`> kvm_tracing_set_el1_configuration()
`> write_sysreg_s(trfcr_while_in_guest, SYS_TRFCR_EL12)
Improved the barrier comments to provide more accurate information.
--- .../coresight/coresight-etm4x-core.c | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +23 -4
@@ -446,10 +446,24 @@ static int etm4_enable_trace_unit(struct etmv4_drvdata *drvdata)etm4x_relaxed_write32 (csa,TRCRSR_TA ,TRCRSR );etm4x_allow_trace (drvdata); + +/* +* According to software usage PKLXF in Arm ARM (ARM DDI 0487 L.a), +* execute a Context synchronization event to guarantee the trace unit +* will observe the new values of the System registers. +*/ +if (!csa->io_mem) +isb (); +/* Enable the trace unit */ etm4x_relaxed_write32 (csa,1 ,TRCPRGCTLR ); -/* Synchronize the register updates for sysreg access */ +/* +* As recommended by section 4.3.7 ("Synchronization when using system +* instructions to progrom the trace unit") of ARM IHI 0064H.b, the +* self-hosted trace analyzer must perform a Context synchronization +* event between writing to the TRCPRGCTLR and reading the TRCSTATR. +*/ if (!csa->io_mem)isb ();
@@ -931,11 +945,16 @@ static void etm4_disable_trace_unit(struct etmv4_drvdata *drvdata)*/ etm4x_prohibit_trace (drvdata);/* -* Make sure everything completes before disabling, as recommended -* by section 7.3.77 ("TRCVICTLR, ViewInst Main Control Register, -* SSTATUS") of ARM IHI 0064D +* Prevent being speculative at the point of disabling the trace unit, +* as recommended by section 7.3.77 ("TRCVICTLR, ViewInst Main Control +* Register, SSTATUS") of ARM IHI 0064D */ dsb (sy); +/* +* According to software usage VKHHY in Arm ARM (ARM DDI 0487 L.a), +* execute a Context synchronization event to guarantee no new +* program-flow trace is generated. +*/ isb ();/* Trace synchronization barrier, is a nop if not supported */ tsb_csync ();
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 257/614 coresight: etm4x: Properly control filter in CPU idle with FEAT_TRF
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 1fdc2cd347a7bc58acacb6144404ee892cea6c2e ]
If a CPU supports FEAT_TRF, as described in the section K5.5 "Context switching", Arm ARM (ARM DDI 0487 L.a), it defines a flow to prohibit program-flow trace, execute a TSB CSYNC instruction for flushing, followed by clearing TRCPRGCTLR.EN bit.
To restore the state, the reverse sequence is required.
This differs from the procedure described in the section 3.4.1 "The procedure when powering down the PE" of ARM IHI0064H.b, which involves the OS Lock to prevent external debugger accesses and implicitly disables trace.
To be compatible with different ETM versions, explicitly control trace unit using etm4_disable_trace_unit() and etm4_enable_trace_unit() during CPU idle to comply with FEAT_TRF.
As a result, the save states for TRFCR_ELx and trcprgctlr are redundant, remove them.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 14 +++++++------- drivers/hwtracing/coresight/coresight-etm4x.h | 3 --- 2 files changed, 7 insertions(+), 10 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +7 -7
@@ -1858,9 +1858,11 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) goto out; } +if (!drvdata->paused) +etm4_disable_trace_unit (drvdata); + state = drvdata->save_state; - state->trcprgctlr =etm4x_read32 (csa,TRCPRGCTLR );if (drvdata->nr_pe) state->trcprocselr =etm4x_read32 (csa,TRCPROCSELR ); state->trcconfigr =etm4x_read32 (csa,TRCCONFIGR );
@@ -1970,9 +1972,6 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) {int ret =0 ; -/* Save the TRFCR irrespective of whether the ETM is ON */ -if (drvdata->trfcr) - drvdata->save_trfcr =read_trfcr ();/* * Save and restore the ETM Trace registers only if * the ETM is active.
@@ -1994,7 +1993,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)etm4_cs_unlock (drvdata, csa);etm4x_relaxed_write32 (csa, state->trcclaimset,TRCCLAIMSET ); -etm4x_relaxed_write32 (csa, state->trcprgctlr,TRCPRGCTLR );if (drvdata->nr_pe)etm4x_relaxed_write32 (csa, state->trcprocselr,TRCPROCSELR );etm4x_relaxed_write32 (csa, state->trcconfigr,TRCCONFIGR );
@@ -2079,13 +2077,15 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)/* Unlock the OS lock to re-enable trace and external debug access */ etm4_os_unlock (drvdata); + +if (!drvdata->paused) +etm4_enable_trace_unit (drvdata); +etm4_cs_lock (drvdata, csa); }static void etm4_cpu_restore (struct etmv4_drvdata *drvdata) { -if (drvdata->trfcr) -write_trfcr (drvdata->save_trfcr);if (drvdata->state_needs_restore)__etm4_cpu_restore (drvdata); }
drivers/hwtracing/coresight/coresight-etm4x.h +0 -3
@@ -866,7 +866,6 @@ struct etmv4_config {* struct etm4_save_state - state to be preserved when ETM is without power */ struct etmv4_save_state { -u32 trcprgctlr;u32 trcprocselr;u32 trcconfigr;u32 trcauxctlr;
@@ -980,7 +979,6 @@ struct etmv4_save_state {* at runtime, due to the additional setting of TRFCR_CX when * in EL2. Otherwise, 0. * @config: structure holding configuration parameters. -* @save_trfcr: Saved TRFCR_EL1 register during a CPU PM event. * @save_state: State to be preserved across power loss * @state_needs_restore: True when there is context to restore after PM exit * @skip_power_up: Indicates if an implementation can skip powering up
@@ -1037,7 +1035,6 @@ struct etmv4_drvdata {bool lpoverride;u64 trfcr;struct etmv4_config config; -u64 save_trfcr;struct etmv4_save_state *save_state;bool state_needs_restore;bool skip_power_up;
Signature · 1 line
2.51.0