5.9.2-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 586/757 ARM: s3c24xx: fix mmc gpio lookup tables
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 3af4e8774b6d03683932b0961998e01355bccd74 ]
The gpio controller names differ between s3c24xx and s3c64xx, and it seems that these all got the wrong names, using GPx instead of GPIOx.
--- arch/arm/mach-s3c24xx/mach-at2440evb.c | 2 +- arch/arm/mach-s3c24xx/mach-h1940.c | 4 ++-- arch/arm/mach-s3c24xx/mach-mini2440.c | 4 ++-- arch/arm/mach-s3c24xx/mach-n30.c | 4 ++-- arch/arm/mach-s3c24xx/mach-rx1950.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-s3c24xx/mach-at2440evb.c +1 -1
@@ -143,7 +143,7 @@ static struct gpiod_lookup_table at2440evb_mci_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPG(10) */ - GPIO_LOOKUP("GPG", 10, "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOG", 10, "cd", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-h1940.c +2 -2
@@ -468,9 +468,9 @@ static struct gpiod_lookup_table h1940_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(5) */ -GPIO_LOOKUP ("GPF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-mini2440.c +2 -2
@@ -244,9 +244,9 @@ static struct gpiod_lookup_table mini2440_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPG(8) */ -GPIO_LOOKUP ("GPG" ,8 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOG" ,8 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH), { }, }, };
arch/arm/mach-s3c24xx/mach-n30.c +2 -2
@@ -389,9 +389,9 @@ static struct gpiod_lookup_table n30_mci_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(1) */ -GPIO_LOOKUP ("GPF" ,1 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,1 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPG(10) */ - GPIO_LOOKUP("GPG", 10, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-rx1950.c +2 -2
@@ -571,9 +571,9 @@ static struct gpiod_lookup_table rx1950_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(5) */ -GPIO_LOOKUP ("GPF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW), { }, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 587/757 memory: brcmstb_dpfe: fix array index out of bounds
In reply to Greg Kroah-HartmanFrom: Markus Mayer <[email protected]>
[ Upstream commit f42ae4bbf94c15aa720afb9d176ecbfe140d792e ]
We would overrun the error_text array if we hit a TIMEOUT condition, because we were using the error code "ETIMEDOUT" (which is 110) as an array index.
We fix the problem by correcting the array index and by providing a function to retrieve error messages rather than accessing the array directly. The function includes a bounds check that prevents the array from being overrun.
--- drivers/memory/brcmstb_dpfe.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/memory/brcmstb_dpfe.c +16 -7
@@ -188,11 +188,6 @@ struct brcmstb_dpfe_priv {struct mutex lock; }; -static const char *const error_text[] = { -"Success" ,"Header code incorrect" ,"Unknown command or argument" , -"Incorrect checksum" ,"Malformed command" ,"Timed out" , -}; -/* * Forward declaration of our sysfs attribute functions, so we can declare the * attribute data structures early.
@@ -307,6 +302,20 @@ static const struct dpfe_api dpfe_api_v3 = { }, }; +static const char *get_error_text (unsigned int i) +{ +static const char *const error_text[] = { +"Success" ,"Header code incorrect" , +"Unknown command or argument" ,"Incorrect checksum" , +"Malformed command" ,"Timed out" ,"Unknown error" , + }; + +if (unlikely (i >=ARRAY_SIZE (error_text))) + i =ARRAY_SIZE (error_text) -1 ; + +return error_text[i]; +} +static bool is_dcpu_enabled (struct brcmstb_dpfe_priv *priv) {u32 val;
@@ -445,7 +454,7 @@ static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd, }if (resp !=0 ) {mutex_unlock (&priv->lock); -return -ETIMEDOUT ; +return -ffs (DCPU_RET_ERR_TIMEDOUT ); }/* Compute checksum over the message */
@@ -691,7 +700,7 @@ static ssize_t generic_show(unsigned int command, u32 response[], ret =__send_command (priv, command, response);if (ret <0 ) -return sprintf (buf,"ERROR: %s\n" , error_text[-ret]); +return sprintf (buf,"ERROR: %s\n" ,get_error_text (-ret));return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 588/757 ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix dcdc1 regulator
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 3658a2b7f3e16c7053eb8d70657b94bb62c5a0f4 ]
DCDC1 regulator powers many different subsystems. While some of them can work at 3.0 V, some of them can not. For example, VCC-HDMI can only work between 3.24 V and 3.36 V. According to OS images provided by the board manufacturer this regulator should be set to 3.3 V.
Set DCDC1 and DCDC1SW to 3.3 V in order to fix this.
--- arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +5 -5
@@ -223,16 +223,16 @@ ®_aldo3 { }; ®_dc1sw { - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-name = "vcc-gmac-phy"; }; ®_dcdc1 { regulator-always-on; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-name = "vcc-3v0"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-3v3"; }; ®_dcdc2 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 589/757 arm64: dts: allwinner: h5: remove Mali GPU PMU module
In reply to Greg Kroah-HartmanFrom: Qiang Yu <[email protected]>
[ Upstream commit 2933bf3528007f834fb7f5eab033f9c5b0683f91 ]
H5's Mali GPU PMU is not present or working corretly although H5 datasheet record its interrupt vector.
Adding this module will miss lead lima driver try to shutdown it and get waiting timeout. This problem is not exposed before lima runtime PM support is added.
--- arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +2 -4
@@ -139,8 +139,7 @@ mali: gpu@1e80000 { <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "gp", "gpmmu", "pp",
@@ -151,8 +150,7 @@ mali: gpu@1e80000 { "pp2", "ppmmu2", "pp3", - "ppmmu3", - "pmu"; + "ppmmu3"; clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>; clock-names = "bus", "core"; resets = <&ccu RST_BUS_GPU>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 590/757 memory: omap-gpmc: Fix a couple off by ones
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4c54228ac8fd55044195825873c50a524131fa53 ]
These comparisons should be >= instead of > to prevent reading one element beyond the end of the gpmc_cs[] array.
--- drivers/memory/omap-gpmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +2 -2
@@ -943,7 +943,7 @@ static int gpmc_cs_remap(int cs, u32 base)int ret;u32 old_base, size; -if (cs > gpmc_cs_num) { +if (cs >= gpmc_cs_num) {pr_err ("%s: requested chip-select is disabled\n" , __func__);return -ENODEV ; }
@@ -978,7 +978,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)struct resource *res = &gpmc->mem;int r =-1 ; -if (cs > gpmc_cs_num) { +if (cs >= gpmc_cs_num) {pr_err ("%s: requested chip-select is disabled\n" , __func__);return -ENODEV ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 591/757 memory: omap-gpmc: Fix build error without CONFIG_OF
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 13d029ee51da365aa9c859db0c7395129252bde8 ]
If CONFIG_OF is n, gcc fails:
drivers/memory/omap-gpmc.o: In function `gpmc_omap_onenand_set_timings':
omap-gpmc.c:(.text+0x2a88): undefined reference to `gpmc_read_settings_dt'
Add gpmc_read_settings_dt() helper function, which zero the gpmc_settings so the caller doesn't proceed with random/invalid settings.
--- drivers/memory/omap-gpmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/memory/omap-gpmc.c +4 -0
@@ -2265,6 +2265,10 @@ static void gpmc_probe_dt_children(struct platform_device *pdev) } }#else +void gpmc_read_settings_dt (struct device_node *np,struct gpmc_settings *p) +{ +memset (p,0 ,sizeof (*p)); +}static int gpmc_probe_dt (struct platform_device *pdev) {return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 592/757 arm64: dts: qcom: msm8992: Fix UART interrupt property
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit aa551bd7a04159cf2ca8806abe5da8012b59d058 ]
"interrupt" is not a valid property.
--- arch/arm64/boot/dts/qcom/msm8992.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8992.dtsi +1 -1
@@ -335,7 +335,7 @@ blsp_i2c6: i2c@f9928000 { blsp2_uart2: serial@f995e000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0xf995e000 0x1000>; - interrupt = <GIC_SPI 146 IRQ_TYPE_LEVEL_LOW>; + interrupts = <GIC_SPI 146 IRQ_TYPE_LEVEL_LOW>; clock-names = "core", "iface"; clocks = <&gcc GCC_BLSP2_UART2_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 593/757 arm64: dts: qcom: sdm845-db845c: Fix hdmi nodes
In reply to Greg Kroah-HartmanFrom: Vinod Koul <[email protected]>
[ Upstream commit bca4339bda0989e49189c164795b120eb261970c ]
As per binding documentation, we should have dsi as node 0 and hdmi audio as node 1, so fix it
--- arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +6 -6
@@ -451,16 +451,16 @@ ports { port@0 { reg = <0>; - lt9611_out: endpoint { - remote-endpoint = <&hdmi_con>; + lt9611_a: endpoint { + remote-endpoint = <&dsi0_out>; }; }; - port@1 { - reg = <1>; + port@2 { + reg = <2>; - lt9611_a: endpoint { - remote-endpoint = <&dsi0_out>; + lt9611_out: endpoint { + remote-endpoint = <&hdmi_con>; }; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 594/757 arm64: dts: qcom: sm8150: fix up primary USB nodes
In reply to Greg Kroah-HartmanFrom: Jonathan Marek <[email protected]>
[ Upstream commit 79493db5bb573017767b4f48b0fc69bfd01b82d2 ]
The compatible for hsphy has out of place indentation, and the assigned clock rate for GCC_USB30_PRIM_MASTER_CLK is incorrect, the clock doesn't support a rate of 150000000. Use a rate of 200000000 to match downstream.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +2 -2
@@ -767,7 +767,7 @@ glink-edge { usb_1_hsphy: phy@88e2000 { compatible = "qcom,sm8150-usb-hs-phy", - "qcom,usb-snps-hs-7nm-phy"; + "qcom,usb-snps-hs-7nm-phy"; reg = <0 0x088e2000 0 0x400>; status = "disabled"; #phy-cells = <0>;
@@ -833,7 +833,7 @@ usb_1: usb@a6f8800 { assigned-clocks = <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, <&gcc GCC_USB30_PRIM_MASTER_CLK>; - assigned-clock-rates = <19200000>, <150000000>; + assigned-clock-rates = <19200000>, <200000000>; interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 595/757 arm64: dts: qcom: sc7180: Fix the LLCC base register size
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit efe788361f72914017515223414d3f20abe4b403 ]
There is one LLCC logical bank(LLCC0) on SC7180 SoC and the size of the LLCC0 base is 0x50000(320KB) not 2MB, so correct the size and fix copy paste mistake carried over from SDM845.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +1 -1
@@ -2618,7 +2618,7 @@ dc_noc: interconnect@9160000 { system-cache-controller@9200000 { compatible = "qcom,sc7180-llcc"; - reg = <0 0x09200000 0 0x200000>, <0 0x09600000 0 0x50000>; + reg = <0 0x09200000 0 0x50000>, <0 0x09600000 0 0x50000>; reg-names = "llcc_base", "llcc_broadcast_base"; interrupts = <GIC_SPI 582 IRQ_TYPE_LEVEL_HIGH>; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 596/757 memory: fsl-corenet-cf: Fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit dd85345abca60a8916617e8d75c0f9ce334336dd ]
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.
--- drivers/memory/fsl-corenet-cf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/memory/fsl-corenet-cf.c +2 -4
@@ -211,10 +211,8 @@ static int ccf_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, ccf); irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (&pdev->dev,"%s: no irq\n" , __func__); -return -ENXIO ; - } +if (irq <0 ) +return irq; ret =devm_request_irq (&pdev->dev, irq, ccf_irq,0 , pdev->name, ccf);if (ret) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 597/757 firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 6ed6c558234f0b6c22e47a3c2feddce3d02324dd ]
scmi_mailbox is obtained from cinfo->transport_info and the first call to mailbox_chan_free frees the channel and sets cinfo->transport_info to NULL. Care is taken to check for non NULL smbox->chan but smbox can itself be NULL. Fix it by checking for it without which, kernel crashes with below NULL pointer dereference and eventually kernel panic.
Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000038
Modules linked in: scmi_module(-)
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno
Development Platform, BIOS EDK II Sep 2 2020
pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--)
pc : mailbox_chan_free+0x2c/0x70 [scmi_module]
lr : idr_for_each+0x6c/0xf8
Call trace:
mailbox_chan_free+0x2c/0x70 [scmi_module]
idr_for_each+0x6c/0xf8
scmi_remove+0xa8/0xf0 [scmi_module]
platform_drv_remove+0x34/0x58
device_release_driver_internal+0x118/0x1f0
driver_detach+0x58/0xe8
bus_remove_driver+0x64/0xe0
driver_unregister+0x38/0x68
platform_driver_unregister+0x1c/0x28
scmi_driver_exit+0x38/0x44 [scmi_module]
---[ end trace 17bde19f50436de9 ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: 0x1d0000 from 0xffff800010000000
PHYS_OFFSET: 0x80000000
CPU features: 0x0240022,25806004
Memory Limit: none
---[ end Kernel panic - not syncing: Fatal exception ]------ drivers/firmware/arm_scmi/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/mailbox.c +1 -1
@@ -110,7 +110,7 @@ static int mailbox_chan_free(int id, void *p, void *data)struct scmi_chan_info *cinfo = p;struct scmi_mailbox *smbox = cinfo->transport_info; -if (!IS_ERR (smbox->chan)) { +if (smbox && !IS_ERR (smbox->chan)) {mbox_free_channel (smbox->chan); cinfo->transport_info =NULL ; smbox->chan =NULL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 598/757 arm64: dts: mt8173-elm: fix supported values for regulator-allowed-modes of da9211
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 9d955478a89b4a1ff4e7442216f2822dee8fde73 ]
According to the datasheet the allowed modes for the da9211 regulator are sync and auto mode. This should be changed in the devicetree. This also fix an error message
'BUCKA: invalid regulator-allowed-modes element 0' since value 0 is invalid.
--- arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +3 -1
@@ -5,6 +5,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/input/linux-event-codes.h> +#include <dt-bindings/regulator/dlg,da9211-regulator.h> #include <dt-bindings/gpio/gpio.h> #include "mt8173.dtsi"
@@ -294,7 +295,8 @@ da9211_vcpu_reg: BUCKA { regulator-max-microamp = <4400000>; regulator-ramp-delay = <10000>; regulator-always-on; - regulator-allowed-modes = <0 1>; + regulator-allowed-modes = <DA9211_BUCK_MODE_SYNC + DA9211_BUCK_MODE_AUTO>; }; da9211_vgpu_reg: BUCKB {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 599/757 arm64: dts: qcom: sm8250: Rename UART2 node to UART12
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit bb1dfb4da1d031380cd631dd0d6884d4e79a8d51 ]
The UART12 node has been mistakenly mentioned as UART2. Let's fix that for both SM8250 SoC and MTP board and also add pinctrl definition for it.
--- arch/arm64/boot/dts/qcom/sm8250-mtp.dts | 4 ++-- arch/arm64/boot/dts/qcom/sm8250.dtsi | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8250-mtp.dts +2 -2
@@ -17,7 +17,7 @@ / { compatible = "qcom,sm8250-mtp"; aliases { - serial0 = &uart2; + serial0 = &uart12; }; chosen {
@@ -371,7 +371,7 @@ &tlmm { gpio-reserved-ranges = <28 4>, <40 4>; }; -&uart2 { +&uart12 { status = "okay"; };
arch/arm64/boot/dts/qcom/sm8250.dtsi +10 -1
@@ -935,11 +935,13 @@ spi12: spi@a90000 { status = "disabled"; }; - uart2: serial@a90000 { + uart12: serial@a90000 { compatible = "qcom,geni-debug-uart"; reg = <0x0 0x00a90000 0x0 0x4000>; clock-names = "se"; clocks = <&gcc GCC_QUPV3_WRAP1_S4_CLK>; + pinctrl-names = "default"; + pinctrl-0 = <&qup_uart12_default>; interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
@@ -1880,6 +1882,13 @@ config { bias-disable; }; }; + + qup_uart12_default: qup-uart12-default { + mux { + pins = "gpio34", "gpio35"; + function = "qup12"; + }; + }; }; adsp: remoteproc@17300000 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 600/757 dmaengine: ti: k3-udma-glue: Fix parameters for rx ring pair request
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 6259c8441c4de3f1727a0db61465a8dc8f340c05 ]
The original commit mixed up the forward and completion ring IDs for the rx flow configuration.
--- drivers/dma/ti/k3-udma-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/ti/k3-udma-glue.c +1 -1
@@ -573,8 +573,8 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn,/* request and cfg rings */ ret =k3_ringacc_request_rings_pair (rx_chn->common.ringacc, - flow_cfg->ring_rxq_id, flow_cfg->ring_rxfdq0_id, + flow_cfg->ring_rxq_id, &flow->ringrxfdq, &flow->ringrx);if (ret) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 601/757 arm64: dts: imx8mq: Add missing interrupts to GPC
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 791619f66843a213784efb2f171be98933bad991 ]
The i.MX General Power Controller v2 device node was missing interrupts property necessary to route its interrupt to GIC. This also fixes the dbts_check warnings like:
arch/arm64/boot/dts/freescale/imx8mq-evk.dt.yaml: gpc@303a0000:
{'compatible': ... '$nodename': ['gpc@303a0000']} is not valid under any of the given schemas arch/arm64/boot/dts/freescale/imx8mq-evk.dt.yaml: gpc@303a0000: 'interrupts' is a required property
--- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -617,6 +617,7 @@ src: reset-controller@30390000 { gpc: gpc@303a0000 { compatible = "fsl,imx8mq-gpc"; reg = <0x303a0000 0x10000>; + interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 602/757 arm64: dts: qcom: sc7180: Drop flags on mdss irqs
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 51e9874d382e089f664b3ce12773bbbaece5f369 ]
The number of interrupt cells for the mdss interrupt controller is 1, meaning there should only be one cell for the interrupt number, not two where the second cell is the irq flags. Drop the second cell to match the binding.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +2 -2
@@ -2785,7 +2785,7 @@ mdp: mdp@ae01000 { power-domains = <&rpmhpd SC7180_CX>; interrupt-parent = <&mdss>; - interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <0>; status = "disabled";
@@ -2833,7 +2833,7 @@ dsi0: dsi@ae94000 { reg-names = "dsi_ctrl"; interrupt-parent = <&mdss>; - interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <4>; clocks = <&dispcc DISP_CC_MDSS_BYTE0_CLK>, <&dispcc DISP_CC_MDSS_BYTE0_INTF_CLK>,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 603/757 arm64: dts: sdm845: Fixup OPP table for all qup devices
In reply to Greg Kroah-HartmanFrom: Rajendra Nayak <[email protected]>
[ Upstream commit e0b760a5f6c9e54db8bd22b1d6b19223e6b92264 ]
This OPP table was based on the clock VDD-FMAX tables seen in downstream code, however it turns out the downstream clock driver does update these tables based on later/production rev of the chip and whats seen in the tables belongs to an early engineering rev of the SoC.
Fix up the OPP tables such that it now matches with the production rev of sdm845 SoC.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +7 -2
@@ -1093,8 +1093,8 @@ rng: rng@793000 { qup_opp_table: qup-opp-table { compatible = "operating-points-v2"; - opp-19200000 { - opp-hz = /bits/ 64 <19200000>; + opp-50000000 { + opp-hz = /bits/ 64 <50000000>; required-opps = <&rpmhpd_opp_min_svs>; };
@@ -1107,6 +1107,11 @@ opp-100000000 { opp-hz = /bits/ 64 <100000000>; required-opps = <&rpmhpd_opp_svs>; }; + + opp-128000000 { + opp-hz = /bits/ 64 <128000000>; + required-opps = <&rpmhpd_opp_nom>; + }; }; qupv3_id_0: geniqup@8c0000 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 604/757 soc: qcom: pdr: Fixup array type of get_domain_list_resp message
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
[ Upstream commit 7a366707bb6a93baeb1a9ef46c4b9c875e0132d6 ]
The array type of get_domain_list_resp is incorrectly marked as NO_ARRAY. Due to which the following error was observed when using pdr helpers with the downstream proprietary pd-mapper. Fix this up by marking it as VAR_LEN_ARRAY instead.
Err logs:qmi_decode_struct_elem: Fault in decoding: dl(2), db(27), tl(160), i(1), el(1) failed to decode incoming message
PDR: tms/servreg get domain list txn wait failed: -14
PDR: service lookup for tms/servreg failed: -14
--- drivers/soc/qcom/pdr_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/pdr_internal.h +1 -1
@@ -185,7 +185,7 @@ struct qmi_elem_info servreg_get_domain_list_resp_ei[] = { .data_type = QMI_STRUCT, .elem_len = SERVREG_DOMAIN_LIST_LENGTH, .elem_size = sizeof(struct servreg_location_entry), - .array_type = NO_ARRAY, + .array_type = VAR_LEN_ARRAY, .tlv_type = 0x12, .offset = offsetof(struct servreg_get_domain_list_resp , domain_list),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 605/757 arm64: dts: qcom: msm8916: Remove one more thermal trip point unit name
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit e6859ae8603c5946b8f3ecbd9b4f02b72955b9d0 ]
Commit fe2aff0c574d2 ("arm64: dts: qcom: msm8916: remove unit name for thermal trip points") removed the unit names for most of the thermal trip points defined
in msm8916.dtsi, but missed to update the one for cpu0_1-thermal.
So why wasn't this spotted by "make dtbs_check"? Apparently, the name of the thermal zone is already invalid: thermal-zones.yaml specifies a regex of ^[a-zA-Z][a-zA-Z0-9\\-]{1,12}-thermal$, so it is not allowed to contain underscores. Therefore the thermal zone was never verified using the DTB schema.
After replacing the underscore in the thermal zone name, the warning shows up:
apq8016-sbc.dt.yaml: thermal-zones: cpu0-1-thermal:trips: 'trip-point@0'
does not match any of the regexes: '^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+'Fix up the thermal zone names and remove the unit name for the trip point.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +3 -3
@@ -229,14 +229,14 @@ pmu { }; thermal-zones { - cpu0_1-thermal { + cpu0-1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsens 5>; trips { - cpu0_1_alert0: trip-point@0 { + cpu0_1_alert0: trip-point0 { temperature = <75000>; hysteresis = <2000>; type = "passive";
@@ -259,7 +259,7 @@ map0 { }; }; - cpu2_3-thermal { + cpu2-3-thermal { polling-delay-passive = <250>; polling-delay = <1000>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 606/757 arm64: dts: qcom: pm8916: Remove invalid reg size from wcd_codec
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit c2f0cbb57dbac6da3d38b47b5b96de0fe4e23884 ]
Tha parent node of "wcd_codec" specifies #address-cells = <1> and #size-cells = <0>, which means that each resource should be described by one cell for the address and size omitted.
However, wcd_codec currently lists 0x200 as second cell (probably the size of the resource). When parsing this would be treated like another memory resource - which is entirely wrong.
To quote the device tree specification [1]:
"If the parent node specifies a value of 0 for #size-cells,
the length field in the value of reg shall be omitted."
[1]: https://www.devicetree.org/specifications/
--- arch/arm64/boot/dts/qcom/pm8916.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pm8916.dtsi +1 -1
@@ -119,7 +119,7 @@ pm8916_vib: vibrator@c000 { wcd_codec: codec@f000 { compatible = "qcom,pm8916-wcd-analog-codec"; - reg = <0xf000 0x200>; + reg = <0xf000>; reg-names = "pmic-codec-core"; clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>; clock-names = "mclk";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 607/757 arm64: dts: qcom: msm8916: Fix MDP/DSI interrupts
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 027cca9eb5b450c3f6bb916ba999144c2ec23cb7 ]
The mdss node sets #interrupt-cells = <1>, so its interrupts should be referenced using a single cell (in this case: only the interrupt number).
However, right now the mdp/dsi node both have two interrupt cells set, e.g. interrupts = <4 0>. The 0 is probably meant to say IRQ_TYPE_NONE (= 0), but with #interrupt-cells = <1> this is actually interpreted as a second interrupt line.
Remove the IRQ flags from both interrupts to fix this.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -1052,7 +1052,7 @@ mdp: mdp@1a01000 { reg-names = "mdp_phys"; interrupt-parent = <&mdss>; - interrupts = <0 0>; + interrupts = <0>; clocks = <&gcc GCC_MDSS_AHB_CLK>, <&gcc GCC_MDSS_AXI_CLK>,
@@ -1084,7 +1084,7 @@ dsi0: dsi@1a98000 { reg-names = "dsi_ctrl"; interrupt-parent = <&mdss>; - interrupts = <4 0>; + interrupts = <4>; assigned-clocks = <&gcc BYTE0_CLK_SRC>, <&gcc PCLK0_CLK_SRC>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 608/757 soc: qcom: apr: Fixup the error displayed on lookup failure
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
[ Upstream commit ba34f977c333f96c8acd37ec30e232220399f5a5 ]
APR client incorrectly prints out "ret" variable on pdr_add_lookup failure, it should be printing the error value returned by the lookup instead.
--- drivers/soc/qcom/apr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/apr.c +1 -1
@@ -328,7 +328,7 @@ static int of_apr_add_pd_lookups(struct device *dev) pds =pdr_add_lookup (apr->pdr, service_name, service_path);if (IS_ERR (pds) &&PTR_ERR (pds) != -EALREADY ) { -dev_err (dev,"pdr add lookup failed: %d\n" , ret); +dev_err (dev,"pdr add lookup failed: %ld\n" ,PTR_ERR (pds));return PTR_ERR (pds); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 609/757 dt-bindings: crypto: Specify that allwinner, sun8i-a33-crypto needs reset
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 884d1a334ae8130fabede56f59b224619ad6bca4 ]
When adding allwinner,sun8i-a33-crypto, I forgot to add that it needs reset. Furthermore, there are no need to use items to list only one compatible in compatible list.
--- .../bindings/crypto/allwinner,sun4i-a10-crypto.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml +4 -3
@@ -23,8 +23,7 @@ properties: - items: - const: allwinner,sun7i-a20-crypto - const: allwinner,sun4i-a10-crypto - - items: - - const: allwinner,sun8i-a33-crypto + - const: allwinner,sun8i-a33-crypto reg: maxItems: 1
@@ -59,7 +58,9 @@ if: properties: compatible: contains: - const: allwinner,sun6i-a31-crypto + enum: + - allwinner,sun6i-a31-crypto + - allwinner,sun8i-a33-crypto then: required:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 610/757 arm64: dts: renesas: r8a77990: Fix MSIOF1 DMA channels
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 453802c463abd003a7c38ffbc90b67ba162335b6 ]
According to Technical Update TN-RCT-S0352A/E, MSIOF1 DMA can only be used with SYS-DMAC0 on R-Car E3.
--- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +2 -3
@@ -1192,9 +1192,8 @@ msiof1: spi@e6ea0000 { reg = <0 0xe6ea0000 0 0x0064>; interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 210>; - dmas = <&dmac1 0x43>, <&dmac1 0x42>, - <&dmac2 0x43>, <&dmac2 0x42>; - dma-names = "tx", "rx", "tx", "rx"; + dmas = <&dmac0 0x43>, <&dmac0 0x42>; + dma-names = "tx", "rx"; power-domains = <&sysc R8A77990_PD_ALWAYS_ON>; resets = <&cpg 210>; #address-cells = <1>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 611/757 arm64: dts: renesas: r8a774c0: Fix MSIOF1 DMA channels
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit c91dfc9818df5f43c10c727f1cecaebdb5e2fa92 ]
According to Technical Update TN-RCT-S0352A/E, MSIOF1 DMA can only be used with SYS-DMAC0 on R-Car E3.
--- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a774c0.dtsi +2 -3
@@ -1214,9 +1214,8 @@ msiof1: spi@e6ea0000 { reg = <0 0xe6ea0000 0 0x0064>; interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 210>; - dmas = <&dmac1 0x43>, <&dmac1 0x42>, - <&dmac2 0x43>, <&dmac2 0x42>; - dma-names = "tx", "rx", "tx", "rx"; + dmas = <&dmac0 0x43>, <&dmac0 0x42>; + dma-names = "tx", "rx"; power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>; resets = <&cpg 210>; #address-cells = <1>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 612/757 arm64: dts: mt8173: elm: Fix nor_flash node property
In reply to Greg Kroah-HartmanFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 1276be23fd53e1c4e752966d0eab42aa54a343da ]
bus-width and non-removable is not used by the driver. max-frequency should be spi-max-frequency for flash node.
--- arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +2 -3
@@ -433,12 +433,11 @@ &nor_flash { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&nor_gpio1_pins>; - bus-width = <8>; - max-frequency = <50000000>; - non-removable; + flash@0 { compatible = "jedec,spi-nor"; reg = <0>; + spi-max-frequency = <50000000>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 613/757 arm64: dts: ti: k3-j721e: Rename mux header and update macro names
In reply to Greg Kroah-HartmanFrom: Roger Quadros <[email protected]>
[ Upstream commit c65176fd49f45bd5a5ffaa1790109745d1fa462c ]
We intend to use one header file for SERDES MUX for all TI SoCs so rename the header file.
The exsting macros are too generic. Prefix them with SoC name.
While at that, add the missing configurations for completeness.
--- .../dts/ti/k3-j721e-common-proc-board.dts | 11 +-- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 13 ++-- include/dt-bindings/mux/mux-j721e-wiz.h | 53 -------------- include/dt-bindings/mux/ti-serdes.h | 71 +++++++++++++++++++ 4 files changed, 84 insertions(+), 64 deletions(-) delete mode 100644 include/dt-bindings/mux/mux-j721e-wiz.h create mode 100644 include/dt-bindings/mux/ti-serdes.h
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +6 -5
@@ -404,11 +404,12 @@ &usb_serdes_mux { }; &serdes_ln_ctrl { - idle-states = <SERDES0_LANE0_PCIE0_LANE0>, <SERDES0_LANE1_PCIE0_LANE1>, - <SERDES1_LANE0_PCIE1_LANE0>, <SERDES1_LANE1_PCIE1_LANE1>, - <SERDES2_LANE0_PCIE2_LANE0>, <SERDES2_LANE1_PCIE2_LANE1>, - <SERDES3_LANE0_USB3_0_SWAP>, <SERDES3_LANE1_USB3_0>, - <SERDES4_LANE0_EDP_LANE0>, <SERDES4_LANE1_EDP_LANE1>, <SERDES4_LANE2_EDP_LANE2>, <SERDES4_LANE3_EDP_LANE3>; + idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_PCIE0_LANE1>, + <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>, + <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>, + <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>, + <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>, + <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>; }; &serdes_wiz3 {
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +7 -6
@@ -6,7 +6,7 @@ */ #include <dt-bindings/phy/phy.h> #include <dt-bindings/mux/mux.h> -#include <dt-bindings/mux/mux-j721e-wiz.h> +#include <dt-bindings/mux/ti-serdes.h> &cbass_main { msmc_ram: sram@70000000 {
@@ -38,11 +38,12 @@ serdes_ln_ctrl: serdes-ln-ctrl@4080 { <0x40b0 0x3>, <0x40b4 0x3>, /* SERDES3 lane0/1 select */ <0x40c0 0x3>, <0x40c4 0x3>, <0x40c8 0x3>, <0x40cc 0x3>; /* SERDES4 lane0/1/2/3 select */ - idle-states = <SERDES0_LANE0_PCIE0_LANE0>, <SERDES0_LANE1_PCIE0_LANE1>, - <SERDES1_LANE0_PCIE1_LANE0>, <SERDES1_LANE1_PCIE1_LANE1>, - <SERDES2_LANE0_PCIE2_LANE0>, <SERDES2_LANE1_PCIE2_LANE1>, - <MUX_IDLE_AS_IS>, <SERDES3_LANE1_USB3_0>, - <SERDES4_LANE0_EDP_LANE0>, <SERDES4_LANE1_EDP_LANE1>, <SERDES4_LANE2_EDP_LANE2>, <SERDES4_LANE3_EDP_LANE3>; + idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_PCIE0_LANE1>, + <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>, + <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>, + <MUX_IDLE_AS_IS>, <J721E_SERDES3_LANE1_USB3_0>, + <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>, + <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>; }; usb_serdes_mux: mux-controller@4000 {
include/dt-bindings/mux/mux-j721e-wiz.h deleted +0 -53
53 lines not on this page · raw message
include/dt-bindings/mux/ti-serdes.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 614/757 arm64: dts: actions: limit address range for pinctrl node
In reply to Greg Kroah-HartmanFrom: Amit Singh Tomar <[email protected]>
[ Upstream commit 4bb1eb3cd4bd6241d5e5f99bbfd801ea5a007b6c ]
After commit 7cdf8446ed1d ("arm64: dts: actions: Add pinctrl node for Actions Semi S700") following error has been observed while booting Linux on Cubieboard7-lite(based on S700 SoC).
[ 0.257415] pinctrl-s700 e01b0000.pinctrl: can't request region for resource [mem 0xe01b0000-0xe01b0fff] [ 0.266902] pinctrl-s700: probe of e01b0000.pinctrl failed with error -16
This is due to the fact that memory range for "sps" power domain controller clashes with pinctrl.
One way to fix it, is to limit pinctrl address range which is safe to do as current pinctrl driver uses address range only up to 0x100.
This commit limits the pinctrl address range to 0x100 so that it doesn't conflict with sps range.
Semi S700")
--- arch/arm64/boot/dts/actions/s700.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/actions/s700.dtsi +1 -1
@@ -231,7 +231,7 @@ timer: timer@e024c000 { pinctrl: pinctrl@e01b0000 { compatible = "actions,s700-pinctrl"; - reg = <0x0 0xe01b0000 0x0 0x1000>; + reg = <0x0 0xe01b0000 0x0 0x100>; clocks = <&cmu CLK_GPIO>; gpio-controller; gpio-ranges = <&pinctrl 0 0 136>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 615/757 ARM: dts: owl-s500: Fix incorrect PPI interrupt specifiers
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 55f6c9931f7c32f19cf221211f099dfd8dab3af9 ]
The PPI interrupts for cortex-a9 were incorrectly specified, fix them.
--- arch/arm/boot/dts/owl-s500.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/owl-s500.dtsi +3 -3
@@ -84,21 +84,21 @@ scu: scu@b0020000 { global_timer: timer@b0020200 { compatible = "arm,cortex-a9-global-timer"; reg = <0xb0020200 0x100>; - interrupts = <GIC_PPI 0 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; }; twd_timer: timer@b0020600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xb0020600 0x20>; - interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; }; twd_wdt: wdt@b0020620 { compatible = "arm,cortex-a9-twd-wdt"; reg = <0xb0020620 0xe0>; - interrupts = <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 616/757 soc: fsl: qbman: Fix return value on success
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 750cf40c0f7088f36a8a5d102e0488b1ac47faf5 ]
On error the function was meant to return -ERRNO. This also fixes compile warning:
drivers/soc/fsl/qbman/bman.c:640:6: warning: variable 'err' set but not used [-Wunused-but-set-variable]
--- drivers/soc/fsl/qbman/bman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qbman/bman.c +1 -1
@@ -660,7 +660,7 @@ int bm_shutdown_pool(u32 bpid) } done:put_affine_portal (); -return 0 ; +return err; }struct gen_pool *bm_bpalloc;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 617/757 ARM: OMAP2+: Restore MPU power domain if cpu_cluster_pm_enter() fails
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 8f04aea048d56f3e39a7e543939450246542a6fc ]
If cpu_cluster_pm_enter() fails, we need to set MPU power domain back to enabled to prevent the next WFI from potentially triggering an undesired MPU power domain state change.
We already do this for omap_enter_idle_smp() but are missing it for omap_enter_idle_coupled().
--- arch/arm/mach-omap2/cpuidle44xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/cpuidle44xx.c +3 -1
@@ -174,8 +174,10 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,*/ if (mpuss_can_lose_context) { error =cpu_cluster_pm_enter (); -if (error) +if (error) { +omap_set_pwrdm_state (mpu_pd,PWRDM_POWER_ON ); goto cpu_cluster_pm_out; + } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 618/757 ARM: dts: stm32: Fix sdmmc2 pins on AV96
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 1ad6e36ec266cedb0d274aa13253ff1fb2eed4ba ]
The AV96 uses sdmmc2_d47_pins_c and sdmmc2_d47_sleep_pins_c, which differ from sdmmc2_d47_pins_b and sdmmc2_d47_sleep_pins_b in one pin, SDMMC2_D5, which is PA15 in the former and PA9 in the later. The PA15 is correct on AV96, so fix this. This error is likely a result of rebasing across the stm32mp1 DT pinctrl rework.
--- arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi +3 -3
@@ -295,9 +295,9 @@ &sdmmc1 { &sdmmc2 { pinctrl-names = "default", "opendrain", "sleep"; - pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>; - pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>; - pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>; + pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>; + pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>; + pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>; bus-width = <8>; mmc-ddr-1_8v; no-sd;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 619/757 ARM: dts: stm32: lxa-mc1: Fix kernel warning about PHY delays
In reply to Greg Kroah-HartmanFrom: Holger Assmann <[email protected]>
[ Upstream commit 42a31ac6698681363363d48335559d212a26a7ca ]
The KSZ9031 PHY skew timings for rxc/txc, originally set to achieve the desired phase shift between clock- and data-signal, now trigger a kernel warning when used in rgmii-id mode:
*-skew-ps values should be used only with phy-mode = "rgmii"
This is because commit bcf3440c6dd7 ("net: phy: micrel: add phy-mode support for the KSZ9031 PHY") now configures own timings when phy-mode = "rgmii-id". Device trees wanting to set their own delays should use phy-mode "rgmii" instead as the warning prescribes.
The "standard" timings now used with "rgmii-id" work fine on this board, so drop the explicit timings in the device tree and thereby silence the warning.
--- arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts +0 -2
@@ -121,8 +121,6 @@ ethphy: ethernet-phy@3 { /* KSZ9031RN */ reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */ interrupt-parent = <&gpioa>; interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */ - rxc-skew-ps = <1860>; - txc-skew-ps = <1860>; reset-assert-us = <10000>; reset-deassert-us = <300>; micrel,force-master;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 620/757 ARM: dts: stm32: Move ethernet PHY into DH SoM DT
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit b0a07f609600b6fa4c30f783db50c38456804485 ]
The PHY and the VIO regulator is populated on the SoM, move it into the SoM DT.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 33 ----------------- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 33 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi +0 -33
@@ -11,7 +11,6 @@ aliases { serial0 = &uart4; serial1 = &usart3; serial2 = &uart8; - ethernet0 = ðernet0; }; chosen {
@@ -33,16 +32,6 @@ display_bl: display-bl { status = "okay"; }; - ethernet_vio: vioregulator { - compatible = "regulator-fixed"; - regulator-name = "vio"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - gpio = <&gpiog 3 GPIO_ACTIVE_LOW>; - regulator-always-on; - regulator-boot-on; - }; - gpio-keys-polled { compatible = "gpio-keys-polled"; #size-cells = <0>;
@@ -141,28 +130,6 @@ &cec { status = "okay"; }; -ðernet0 { - status = "okay"; - pinctrl-0 = <ðernet0_rmii_pins_a>; - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; - pinctrl-names = "default", "sleep"; - phy-mode = "rmii"; - max-speed = <100>; - phy-handle = <&phy0>; - st,eth-ref-clk-sel; - phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; - - mdio0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "snps,dwmac-mdio"; - - phy0: ethernet-phy@1 { - reg = <1>; - }; - }; -}; - &i2c2 { /* Header X22 */ pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins_a>;
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +36 -0
@@ -9,6 +9,10 @@ #include <dt-bindings/mfd/st,stpmic1.h> / { + aliases { + ethernet0 = ðernet0; + }; + memory@c0000000 { device_type = "memory"; reg = <0xC0000000 0x40000000>;
@@ -55,6 +59,16 @@ retram: retram@38000000 { no-map; }; }; + + ethernet_vio: vioregulator { + compatible = "regulator-fixed"; + regulator-name = "vio"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpiog 3 GPIO_ACTIVE_LOW>; + regulator-always-on; + regulator-boot-on; + }; }; &adc {
@@ -94,6 +108,28 @@ &dts { status = "okay"; }; +ðernet0 { + status = "okay"; + pinctrl-0 = <ðernet0_rmii_pins_a>; + pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; + pinctrl-names = "default", "sleep"; + phy-mode = "rmii"; + max-speed = <100>; + phy-handle = <&phy0>; + st,eth-ref-clk-sel; + phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; + + mdio0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy0: ethernet-phy@1 { + reg = <1>; + }; + }; +}; + &i2c4 { pinctrl-names = "default"; pinctrl-0 = <&i2c4_pins_a>;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 621/757 ARM: dts: stm32: Swap PHY reset GPIO and TSC2004 IRQ on DHCOM SOM
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 9ad98319e95263469d8ca2cb543c37c5a2f40980 ]
On the production revision of the SoM, 587-200, the PHY reset GPIO and touchscreen IRQs are swapped to prevent collision between EXTi IRQs, reflect that in DT.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +2 -2
@@ -117,7 +117,7 @@ ðernet0 { max-speed = <100>; phy-handle = <&phy0>; st,eth-ref-clk-sel; - phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; + phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; mdio0 { #address-cells = <1>;
@@ -285,7 +285,7 @@ touchscreen@49 { compatible = "ti,tsc2004"; reg = <0x49>; vio-supply = <&v3v3>; - interrupts-extended = <&gpioh 3 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended = <&gpioh 15 IRQ_TYPE_EDGE_FALLING>; }; eeprom@50 {
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 622/757 ARM: dts: stm32: Fix DH PDK2 display PWM channel
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 57592d2a98dbc3bde3ddc062e91a8486bdcb211e ]
The display PWM channel is number 3 (PWM2 CH4), make it so.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi +1 -1
@@ -25,7 +25,7 @@ clk_ext_audio_codec: clock-codec { display_bl: display-bl { compatible = "pwm-backlight"; - pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>; + pwms = <&pwm2 3 500000 PWM_POLARITY_INVERTED>; brightness-levels = <0 16 22 30 40 55 75 102 138 188 255>; default-brightness-level = <8>; enable-gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 623/757 ARM: dts: iwg20d-q7-common: Fix touch controller probe failure
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 08d7a73fffb6769b1cf2278bf697e692daba3abf ]
As per the iWave RZ/G1M schematic, the signal LVDS_PPEN controls the supply voltage for the touch panel, LVDS receiver and RGB LCD panel. Add a regulator for these device nodes and remove the powerdown-gpios property from the lvds-receiver node as it results in a touch controller driver probe failure.
--- arch/arm/boot/dts/iwg20d-q7-common.dtsi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/boot/dts/iwg20d-q7-common.dtsi +14 -1
@@ -57,7 +57,7 @@ lcd_backlight: backlight { lvds-receiver { compatible = "ti,ds90cf384a", "lvds-decoder"; - powerdown-gpios = <&gpio7 25 GPIO_ACTIVE_LOW>; + power-supply = <&vcc_3v3_tft1>; ports { #address-cells = <1>;
@@ -81,6 +81,7 @@ lvds_receiver_out: endpoint { panel { compatible = "edt,etm0700g0dh6"; backlight = <&lcd_backlight>; + power-supply = <&vcc_3v3_tft1>; port { panel_in: endpoint {
@@ -113,6 +114,17 @@ sndcodec: simple-audio-card,codec { }; }; + vcc_3v3_tft1: regulator-panel { + compatible = "regulator-fixed"; + + regulator-name = "vcc-3v3-tft1"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + enable-active-high; + startup-delay-us = <500>; + gpio = <&gpio7 25 GPIO_ACTIVE_HIGH>; + }; + vcc_sdhi1: regulator-vcc-sdhi1 { compatible = "regulator-fixed";
@@ -207,6 +219,7 @@ touch: touchpanel@38 { reg = <0x38>; interrupt-parent = <&gpio2>; interrupts = <12 IRQ_TYPE_EDGE_FALLING>; + vcc-supply = <&vcc_3v3_tft1>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 624/757 soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api
In reply to Greg Kroah-HartmanFrom: Dennis YC Hsieh <[email protected]>
[ Upstream commit 23c22299cd290409c6b78f57c42b64f8dfb6dd92 ]
Add clear parameter to let client decide if
event should be clear to 0 after GCE receive it.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- drivers/soc/mediatek/mtk-cmdq-helper.c | 5 +++-- include/linux/mailbox/mtk-cmdq-mailbox.h | 3 +-- include/linux/soc/mediatek/mtk-cmdq.h | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -1
@@ -481,7 +481,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)mbox_flush (mtk_crtc->cmdq_client->chan,2000 ); cmdq_handle =cmdq_pkt_create (mtk_crtc->cmdq_client,PAGE_SIZE );cmdq_pkt_clear_event (cmdq_handle, mtk_crtc->cmdq_event); -cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event); +cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, true);mtk_crtc_ddp_config (crtc, cmdq_handle);cmdq_pkt_finalize (cmdq_handle);cmdq_pkt_flush_async (cmdq_handle, ddp_cmdq_cb, cmdq_handle);
drivers/soc/mediatek/mtk-cmdq-helper.c +3 -2
@@ -223,15 +223,16 @@ int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, }EXPORT_SYMBOL (cmdq_pkt_write_mask); -int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event) +int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event,bool clear) {struct cmdq_instruction inst = { {0 } }; +u32 clear_option = clear ?CMDQ_WFE_UPDATE :0 ;if (event >=CMDQ_MAX_EVENT )return -EINVAL ; inst.op =CMDQ_CODE_WFE ; - inst.value =CMDQ_WFE_OPTION ; + inst.value =CMDQ_WFE_OPTION | clear_option; inst.event = event;return cmdq_pkt_append_command (pkt, inst);
include/linux/mailbox/mtk-cmdq-mailbox.h +1 -2
@@ -28,8 +28,7 @@* bit 16-27: update value * bit 31: 1 - update, 0 - no update */ -#define CMDQ_WFE_OPTION (CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | \ - CMDQ_WFE_WAIT_VALUE) +#define CMDQ_WFE_OPTION (CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE)/** cmdq event maximum */ #define CMDQ_MAX_EVENT 0x3ff
include/linux/soc/mediatek/mtk-cmdq.h +3 -2
@@ -105,11 +105,12 @@ int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,/** * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet * @pkt: the CMDQ packet -* @event: the desired event type to "wait and CLEAR" +* @event: the desired event type to wait +* @clear: clear event or not after event arrive * * Return: 0 for success; else the error code is returned */ -int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event); +int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event,bool clear);/** * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 625/757 drm/mediatek: reduce clear event
In reply to Greg Kroah-HartmanFrom: Dennis YC Hsieh <[email protected]>
[ Upstream commit bee1abc9cc021f50b90f22a589d9ddc816a80db0 ]
No need to clear event again since event always clear before wait. This fix depend on patch:
"soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api"
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -1
@@ -481,7 +481,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)mbox_flush (mtk_crtc->cmdq_client->chan,2000 ); cmdq_handle =cmdq_pkt_create (mtk_crtc->cmdq_client,PAGE_SIZE );cmdq_pkt_clear_event (cmdq_handle, mtk_crtc->cmdq_event); -cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, true); +cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, false);mtk_crtc_ddp_config (crtc, cmdq_handle);cmdq_pkt_finalize (cmdq_handle);cmdq_pkt_flush_async (cmdq_handle, ddp_cmdq_cb, cmdq_handle);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 626/757 arm64: dts: zynqmp: Remove additional compatible string for i2c IPs
In reply to Greg Kroah-HartmanFrom: Michal Simek <[email protected]>
[ Upstream commit 35292518cb0a626fcdcabf739aed75060a018ab5 ]
DT binding permits only one compatible string which was decribed in past by commit 63cab195bf49 ("i2c: removed work arounds in i2c driver for Zynq Ultrascale+ MPSoC").
The commit aea37006e183 ("dt-bindings: i2c: cadence: Migrate i2c-cadence documentation to YAML") has converted binding to yaml and the following issues is reported:
...: i2c@ff030000: compatible: Additional items are not allowed ('cdns,i2c-r1p10' was unexpected)
From schema:.../Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml fds ...: i2c@ff030000: compatible: ['cdns,i2c-r1p14', 'cdns,i2c-r1p10'] is too long
The commit c415f9e8304a ("ARM64: zynqmp: Fix i2c node's compatible string") has added the second compatible string but without removing origin one. The patch is only keeping one compatible string "cdns,i2c-r1p14".
--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +2 -2
@@ -501,7 +501,7 @@ gpio: gpio@ff0a0000 { }; i2c0: i2c@ff020000 { - compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; + compatible = "cdns,i2c-r1p14"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 17 4>;
@@ -512,7 +512,7 @@ i2c0: i2c@ff020000 { }; i2c1: i2c@ff030000 { - compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; + compatible = "cdns,i2c-r1p14"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 18 4>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 627/757 ARM: dts: meson8: remove two invalid interrupt lines from the GPU node
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 737e7610b545cc901a9696083c1824a7104b8d1b ]
The 3.10 vendor kernel defines the following GPU 20 interrupt lines:
#define INT_MALI_GP AM_IRQ(160) #define INT_MALI_GP_MMU AM_IRQ(161) #define INT_MALI_PP AM_IRQ(162) #define INT_MALI_PMU AM_IRQ(163) #define INT_MALI_PP0 AM_IRQ(164) #define INT_MALI_PP0_MMU AM_IRQ(165) #define INT_MALI_PP1 AM_IRQ(166) #define INT_MALI_PP1_MMU AM_IRQ(167) #define INT_MALI_PP2 AM_IRQ(168) #define INT_MALI_PP2_MMU AM_IRQ(169) #define INT_MALI_PP3 AM_IRQ(170) #define INT_MALI_PP3_MMU AM_IRQ(171) #define INT_MALI_PP4 AM_IRQ(172) #define INT_MALI_PP4_MMU AM_IRQ(173) #define INT_MALI_PP5 AM_IRQ(174) #define INT_MALI_PP5_MMU AM_IRQ(175) #define INT_MALI_PP6 AM_IRQ(176) #define INT_MALI_PP6_MMU AM_IRQ(177) #define INT_MALI_PP7 AM_IRQ(178) #define INT_MALI_PP7_MMU AM_IRQ(179)
However, the driver from the 3.10 vendor kernel does not use the following four interrupt lines:
- INT_MALI_PP3
- INT_MALI_PP3_MMU
- INT_MALI_PP7
- INT_MALI_PP7_MMU
Drop the "pp3" and "ppmmu3" interrupt lines. This is also important because there is no matching entry in interrupt-names for it (meaning the "pp2" interrupt is actually assigned to the "pp3" interrupt line).
--- arch/arm/boot/dts/meson8.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/meson8.dtsi +0 -2
@@ -240,8 +240,6 @@ mali: gpu@c0000 { <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 628/757 lightnvm: fix out-of-bounds write to array devices->info[]
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit a48faebe65b0db55a73b9220c3d919eee849bb79 ]
There is an off-by-one array check that can lead to a out-of-bounds write to devices->info[i]. Fix this by checking by using >= rather than > for the size check. Also replace hard-coded array size limit with ARRAY_SIZE on the array.
Addresses-Coverity: ("Out-of-bounds write")
--- drivers/lightnvm/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/lightnvm/core.c +3 -2
@@ -1311,8 +1311,9 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)strlcpy (info->bmname,"gennvm" ,sizeof (info->bmname)); i++; -if (i >31 ) { -pr_err ("max 31 devices can be reported.\n" ); +if (i >=ARRAY_SIZE (devices->info)) { +pr_err ("max %zd devices can be reported.\n" , +ARRAY_SIZE (devices->info));break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 629/757 powerpc/powernv/dump: Fix race while processing OPAL dump
In reply to Greg Kroah-HartmanFrom: Vasant Hegde <[email protected]>
[ Upstream commit 0a43ae3e2beb77e3481d812834d33abe270768ab ]
Every dump reported by OPAL is exported to userspace through a sysfs interface and notified using kobject_uevent(). The userspace daemon (opal_errd) then reads the dump and acknowledges that the dump is saved safely to disk. Once acknowledged the kernel removes the respective sysfs file entry causing respective resources to be released including kobject.
However it's possible the userspace daemon may already be scanning dump entries when a new sysfs dump entry is created by the kernel. User daemon may read this new entry and ack it even before kernel can notify userspace about it through kobject_uevent() call. If that happens then we have a potential race between dump_ack_store->kobject_put() and kobject_uevent which can lead to use-after-free of a kernfs object resulting in a kernel crash.
This patch fixes this race by protecting the sysfs file creation/notification by holding a reference count on kobject until we safely send kobject_uevent().
The function create_dump_obj() returns the dump object which if used by caller function will end up in use-after-free problem again. However, the return value of create_dump_obj() function isn't being used today and there is no need as well. Hence change it to return void to make this fix complete.
--- arch/powerpc/platforms/powernv/opal-dump.c | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-)
arch/powerpc/platforms/powernv/opal-dump.c +29 -12
@@ -318,15 +318,14 @@ static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,return count; } -static struct dump_obj *create_dump_obj (uint32_t id,size_t size, -uint32_t type) +static void create_dump_obj (uint32_t id,size_t size,uint32_t type) {struct dump_obj *dump;int rc; dump =kzalloc (sizeof (*dump),GFP_KERNEL );if (!dump) -return NULL ; +return ; dump->kobj.kset = dump_kset;
@@ -346,21 +345,39 @@ static struct dump_obj *create_dump_obj(uint32_t id, size_t size, rc =kobject_add (&dump->kobj,NULL ,"0x%x-0x%x" , type, id);if (rc) {kobject_put (&dump->kobj); -return NULL ; +return ; } +/* +* As soon as the sysfs file for this dump is created/activated there is +* a chance the opal_errd daemon (or any userspace) might read and +* acknowledge the dump before kobject_uevent() is called. If that +* happens then there is a potential race between +* dump_ack_store->kobject_put() and kobject_uevent() which leads to a +* use-after-free of a kernfs object resulting in a kernel crash. +* +* To avoid that, we need to take a reference on behalf of the bin file, +* so that our reference remains valid while we call kobject_uevent(). +* We then drop our reference before exiting the function, leaving the +* bin file to drop the last reference (if it hasn't already). +*/ + +/* Take a reference for the bin file */ +kobject_get (&dump->kobj); rc =sysfs_create_bin_file (&dump->kobj, &dump->dump_attr); -if (rc) { +if (rc ==0 ) { +kobject_uevent (&dump->kobj,KOBJ_ADD ); + +pr_info ("%s: New platform dump. ID = 0x%x Size %u\n" , + __func__, dump->id, dump->size); + }else { +/* Drop reference count taken for bin file */ kobject_put (&dump->kobj); -return NULL ; } -pr_info ("%s: New platform dump. ID = 0x%x Size %u\n" , - __func__, dump->id, dump->size); - -kobject_uevent (&dump->kobj,KOBJ_ADD ); - -return dump; +/* Drop our reference */ +kobject_put (&dump->kobj); +return ; }static irqreturn_t process_dump (int irq,void *data)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 630/757 powerpc/64s: Remove TM from Power10 features
In reply to Greg Kroah-HartmanFrom: Jordan Niethe <[email protected]>
[ Upstream commit ec613a57fa1d57381f890c3166175fe68cf43f12 ]
ISA v3.1 removes transactional memory and hence it should not be present in cpu_features or cpu_user_features2. Remove CPU_FTR_TM_COMP from CPU_FTRS_POWER10. Remove PPC_FEATURE2_HTM_COMP and PPC_FEATURE2_HTM_NOSC_COMP from COMMON_USER2_POWER10.
--- arch/powerpc/include/asm/cputable.h | 2 +- arch/powerpc/kernel/cputable.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/cputable.h +1 -1
@@ -483,7 +483,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ - CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \ + CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \ CPU_FTR_DAWR | CPU_FTR_DAWR1)#define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \ CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
arch/powerpc/kernel/cputable.c +10 -3
@@ -120,9 +120,16 @@ extern void __restore_cpu_e6500(void); PPC_FEATURE2_DARN | \ PPC_FEATURE2_SCV)#define COMMON_USER_POWER10 COMMON_USER_POWER9 -#define COMMON_USER2_POWER10 (COMMON_USER2_POWER9 | \ - PPC_FEATURE2_ARCH_3_1 | \ - PPC_FEATURE2_MMA) +#define COMMON_USER2_POWER10 (PPC_FEATURE2_ARCH_3_1 | \ + PPC_FEATURE2_MMA | \ + PPC_FEATURE2_ARCH_3_00 | \ + PPC_FEATURE2_HAS_IEEE128 | \ + PPC_FEATURE2_DARN | \ + PPC_FEATURE2_SCV | \ + PPC_FEATURE2_ARCH_2_07 | \ + PPC_FEATURE2_DSCR | \ + PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \ + PPC_FEATURE2_VEC_CRYPTO)#ifdef CONFIG_PPC_BOOK3E_64 #define COMMON_USER_BOOKE (COMMON_USER_PPC64 | PPC_FEATURE_BOOKE)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 631/757 powerpc/pseries: Avoid using addr_to_pfn in real mode
In reply to Greg Kroah-HartmanFrom: Ganesh Goudar <[email protected]>
[ Upstream commit 4ff753feab021242144818b9a3ba011238218145 ]
When an UE or memory error exception is encountered the MCE handler tries to find the pfn using addr_to_pfn() which takes effective address as an argument, later pfn is used to poison the page where memory error occurred, recent rework in this area made addr_to_pfn to run in real mode, which can be fatal as it may try to access memory outside RMO region.
Have two helper functions to separate things to be done in real mode and virtual mode without changing any functionality. This also fixes the following error as the use of addr_to_pfn is now moved to virtual mode.
Without this change following kernel crash is seen on hitting UE.
[ 485.128036] Oops: Kernel access of bad area, sig: 11 [#1] [ 485.128040] LE SMP NR_CPUS=2048 NUMA pSeries [ 485.128047] Modules linked in: [ 485.128067] CPU: 15 PID: 6536 Comm: insmod Kdump: loaded Tainted: G OE 5.7.0 #22 [ 485.128074] NIP: c00000000009b24c LR: c0000000000398d8 CTR: c000000000cd57c0 [ 485.128078] REGS: c000000003f1f970 TRAP: 0300 Tainted: G OE (5.7.0) [ 485.128082] MSR: 8000000000001003 <SF,ME,RI,LE> CR: 28008284 XER: 00000001 [ 485.128088] CFAR: c00000000009b190 DAR: c0000001fab00000 DSISR: 40000000 IRQMASK: 1 [ 485.128088] GPR00: 0000000000000001 c000000003f1fbf0 c000000001634300 0000b0fa01000000 [ 485.128088] GPR04: d000000002220000 0000000000000000 00000000fab00000 0000000000000022 [ 485.128088] GPR08: c0000001fab00000 0000000000000000 c0000001fab00000 c000000003f1fc14 [ 485.128088] GPR12: 0000000000000008 c000000003ff5880 d000000002100008 0000000000000000 [ 485.128088] GPR16: 000000000000ff20 000000000000fff1 000000000000fff2 d0000000021a1100 [ 485.128088] GPR20: d000000002200000 c00000015c893c50 c000000000d49b28 c00000015c893c50 [ 485.128088] GPR24: d0000000021a0d08 c0000000014e5da8 d0000000021a0818 000000000000000a [ 485.128088] GPR28: 0000000000000008 000000000000000a c0000000017e2970 000000000000000a [ 485.128125] NIP [c00000000009b24c] __find_linux_pte+0x11c/0x310 [ 485.128130] LR [c0000000000398d8] addr_to_pfn+0x138/0x170 [ 485.128133] Call Trace: [ 485.128135] Instruction dump: [ 485.128138] 3929ffff 7d4a3378 7c883c36 7d2907b4 794a1564 7d294038 794af082 3900ffff [ 485.128144] 79291f24 790af00e 78e70020 7d095214 <7c69502a> 2fa30000 419e011c 70690040 [ 485.128152] ---[ end trace d34b27e29ae0e340 ]---
--- arch/powerpc/platforms/pseries/ras.c | 118 ++++++++++++++++----------- 1 file changed, 69 insertions(+), 49 deletions(-)
arch/powerpc/platforms/pseries/ras.c +69 -49
@@ -521,18 +521,55 @@ int pSeries_system_reset_exception(struct pt_regs *regs)return 0 ;/* need to perform reset */ } +static int mce_handle_err_realmode (int disposition,u8 error_type) +{ +#ifdef CONFIG_PPC_BOOK3S_64 +if (disposition ==RTAS_DISP_NOT_RECOVERED ) { +switch (error_type) { +case MC_ERROR_TYPE_SLB : +case MC_ERROR_TYPE_ERAT : +/* +* Store the old slb content in paca before flushing. +* Print this when we go to virtual mode. +* There are chances that we may hit MCE again if there +* is a parity error on the SLB entry we trying to read +* for saving. Hence limit the slb saving to single +* level of recursion. +*/ +if (local_paca->in_mce ==1 ) +slb_save_contents (local_paca->mce_faulty_slbs); +flush_and_reload_slb (); + disposition =RTAS_DISP_FULLY_RECOVERED ; +break ; +default : +break ; + } + }else if (disposition ==RTAS_DISP_LIMITED_RECOVERY ) { +/* Platform corrected itself but could be degraded */ +pr_err ("MCE: limited recovery, system may be degraded\n" ); + disposition =RTAS_DISP_FULLY_RECOVERED ; + } +#endif +return disposition; +} -static int mce_handle_error (struct pt_regs *regs,struct rtas_error_log *errp) +static int mce_handle_err_virtmode (struct pt_regs *regs, +struct rtas_error_log *errp, +struct pseries_mc_errorlog *mce_log, +int disposition) {struct mce_error_info mce_err = {0 }; -unsigned long eaddr =0 , paddr =0 ; -struct pseries_errorlog *pseries_log; -struct pseries_mc_errorlog *mce_log; -int disposition =rtas_error_disposition (errp);int initiator =rtas_error_initiator (errp);int severity =rtas_error_severity (errp); +unsigned long eaddr =0 , paddr =0 ;u8 error_type, err_sub_type; +if (!mce_log) + goto out; + + error_type = mce_log->error_type; + err_sub_type =rtas_mc_error_sub_type (mce_log); +if (initiator ==RTAS_INITIATOR_UNKNOWN ) mce_err.initiator =MCE_INITIATOR_UNKNOWN ;else if (initiator ==RTAS_INITIATOR_CPU )
@@ -571,18 +608,7 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp) mce_err.error_type =MCE_ERROR_TYPE_UNKNOWN ; mce_err.error_class =MCE_ECLASS_UNKNOWN ; -if (!rtas_error_extended (errp)) - goto out; - - pseries_log =get_pseries_errorlog (errp,PSERIES_ELOG_SECT_ID_MCE ); -if (pseries_log ==NULL ) - goto out; - - mce_log = (struct pseries_mc_errorlog *)pseries_log->data; - error_type = mce_log->error_type; - err_sub_type =rtas_mc_error_sub_type (mce_log); - -switch (mce_log->error_type) { +switch (error_type) {case MC_ERROR_TYPE_UE : mce_err.error_type =MCE_ERROR_TYPE_UE ;mce_common_process_ue (regs, &mce_err);
@@ -682,37 +708,31 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp) mce_err.error_type =MCE_ERROR_TYPE_UNKNOWN ;break ; } +out: +save_mce_event (regs, disposition ==RTAS_DISP_FULLY_RECOVERED , + &mce_err, regs->nip, eaddr, paddr); +return disposition; +} -#ifdef CONFIG_PPC_BOOK3S_64 -if (disposition ==RTAS_DISP_NOT_RECOVERED ) { -switch (error_type) { -case MC_ERROR_TYPE_SLB : -case MC_ERROR_TYPE_ERAT : -/* -* Store the old slb content in paca before flushing. -* Print this when we go to virtual mode. -* There are chances that we may hit MCE again if there -* is a parity error on the SLB entry we trying to read -* for saving. Hence limit the slb saving to single -* level of recursion. -*/ -if (local_paca->in_mce ==1 ) -slb_save_contents (local_paca->mce_faulty_slbs); -flush_and_reload_slb (); - disposition =RTAS_DISP_FULLY_RECOVERED ; -break ; -default : -break ; - } - }else if (disposition ==RTAS_DISP_LIMITED_RECOVERY ) { -/* Platform corrected itself but could be degraded */ -printk (KERN_ERR "MCE: limited recovery, system may " -"be degraded\n" ); - disposition =RTAS_DISP_FULLY_RECOVERED ; - } -#endif +static int mce_handle_error (struct pt_regs *regs,struct rtas_error_log *errp) +{ +struct pseries_errorlog *pseries_log; +struct pseries_mc_errorlog *mce_log =NULL ; +int disposition =rtas_error_disposition (errp); +u8 error_type; + +if (!rtas_error_extended (errp)) + goto out; + + pseries_log =get_pseries_errorlog (errp,PSERIES_ELOG_SECT_ID_MCE ); +if (!pseries_log) + goto out; + + mce_log = (struct pseries_mc_errorlog *)pseries_log->data; + error_type = mce_log->error_type; + + disposition =mce_handle_err_realmode (disposition, error_type); -out:/* * Enable translation as we will be accessing per-cpu variables * in save_mce_event() which may fall outside RMO region, also
@@ -723,10 +743,10 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)* Note: All the realmode handling like flushing SLB entries for * SLB multihit is done by now. */ +out:mtmsr (mfmsr () |MSR_IR |MSR_DR ); -save_mce_event (regs, disposition ==RTAS_DISP_FULLY_RECOVERED , - &mce_err, regs->nip, eaddr, paddr); - + disposition =mce_handle_err_virtmode (regs, errp, mce_log, + disposition);return disposition; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 632/757 nvmet: fix uninitialized work for zero kato
In reply to Greg Kroah-HartmanFrom: zhenwei pi <[email protected]>
[ Upstream commit 85bd23f3dc09a2ae9e56885420e52c54bf983713 ]
When connecting a controller with a zero kato value using the following command line
nvme connect -t tcp -n NQN -a ADDR -s PORT --keep-alive-tmo=0
the warning below can be reproduced:
WARNING: CPU: 1 PID: 241 at kernel/workqueue.c:1627 __queue_delayed_work+0x6d/0x90 with trace: mod_delayed_work_on+0x59/0x90 nvmet_update_cc+0xee/0x100 [nvmet] nvmet_execute_prop_set+0x72/0x80 [nvmet] nvmet_tcp_try_recv_pdu+0x2f7/0x770 [nvmet_tcp] nvmet_tcp_io_work+0x63f/0xb2d [nvmet_tcp] ...
This is caused by queuing up an uninitialized work. Althrough the keep-alive timer is disabled during allocating the controller (fixed in 0d3b6a8d213a), ka_work still has a chance to run (called by nvmet_start_ctrl).
--- drivers/nvme/target/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/core.c +2 -1
@@ -1126,7 +1126,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)* in case a host died before it enabled the controller. Hence, simply * reset the keep alive timer when the controller is enabled. */ -mod_delayed_work (system_wq, &ctrl->ka_work, ctrl->kato *HZ ); +if (ctrl->kato) +mod_delayed_work (system_wq, &ctrl->ka_work, ctrl->kato *HZ ); }static void nvmet_clear_ctrl (struct nvmet_ctrl *ctrl)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 633/757 nvmet: limit passthru MTDS by BIO_MAX_PAGES
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit df06047d54276f73782c9d97882b305fca745d3f ]
nvmet_passthru_map_sg() only supports mapping a single BIO, not a chain so the effective maximum transfer should also be limitted by BIO_MAX_PAGES (presently this works out to 1MB).
For PCI passthru devices the max_sectors would typically be more limitting than BIO_MAX_PAGES, but this may not be true for all passthru devices.
--- drivers/nvme/target/passthru.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/nvme/target/passthru.c +8 -1
@@ -26,7 +26,7 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)struct nvme_ctrl *pctrl = ctrl->subsys->passthru_ctrl;u16 status =NVME_SC_SUCCESS ;struct nvme_id_ctrl *id; -u32 max_hw_sectors; +int max_hw_sectors;int page_shift; id =kzalloc (sizeof (*id),GFP_KERNEL );
@@ -48,6 +48,13 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req) max_hw_sectors =min_not_zero (pctrl->max_segments << (PAGE_SHIFT -9 ), pctrl->max_hw_sectors); +/* +* nvmet_passthru_map_sg is limitted to using a single bio so limit +* the mdts based on BIO_MAX_PAGES as well +*/ + max_hw_sectors =min_not_zero (BIO_MAX_PAGES << (PAGE_SHIFT -9 ), + max_hw_sectors); + page_shift =NVME_CAP_MPSMIN (ctrl->cap) +12 ; id->mdts =ilog2 (max_hw_sectors) +9 - page_shift;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 634/757 KVM: ioapic: break infinite recursion on lazy EOI
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 77377064c3a94911339f13ce113b3abf265e06da ]
During shutdown the IOAPIC trigger mode is reset to edge triggered while the vfio-pci INTx is still registered with a resampler. This allows us to get into an infinite loop:
ioapic_set_irq
-> ioapic_lazy_update_eoi
-> kvm_ioapic_update_eoi_one
-> kvm_notify_acked_irq
-> kvm_notify_acked_gsi
-> (via irq_acked fn ptr) irqfd_resampler_ack
-> kvm_set_irq
-> (via set fn ptr) kvm_set_ioapic_irq
-> kvm_ioapic_set_irq
-> ioapic_set_irq
Commit 8be8f932e3db ("kvm: ioapic: Restrict lazy EOI update to edge-triggered interrupts", 2020-05-04) acknowledges that this recursion loop exists and tries to avoid it at the call to ioapic_lazy_update_eoi, but at this point the scenario is already set, we have an edge interrupt with resampler on the same gsi.
Fortunately, the only user of irq ack notifiers (in addition to resamplefd) is i8254 timer interrupt reinjection. These are edge-triggered, so in principle they would need the call to kvm_ioapic_update_eoi_one from ioapic_lazy_update_eoi, but they already disable AVIC(*), so they don't need the lazy EOI behavior. Therefore, remove the call to kvm_ioapic_update_eoi_one from ioapic_lazy_update_eoi.
This fixes CVE-2020-27152. Note that this issue cannot happen with SR-IOV assigned devices because virtual functions do not have INTx, only MSI.
--- arch/x86/kvm/ioapic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/ioapic.c +1 -4
@@ -197,12 +197,9 @@ static void ioapic_lazy_update_eoi(struct kvm_ioapic *ioapic, int irq)/* * If no longer has pending EOI in LAPICs, update -* EOI for this vetor. +* EOI for this vector. */ rtc_irq_eoi (ioapic, vcpu, entry->fields.vector); -kvm_ioapic_update_eoi_one (vcpu, ioapic, - entry->fields.trig_mode, - irq);break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 635/757 NTB: hw: amd: fix an issue about leak system resources
In reply to Greg Kroah-HartmanFrom: Kaige Li <[email protected]>
[ Upstream commit 44a0a3c17919db1498cebb02ecf3cf4abc1ade7b ]
The related system resources were not released when pci_set_dma_mask(), pci_set_consistent_dma_mask(), or pci_iomap() return error in the amd_ntb_init_pci() function. Add pci_release_regions() to fix it.
--- drivers/ntb/hw/amd/ntb_hw_amd.c | 1 + 1 file changed, 1 insertion(+)
drivers/ntb/hw/amd/ntb_hw_amd.c +1 -0
@@ -1203,6 +1203,7 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev, err_dma_mask:pci_clear_master (pdev); +pci_release_regions (pdev); err_pci_regions:pci_disable_device (pdev); err_pci_enable:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 636/757 ntb: intel: Fix memleak in intel_ntb_pci_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dbb8df5c2d27610a87b0168a8acc89d73fbfde94 ]
The default error branch of a series of pdev_is_gen calls should free ndev just like what we've done in these calls.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1893,7 +1893,7 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev, goto err_init_dev; }else { rc = -EINVAL ; - goto err_ndev; + goto err_init_pci; }ndev_reset_unsafe_flags (ndev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 637/757 sched/features: Fix !CONFIG_JUMP_LABEL case
In reply to Greg Kroah-HartmanFrom: Juri Lelli <[email protected]>
[ Upstream commit a73f863af4ce9730795eab7097fb2102e6854365 ]
Commit:
765cc3a4b224e ("sched/core: Optimize sched_feat() for !CONFIG_SCHED_DEBUG builds")
made sched features static for !CONFIG_SCHED_DEBUG configurations, but overlooked the CONFIG_SCHED_DEBUG=y and !CONFIG_JUMP_LABEL cases.
For the latter echoing changes to /sys/kernel/debug/sched_features has the nasty effect of effectively changing what sched_features reports, but without actually changing the scheduler behaviour (since different translation units get different sysctl_sched_features).
Fix CONFIG_SCHED_DEBUG=y and !CONFIG_JUMP_LABEL configurations by properly restructuring ifdefs.
--- kernel/sched/core.c | 2 +- kernel/sched/sched.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
kernel/sched/core.c +1 -1
@@ -43,7 +43,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); -#if defined(CONFIG_SCHED_DEBUG ) && defined(CONFIG_JUMP_LABEL ) +#ifdef CONFIG_SCHED_DEBUG /* * Debugging: various feature bits *
kernel/sched/sched.h +10 -3
@@ -1629,7 +1629,7 @@ enum {#undef SCHED_FEAT -#if defined(CONFIG_SCHED_DEBUG ) && defined(CONFIG_JUMP_LABEL ) +#ifdef CONFIG_SCHED_DEBUG /* * To support run-time toggling of sched features, all the translation units
@@ -1637,6 +1637,7 @@ enum {*/ extern const_debug unsigned int sysctl_sched_features; +#ifdef CONFIG_JUMP_LABEL #define SCHED_FEAT (name, enabled) \ static __always_inline bool static_branch_##name(struct static_key *key) \ { \
@@ -1649,7 +1650,13 @@ static __always_inline bool static_branch_##name(struct static_key *key) \extern struct static_key sched_feat_keys[__SCHED_FEAT_NR];#define sched_feat (x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) -#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ +#else /* !CONFIG_JUMP_LABEL */ + +#define sched_feat (x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) + +#endif /* CONFIG_JUMP_LABEL */ + +#else /* !SCHED_DEBUG */ /* * Each translation unit has its own copy of sysctl_sched_features to allow
@@ -1665,7 +1672,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =#define sched_feat (x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) -#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ +#endif /* SCHED_DEBUG */ extern struct static_key_false sched_numa_balancing;extern struct static_key_false sched_schedstats;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 638/757 perf: correct SNOOPX field offset
In reply to Greg Kroah-HartmanFrom: Al Grant <[email protected]>
[ Upstream commit f3d301c1f2f5676465cdf3259737ea19cc82731f ]
perf_event.h has macros that define the field offsets in the data_src bitmask in perf records. The SNOOPX and REMOTE offsets were both 37. These are distinct fields, and the bitfield layout in perf_mem_data_src confirms that SNOOPX should be at offset 38.
--- include/uapi/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/perf_event.h +1 -1
@@ -1196,7 +1196,7 @@ union perf_mem_data_src {#define PERF_MEM_SNOOPX_FWD 0x01/* forward */ /* 1 free */ -#define PERF_MEM_SNOOPX_SHIFT 37 +#define PERF_MEM_SNOOPX_SHIFT 38/* locked instruction */ #define PERF_MEM_LOCK_NA 0x01/* not available */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 639/757 random32: make prandom_u32() output unpredictable
In reply to Greg Kroah-HartmanFrom: George Spelvin <[email protected]>
[ Upstream commit c51f8f88d705e06bd696d7510aff22b33eb8e638 ]
Non-cryptographic PRNGs may have great statistical properties, but are usually trivially predictable to someone who knows the algorithm, given a small sample of their output. An LFSR like prandom_u32() is particularly simple, even if the sample is widely scattered bits.
It turns out the network stack uses prandom_u32() for some things like random port numbers which it would prefer are *not* trivially predictable. Predictability led to a practical DNS spoofing attack. Oops.
This patch replaces the LFSR with a homebrew cryptographic PRNG based on the SipHash round function, which is in turn seeded with 128 bits of strong random key. (The authors of SipHash have *not* been consulted about this abuse of their algorithm.) Speed is prioritized over security; attacks are rare, while performance is always wanted.
Replacing all callers of prandom_u32() is the quick fix. Whether to reinstate a weaker PRNG for uses which can tolerate it is an open question.
Commit f227e3ec3b5c ("random32: update the net random state on interrupt and activity") was an earlier attempt at a solution. This patch replaces it.
[ willy: partial reversal of f227e3ec3b5c; moved SIPROUND definitions
to prandom.h for later use; merged George's prandom_seed() proposal; inlined siprand_u32(); replaced the net_rand_state[] array with 4 members to fix a build issue; cosmetic cleanups to make checkpatch happy; fixed RANDOM32_SELFTEST build ]
--- drivers/char/random.c | 1 - include/linux/prandom.h | 36 +++- kernel/time/timer.c | 7 - lib/random32.c | 464 ++++++++++++++++++++++++---------------- 4 files changed, 318 insertions(+), 190 deletions(-)
drivers/char/random.c +0 -1
@@ -1277,7 +1277,6 @@ void add_interrupt_randomness(int irq, int irq_flags)fast_mix (fast_pool);add_interrupt_bench (cycles); -this_cpu_add (net_rand_state.s1, fast_pool->pool[cycles &3 ]);if (unlikely (crng_init ==0 )) { if ((fast_pool->count >= 64) &&
include/linux/prandom.h +34 -2
@@ -16,12 +16,44 @@ void prandom_bytes(void *buf, size_t nbytes);void prandom_seed (u32 seed);void prandom_reseed_late (void ); +#if BITS_PER_LONG ==64 +/* +* The core SipHash round function. Each line can be executed in +* parallel given enough CPU resources. +*/ +#define PRND_SIPROUND (v0, v1, v2, v3) ( \ + v0 += v1, v1 = rol64(v1, 13), v2 += v3, v3 = rol64(v3, 16), \ + v1 ^= v0, v0 = rol64(v0, 32), v3 ^= v2, \ + v0 += v3, v3 = rol64(v3, 21), v2 += v1, v1 = rol64(v1, 17), \ + v3 ^= v0, v1 ^= v2, v2 = rol64(v2, 32) \ +) + +#define PRND_K0 (0x736f6d6570736575 ^ 0x6c7967656e657261) +#define PRND_K1 (0x646f72616e646f6d ^ 0x7465646279746573) + +#elif BITS_PER_LONG ==32 +/* +* On 32-bit machines, we use HSipHash, a reduced-width version of SipHash. +* This is weaker, but 32-bit machines are not used for high-traffic +* applications, so there is less output for an attacker to analyze. +*/ +#define PRND_SIPROUND (v0, v1, v2, v3) ( \ + v0 += v1, v1 = rol32(v1, 5), v2 += v3, v3 = rol32(v3, 8), \ + v1 ^= v0, v0 = rol32(v0, 16), v3 ^= v2, \ + v0 += v3, v3 = rol32(v3, 7), v2 += v1, v1 = rol32(v1, 13), \ + v3 ^= v0, v1 ^= v2, v2 = rol32(v2, 16) \ +) +#define PRND_K0 0x6c796765 +#define PRND_K1 0x74656462 + +#else +#error Unsupported BITS_PER_LONG +#endif +struct rnd_state {__u32 s1, s2, s3, s4; }; -DECLARE_PER_CPU(struct rnd_state, net_rand_state); -u32 prandom_u32_state (struct rnd_state *state);void prandom_bytes_state (struct rnd_state *state,void *buf,size_t nbytes);void prandom_seed_full_state (struct rnd_state __percpu *pcpu_state);
kernel/time/timer.c +0 -7
@@ -1715,13 +1715,6 @@ void update_process_times(int user_tick)scheduler_tick ();if (IS_ENABLED (CONFIG_POSIX_TIMERS ))run_posix_cpu_timers (); - -/* The current CPU might make use of net randoms without receiving IRQs -* to renew them often enough. Let's update the net_rand_state from a -* non-constant value that's not affine to the number of calls to make -* sure it's updated when there's some activity (we don't care in idle). -*/ -this_cpu_add (net_rand_state.s1,rol32 (jiffies,24 ) + user_tick); }/**
lib/random32.c +284 -180
505 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 5.9 639/757] random32: make prandom_u32() output unpredictable
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
From: George Spelvin <[email protected]>
[ Upstream commit
c51f8f88d705e06bd696d7510aff22b33eb8e638]Non-cryptographic PRNGs may have great statistical properties, but are usually trivially predictable to someone who knows the algorithm, given a small sample of their output. An LFSR like
prandom_u32()is particularly simple, even if the sample is widely scattered bits.
(...)
I'd have let it cook a bit longer into mainline before backporting it, first it's not small (a bit border line by stable rules), and second, considering how long we've been with the previous solution, there's no emergency anymore. The risks are essentially at the build level though (e.g. include hell on exotic architectures, or obscure driver trying to make use of one of the removed functions maybe).
On the other hand, given the amount of tests that run on the stable queue, we'll quickly know! So we can probably keep it for now, but do not hesitate to drop and postpone it if it causes any trouble so that we have time to investigate. I'd rather not go through the previous one's repeated breakage again!
Thanks,
Willy
A message that is not in the archive (sent off-list or not yet received): CANEQ_++-8QMfvLCQtFLOy8dF1LP_+UUOkRTG2y8Jn5bteS3B8Q@mail.gmail.com
Greg Kroah-Hartman
maintainerRe: [PATCH 5.9 639/757] random32: make prandom_u32() output unpredictable
Quoted 4 lines · Amit Klein
Dear all
Quick question: what's the plan for back-porting this security patch to LTS branches?
If you have working and tested backports, to older kernels, I'll be glad to accept them if you think they are needed.
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): CANEQ_+JcddE9SxzppH07A1ewvyjXHnsKUYpoYx=9Zk7gPe-Fxg@mail.gmail.com
Re: [PATCH 5.9 639/757] random32: make prandom_u32() output unpredictable
Quoted 3 lines · Amit Klein
Unfortunately, I'm just a security researcher, not a kernel developer...
Does that mean you don't plan to back-port the patch?
I could possibly have a look, but quite frankly I'm not convinced that we need to backport this at all. I think that what we've done is mostly to be future-proof and that the likelihood of practical attacks against live systems with the previous fix are close to zero.
Cheers,
Willy
Greg Kroah-Hartman
maintainerRe: [PATCH 5.9 639/757] random32: make prandom_u32() output unpredictable
In reply to a message not in the archiveQuoted 3 lines · Amit Klein
Unfortunately, I'm just a security researcher, not a kernel developer...
Does that mean you don't plan to back-port the patch?
At this point in time, unless someone else does the work for me, no, I do not, sorry. See Willy's response for why :)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 640/757 i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 8058d69905058ec8f467a120b5ec5bb831ea67f3 ]
Commit 21653a4181ff ("i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()")'s intention was to only move the acpi_install_address_space_handler() call to the point before where the ACPI declared i2c-children of the adapter where instantiated by i2c_acpi_register_devices().
But i2c_acpi_install_space_handler() had a call to acpi_walk_dep_device_list() hidden (that is I missed it) at the end of it, so as an unwanted side-effect now acpi_walk_dep_device_list() was also being called before i2c_acpi_register_devices().
Move the acpi_walk_dep_device_list() call to the end of i2c_acpi_register_devices(), so that it is once again called *after* the i2c_client-s hanging of the adapter have been created.
This fixes the Microsoft Surface Go 2 hanging at boot.
--- drivers/i2c/i2c-core-acpi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-acpi.c +10 -1
@@ -264,6 +264,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,void i2c_acpi_register_devices (struct i2c_adapter *adap) {acpi_status status; +acpi_handle handle;if (!has_acpi_companion (&adap->dev))return ;
@@ -274,6 +275,15 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap) adap, NULL);if (ACPI_FAILURE (status))dev_warn (&adap->dev,"failed to enumerate I2C slaves\n" ); + +if (!adap->dev.parent) +return ; + + handle =ACPI_HANDLE (adap->dev.parent); +if (!handle) +return ; + +acpi_walk_dep_device_list (handle); }static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
@@ -719,7 +729,6 @@ int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)return -ENOMEM ; } -acpi_walk_dep_device_list (handle);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 641/757 md/bitmap: fix memory leak of temporary bitmap
In reply to Greg Kroah-HartmanFrom: Zhao Heming <[email protected]>
[ Upstream commit 1383b347a8ae4a69c04ae3746e6cb5c8d38e2585 ]
Callers of get_bitmap_from_slot() are responsible to free the bitmap.
--- drivers/md/md-bitmap.c | 3 ++- drivers/md/md-cluster.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/md/md-bitmap.c +2 -1
@@ -1949,6 +1949,7 @@ int md_bitmap_load(struct mddev *mddev) }EXPORT_SYMBOL_GPL (md_bitmap_load); +/* caller need to free returned bitmap with md_bitmap_free() */ struct bitmap *get_bitmap_from_slot (struct mddev *mddev,int slot) {int rv =0 ;
@@ -2012,6 +2013,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,md_bitmap_unplug (mddev->bitmap); *low = lo; *high = hi; +md_bitmap_free (bitmap);return rv; }
@@ -2615,4 +2617,3 @@ struct attribute_group md_bitmap_group = { .name = "bitmap", .attrs = md_bitmap_attrs, }; -
drivers/md/md-cluster.c +1 -0
@@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz* can't resize bitmap */ goto out; +md_bitmap_free (bitmap); }return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 642/757 block: ratelimit handle_bad_sector() message
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit f4ac712e4fe009635344b9af5d890fe25fcc8c0d ]
syzbot is reporting unkillable task [1], for the caller is failing to handle a corrupted filesystem image which attempts to access beyond the end of the device. While we need to fix the caller, flooding the console with handle_bad_sector() message is unlikely useful.
[1] https://syzkaller.appspot.com/bug?id=f1f49fb971d7a3e01bd8ab8cff2ff4572ccf3092
--- block/blk-core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
block/blk-core.c +4 -5
@@ -803,11 +803,10 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector) {char b[BDEVNAME_SIZE ]; -printk (KERN_INFO "attempt to access beyond end of device\n" ); -printk (KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n" , -bio_devname (bio, b), bio->bi_opf, - (unsigned long long )bio_end_sector (bio), - (long long )maxsector); +pr_info_ratelimited ("attempt to access beyond end of device\n" +"%s: rw=%d, want=%llu, limit=%llu\n" , +bio_devname (bio, b), bio->bi_opf, +bio_end_sector (bio), maxsector); }#ifdef CONFIG_FAIL_MAKE_REQUEST
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 643/757 x86/dumpstack: Fix misleading instruction pointer error message
In reply to Greg Kroah-HartmanFrom: Mark Mossberg <[email protected]>
[ Upstream commit 238c91115cd05c71447ea071624a4c9fe661f970 ]
Printing "Bad RIP value" if copy_code() fails can be misleading for userspace pointers, since copy_code() can fail if the instruction pointer is valid but the code is paged out. This is because copy_code() calls copy_from_user_nmi() for userspace pointers, which disables page fault handling.
This is reproducible in OOM situations, where it's plausible that the code may be reclaimed in the time between entry into the kernel and when this message is printed. This leaves a misleading log in dmesg that suggests instruction pointer corruption has occurred, which may alarm users.
Change the message to state the error condition more precisely.
[ bp: Massage a bit. ]
--- arch/x86/kernel/dumpstack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/dumpstack.c +2 -1
@@ -115,7 +115,8 @@ void show_opcodes(struct pt_regs *regs, const char *loglvl)unsigned long prologue = regs->ip -PROLOGUE_SIZE ;if (copy_code (regs, opcodes, prologue,sizeof (opcodes))) { -printk ("%sCode: Bad RIP value.\n" , loglvl); +printk ("%sCode: Unable to access opcode bytes at RIP 0x%lx.\n" , + loglvl, prologue); }else { printk("%sCode: %" __stringify(PROLOGUE_SIZE) "ph <%02x> %" __stringify(EPILOGUE_SIZE) "ph\n", loglvl, opcodes,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 644/757 crypto: ccp - fix error handling
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit e356c49c6cf0db3f00e1558749170bd56e47652d ]
Fix resource leak in error handling.
--- drivers/crypto/ccp/ccp-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/ccp-ops.c +1 -1
@@ -1744,7 +1744,7 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)break ;default : ret = -EINVAL ; - goto e_ctx; + goto e_data; } }else {/* Stash the context */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 645/757 x86/asm: Replace __force_order with a memory clobber
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit aa5cacdc29d76a005cbbee018a47faa6e724dd2d ]
The CRn accessor functions use __force_order as a dummy operand to prevent the compiler from reordering CRn reads/writes with respect to each other.
The fact that the asm is volatile should be enough to prevent this:
volatile asm statements should be executed in program order. However GCC 4.9.x and 5.x have a bug that might result in reordering. This was fixed in 8.1, 7.3 and 6.5. Versions prior to these, including 5.x and 4.9.x, may reorder volatile asm statements with respect to each other.
There are some issues with __force_order as implemented:
- It is used only as an input operand for the write functions, and hence doesn't do anything additional to prevent reordering writes.
- It allows memory accesses to be cached/reordered across write functions, but CRn writes affect the semantics of memory accesses, so this could be dangerous.
- __force_order is not actually defined in the kernel proper, but the LLVM toolchain can in some cases require a definition: LLVM (as well as GCC 4.9) requires it for PIE code, which is why the compressed kernel has a definition, but also the clang integrated assembler may consider the address of __force_order to be significant, resulting in a reference that requires a definition.
Fix this by:
- Using a memory clobber for the write functions to additionally prevent caching/reordering memory accesses across CRn writes.
- Using a dummy input operand with an arbitrary constant address for the read functions, instead of a global variable. This will prevent reads from being reordered across writes, while allowing memory loads to be cached/reordered across CRn reads, which should be safe.
--- arch/x86/boot/compressed/pgtable_64.c | 9 --------- arch/x86/include/asm/special_insns.h | 28 ++++++++++++++------------- arch/x86/kernel/cpu/common.c | 4 ++-- 3 files changed, 17 insertions(+), 24 deletions(-)
arch/x86/boot/compressed/pgtable_64.c +0 -9
@@ -5,15 +5,6 @@#include "pgtable.h" #include "../string.h" -/* -* __force_order is used by special_insns.h asm code to force instruction -* serialization. -* -* It is not referenced from the code, but GCC < 5 with -fPIE would fail -* due to an undefined symbol. Define it to make these ancient GCCs work. -*/ -unsigned long __force_order; -#define BIOS_START_MIN 0x20000U/* 128K, less than this is insane */ #define BIOS_START_MAX 0x9f000U/* 640K, absolute maximum */
arch/x86/include/asm/special_insns.h +15 -13
@@ -11,45 +11,47 @@#include <linux/jump_label.h> /* -* Volatile isn't enough to prevent the compiler from reordering the -* read/write functions for the control registers and messing everything up. -* A memory clobber would solve the problem, but would prevent reordering of -* all loads stores around it, which can hurt performance. Solution is to -* use a variable and mimic reads and writes to it to enforce serialization +* The compiler should not reorder volatile asm statements with respect to each +* other: they should execute in program order. However GCC 4.9.x and 5.x have +* a bug (which was fixed in 8.1, 7.3 and 6.5) where they might reorder +* volatile asm. The write functions are not affected since they have memory +* clobbers preventing reordering. To prevent reads from being reordered with +* respect to writes, use a dummy memory operand. */ -extern unsigned long __force_order; + +#define __FORCE_ORDER "m"(*(unsigned int *)0x1000UL)void native_write_cr0 (unsigned long val);static inline unsigned long native_read_cr0 (void ) {unsigned long val; - asmvolatile ("mov %%cr0,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr0,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; }static __always_inline unsigned long native_read_cr2 (void ) {unsigned long val; - asmvolatile ("mov %%cr2,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr2,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; } static __always_inline void native_write_cr2(unsigned long val) { - asmvolatile ("mov %0,%%cr2" : :"r" (val),"m" (__force_order)); + asmvolatile ("mov %0,%%cr2" : :"r" (val) :"memory" ); }static inline unsigned long __native_read_cr3 (void ) {unsigned long val; - asmvolatile ("mov %%cr3,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr3,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; }static inline void native_write_cr3 (unsigned long val) { - asmvolatile ("mov %0,%%cr3" : :"r" (val),"m" (__force_order)); + asmvolatile ("mov %0,%%cr3" : :"r" (val) :"memory" ); }static inline unsigned long native_read_cr4 (void )
@@ -64,10 +66,10 @@ static inline unsigned long native_read_cr4(void) asm volatile("1: mov %%cr4, %0\n" "2:\n" _ASM_EXTABLE(1b, 2b) - : "=r" (val), "=m" (__force_order) : "0" (0)); + : "=r" (val) : "0" (0), __FORCE_ORDER); #else/* CR4 always exists on x86_64. */ - asmvolatile ("mov %%cr4,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr4,%0\n\t" : "=r" (val) : __FORCE_ORDER);#endif return val; }
arch/x86/kernel/cpu/common.c +2 -2
@@ -359,7 +359,7 @@ void native_write_cr0(unsigned long val)unsigned long bits_missing =0 ; set_register: - asmvolatile ("mov %0,%%cr0" :"+r" (val),"+m" (__force_order)); + asmvolatile ("mov %0,%%cr0" :"+r" (val) : :"memory" );if (static_branch_likely (&cr_pinning)) {if (unlikely ((val &X86_CR0_WP ) !=X86_CR0_WP )) {
@@ -378,7 +378,7 @@ void native_write_cr4(unsigned long val)unsigned long bits_changed =0 ; set_register: - asmvolatile ("mov %0,%%cr4" :"+r" (val),"+m" (cr4_pinned_bits)); + asmvolatile ("mov %0,%%cr4" :"+r" (val) : :"memory" );if (static_branch_likely (&cr_pinning)) {if (unlikely ((val & cr4_pinned_mask) != cr4_pinned_bits)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 646/757 x86/mce: Add Skylake quirk for patrol scrub reported errors
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit fd258dc4442c5c1c069c6b5b42bfe7d10cddda95 ]
The patrol scrubber in Skylake and Cascade Lake systems can be configured to report uncorrected errors using a special signature in the machine check bank and to signal using CMCI instead of machine check.
Update the severity calculation mechanism to allow specifying the model, minimum stepping and range of machine check bank numbers.
Add a new rule to detect the special signature (on model 0x55, stepping
Quoted 1 line
=4 in any of the memory controller banks).
[ bp: Rewrite it.
aegl: Productize it. ]
--- arch/x86/kernel/cpu/mce/severity.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mce/severity.c +26 -2
@@ -9,9 +9,11 @@#include <linux/seq_file.h> #include <linux/init.h> #include <linux/debugfs.h> -#include <asm/mce.h> #include <linux/uaccess.h> +#include <asm/mce.h> +#include <asm/intel-family.h> +#include "internal.h" /*
@@ -40,9 +42,14 @@ static struct severity {unsigned char context;unsigned char excp;unsigned char covered; +unsigned char cpu_model; +unsigned char cpu_minstepping; +unsigned char bank_lo, bank_hi;char *msg; } severities[] = { #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c } +#define BANK_RANGE (l, h) .bank_lo = l, .bank_hi = h +#define MODEL_STEPPING (m, s) .cpu_model = m, .cpu_minstepping = s#define KERNEL .context = IN_KERNEL#define USER .context = IN_USER#define KERNEL_RECOV .context = IN_KERNEL_RECOV
@@ -97,7 +104,6 @@ static struct severity {KEEP ,"Corrected error" ,NOSER ,BITCLR (MCI_STATUS_UC ) ), -/* * known AO MCACODs reported via MCE or CMC: *
@@ -113,6 +119,18 @@ static struct severity { AO, "Action optional: last level cache writeback error", SER, MASK(MCI_UC_AR|MCACOD, MCI_STATUS_UC|MCACOD_L3WB) ), +/* +* Quirk for Skylake/Cascade Lake. Patrol scrubber may be configured +* to report uncorrected errors using CMCI with a special signature. +* UC=0, MSCOD=0x0010, MCACOD=binary(000X 0000 1100 XXXX) reported +* in one of the memory controller banks. +* Set severity to "AO" for same action as normal patrol scrub error. +*/ +MCESEV ( +AO ,"Uncorrected Patrol Scrub Error" , +SER ,MASK (MCI_STATUS_UC |MCI_ADDR |0xffffeff0 ,MCI_ADDR |0x001000c0 ), +MODEL_STEPPING (INTEL_FAM6_SKYLAKE_X ,4 ),BANK_RANGE (13 ,18 ) + ),/* ignore OVER for UCNA */ MCESEV(
@@ -324,6 +342,12 @@ static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_econtinue ;if (s->excp && excp != s->excp)continue ; +if (s->cpu_model && boot_cpu_data.x86_model != s->cpu_model) +continue ; +if (s->cpu_minstepping && boot_cpu_data.x86_stepping < s->cpu_minstepping) +continue ; +if (s->bank_lo && (m->bank < s->bank_lo || m->bank > s->bank_hi)) +continue ;if (msg) *msg = s->msg; s->covered =1 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 647/757 media: firewire: fix memory leak
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit b28e32798c78a346788d412f1958f36bb760ec03 ]
Fix memory leak in node_probe.
--- drivers/media/firewire/firedtv-fw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/firewire/firedtv-fw.c +4 -2
@@ -272,8 +272,10 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) name_len =fw_csr_string (unit->directory,CSR_MODEL , name,sizeof (name)); -if (name_len <0 ) -return name_len; +if (name_len <0 ) { + err = name_len; + goto fail_free; + }for (i =ARRAY_SIZE (model_names); --i; )if (strlen (model_names[i]) <= name_len &&strncmp (name, model_names[i], name_len) ==0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 648/757 media: ati_remote: sanity check for both endpoints
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
[ Upstream commit a8be80053ea74bd9c3f9a3810e93b802236d6498 ]
If you do sanity checks, you should do them for both endpoints. Hence introduce checking for endpoint type for the output endpoint, too.
--- drivers/media/rc/ati_remote.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/rc/ati_remote.c +4 -0
@@ -835,6 +835,10 @@ static int ati_remote_probe(struct usb_interface *interface,err ("%s: endpoint_in message size==0? \n" , __func__);return -ENODEV ; } +if (!usb_endpoint_is_int_out (endpoint_out)) { +err ("%s: Unexpected endpoint_out\n" , __func__); +return -ENODEV ; + } ati_remote =kzalloc (sizeof (struct ati_remote ),GFP_KERNEL ); rc_dev =rc_allocate_device (RC_DRIVER_SCANCODE );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 649/757 media: st-delta: Fix reference count leak in delta_run_work
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 57cc666d36adc7b45e37ba4cd7bc4e44ec4c43d7 ]
delta_run_work() calls delta_get_sync() that increments the reference counter. In case of failure, decrement the reference count by calling delta_put_autosuspend().
--- drivers/media/platform/sti/delta/delta-v4l2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/sti/delta/delta-v4l2.c +3 -1
@@ -954,8 +954,10 @@ static void delta_run_work(struct work_struct *work)/* enable the hardware */ if (!dec->pm) { ret =delta_get_sync (ctx); -if (ret) +if (ret) { +delta_put_autosuspend (ctx); goto err; + } }/* decode this access unit */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 650/757 media: sti: Fix reference count leaks
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 6f4432bae9f2d12fc1815b5e26cc07e69bcad0df ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
--- drivers/media/platform/sti/hva/hva-hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/sti/hva/hva-hw.c +2 -0
@@ -272,6 +272,7 @@ static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva)if (pm_runtime_get_sync (dev) <0 ) {dev_err (dev,"%s failed to get pm_runtime\n" ,HVA_PREFIX ); +pm_runtime_put_noidle (dev);mutex_unlock (&hva->protect_mutex);return -EFAULT ; }
@@ -553,6 +554,7 @@ void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s)if (pm_runtime_get_sync (dev) <0 ) {seq_puts (s,"Cannot wake up IP\n" ); +pm_runtime_put_noidle (dev);mutex_unlock (&hva->protect_mutex);return ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 651/757 media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 7ef64ceea0008c17e94a8a2c60c5d6d46f481996 ]
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error.
--- drivers/media/platform/exynos4-is/fimc-isp.c | 4 +++- drivers/media/platform/exynos4-is/fimc-lite.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/exynos4-is/fimc-isp.c +3 -1
@@ -305,8 +305,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on)if (on) { ret =pm_runtime_get_sync (&is->pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (&is->pdev->dev);return ret; + }set_bit (IS_ST_PWR_ON , &is->state); ret =fimc_is_start_firmware (is);
drivers/media/platform/exynos4-is/fimc-lite.c +1 -1
@@ -471,7 +471,7 @@ static int fimc_lite_open(struct file *file)set_bit (ST_FLITE_IN_USE , &fimc->state); ret =pm_runtime_get_sync (&fimc->pdev->dev);if (ret <0 ) - goto unlock; + goto err_pm; ret =v4l2_fh_open (file);if (ret <0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 652/757 media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit c47f7c779ef0458a58583f00c9ed71b7f5a4d0a2 ]
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error.
--- drivers/media/platform/exynos4-is/media-dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/exynos4-is/media-dev.c +3 -1
@@ -484,8 +484,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)return -ENXIO ; ret =pm_runtime_get_sync (fmd->pmf); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (fmd->pmf);return ret; + } fmd->num_sensors =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 653/757 media: exynos4-is: Fix a reference count leak
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 64157b2cb1940449e7df2670e85781c690266588 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
--- drivers/media/platform/exynos4-is/mipi-csis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/exynos4-is/mipi-csis.c +3 -1
@@ -510,8 +510,10 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable)if (enable) {s5pcsis_clear_counters (state); ret =pm_runtime_get_sync (&state->pdev->dev); -if (ret && ret !=1 ) +if (ret && ret !=1 ) { +pm_runtime_put_noidle (&state->pdev->dev);return ret; + } }mutex_lock (&state->lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 654/757 media: vsp1: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 98fae901c8883640202802174a4bd70a1b9118bd ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/vsp1/vsp1_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/vsp1/vsp1_drv.c +8 -3
@@ -562,7 +562,12 @@ int vsp1_device_get(struct vsp1_device *vsp1)int ret; ret =pm_runtime_get_sync (vsp1->dev); -return ret <0 ? ret :0 ; +if (ret <0 ) { +pm_runtime_put_noidle (vsp1->dev); +return ret; + } + +return 0 ; }/*
@@ -845,12 +850,12 @@ static int vsp1_probe(struct platform_device *pdev)/* Configure device parameters based on the version register. */ pm_runtime_enable (&pdev->dev); - ret =pm_runtime_get_sync (&pdev->dev); + ret =vsp1_device_get (vsp1);if (ret <0 ) goto done; vsp1->version =vsp1_read (vsp1,VI6_IP_VERSION ); -pm_runtime_put_sync (&pdev->dev); +vsp1_device_put (vsp1);for (i =0 ; i <ARRAY_SIZE (vsp1_device_infos); ++i) { if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) ==
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 655/757 media: platform: s3c-camif: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dafa3605fe60d5a61239d670919b2a36e712481e ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
Also, call pm_runtime_disable() when pm_runtime_get_sync() returns an error code.
--- drivers/media/platform/s3c-camif/camif-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/platform/s3c-camif/camif-core.c +2 -3
@@ -464,7 +464,7 @@ static int s3c_camif_probe(struct platform_device *pdev) ret =camif_media_dev_init (camif);if (ret <0 ) - goto err_alloc; + goto err_pm; ret =camif_register_sensor (camif);if (ret <0 )
@@ -498,10 +498,9 @@ static int s3c_camif_probe(struct platform_device *pdev)media_device_unregister (&camif->media_dev);media_device_cleanup (&camif->media_dev);camif_unregister_media_entities (camif); -err_alloc: +err_pm:pm_runtime_put (dev);pm_runtime_disable (dev); -err_pm:camif_clk_put (camif); err_clk:s3c_camif_unregister_subdev (camif);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 656/757 media: platform: sti: hva: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d912a1d9e9afe69c6066c1ceb6bfc09063074075 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/sti/hva/hva-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sti/hva/hva-hw.c +1 -1
@@ -389,7 +389,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) ret =pm_runtime_get_sync (dev);if (ret <0 ) {dev_err (dev,"%s failed to set PM\n" ,HVA_PREFIX ); - goto err_clk; + goto err_pm; }/* check IP hardware version */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 657/757 media: bdisp: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dbd2f2dc025f9be8ae063e4f270099677238f620 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +1 -2
@@ -1371,7 +1371,7 @@ static int bdisp_probe(struct platform_device *pdev) ret =pm_runtime_get_sync (dev);if (ret <0 ) {dev_err (dev,"failed to set PM\n" ); - goto err_dbg; + goto err_pm; }/* Filters */
@@ -1399,7 +1399,6 @@ static int bdisp_probe(struct platform_device *pdev)bdisp_hw_free_filters (bdisp->dev); err_pm:pm_runtime_put (dev); -err_dbg:bdisp_debugfs_remove (bdisp); err_v4l2:v4l2_device_unregister (&bdisp->v4l2_dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 658/757 media: media/pci: prevent memory leak in bttv_probe
In reply to Greg Kroah-HartmanFrom: Xiaolong Huang <[email protected]>
[ Upstream commit 7b817585b730665126b45df5508dd69526448bc8 ]
In bttv_probe if some functions such as pci_enable_device, pci_set_dma_mask and request_mem_region fails the allocated
memory for btv should be released.
--- drivers/media/pci/bt8xx/bttv-driver.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/media/pci/bt8xx/bttv-driver.c +10 -3
@@ -4013,11 +4013,13 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) btv->id = dev->device;if (pci_enable_device (dev)) {pr_warn ("%d: Can't enable device\n" , btv->c.nr); -return -EIO ; + result = -EIO ; + goto free_mem; }if (pci_set_dma_mask (dev,DMA_BIT_MASK (32 ))) {pr_warn ("%d: No suitable DMA available\n" , btv->c.nr); -return -EIO ; + result = -EIO ; + goto free_mem; } if (!request_mem_region(pci_resource_start(dev,0), pci_resource_len(dev,0),
@@ -4025,7 +4027,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)pr_warn ("%d: can't request iomem (0x%llx)\n" , btv->c.nr, (unsigned long long )pci_resource_start (dev,0 )); -return -EBUSY ; + result = -EBUSY ; + goto free_mem; }pci_set_master (dev);pci_set_command (dev);
@@ -4211,6 +4214,10 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)release_mem_region (pci_resource_start (btv->c.pci,0 ),pci_resource_len (btv->c.pci,0 ));pci_disable_device (btv->c.pci); + +free_mem: + bttvs[btv->c.nr] =NULL ; +kfree (btv);return result; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 659/757 x86/mce: Annotate mce_rd/wrmsrl() with noinstr
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit e100777016fdf6ec3a9d7c1773b15a2b5eca6c55 ]
They do get called from the #MC handler which is already marked "noinstr".
Commit
e2def7d49d08 ("x86/mce: Make mce_rdmsrl() panic on an inaccessible MSR")
already got rid of the instrumentation in the MSR accessors, fix the annotation now too, in order to get rid of:
vmlinux.o: warning: objtool: do_machine_check()+0x4a: call to mce_rdmsrl() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mce/core.c +21 -6
@@ -374,16 +374,25 @@ static int msr_to_offset(u32 msr) }/* MSR access wrappers used for error injection */ -static u64 mce_rdmsrl (u32 msr) +static noinstr u64 mce_rdmsrl(u32 msr) {u64 v;if (__this_cpu_read (injectm.finished)) { -int offset =msr_to_offset (msr); +int offset; +u64 ret; +instrumentation_begin (); + + offset =msr_to_offset (msr);if (offset <0 ) -return 0 ; -return *(u64 *)((char *)this_cpu_ptr (&injectm) + offset); + ret =0 ; +else + ret = *(u64 *)((char *)this_cpu_ptr (&injectm) + offset); + +instrumentation_end (); + +return ret; }if (rdmsrl_safe (msr, &v)) {
@@ -399,13 +408,19 @@ static u64 mce_rdmsrl(u32 msr)return v; } -static void mce_wrmsrl (u32 msr,u64 v) +static noinstr void mce_wrmsrl(u32 msr, u64 v) {if (__this_cpu_read (injectm.finished)) { -int offset =msr_to_offset (msr); +int offset; +instrumentation_begin (); + + offset =msr_to_offset (msr);if (offset >=0 ) *(u64 *)((char *)this_cpu_ptr (&injectm) + offset) = v; + +instrumentation_end (); +return ; }wrmsrl (msr, v);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 660/757 crypto: hisilicon - fixed memory allocation error
In reply to Greg Kroah-HartmanFrom: Longfang Liu <[email protected]>
[ Upstream commit 24efcec2919afa7d56f848c83a605b46c8042a53 ]
1. Fix the bug of 'mac' memory leak as allocating 'pbuf' failing.
2. Fix the bug of 'qps' leak as allocating 'qp_ctx' failing.
--- drivers/crypto/hisilicon/sec2/sec_crypto.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/crypto/hisilicon/sec2/sec_crypto.c +12 -4
@@ -342,11 +342,14 @@ static int sec_alg_resource_alloc(struct sec_ctx *ctx, ret =sec_alloc_pbuf_resource (dev, res);if (ret) {dev_err (dev,"fail to alloc pbuf dma resource!\n" ); - goto alloc_fail; + goto alloc_pbuf_fail; } }return 0 ; +alloc_pbuf_fail: +if (ctx->alg_type ==SEC_AEAD ) +sec_free_mac_resource (dev, qp_ctx->res); alloc_fail:sec_free_civ_resource (dev, res);
@@ -457,8 +460,10 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) ctx->fake_req_limit =QM_Q_DEPTH >>1 ; ctx->qp_ctx =kcalloc (sec->ctx_q_num,sizeof (struct sec_qp_ctx ),GFP_KERNEL ); -if (!ctx->qp_ctx) -return -ENOMEM ; +if (!ctx->qp_ctx) { + ret = -ENOMEM ; + goto err_destroy_qps; + }for (i =0 ; i < sec->ctx_q_num; i++) { ret =sec_create_qp_ctx (&sec->qm, ctx, i,0 );
@@ -467,12 +472,15 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) }return 0 ; + err_sec_release_qp_ctx:for (i = i -1 ; i >=0 ; i--)sec_release_qp_ctx (ctx, &ctx->qp_ctx[i]); -sec_destroy_qps (ctx->qps, sec->ctx_q_num);kfree (ctx->qp_ctx); +err_destroy_qps: +sec_destroy_qps (ctx->qps, sec->ctx_q_num); +return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 661/757 spi: fsi: Fix clock running too fast
In reply to Greg Kroah-HartmanFrom: Brad Bishop <[email protected]>
[ Upstream commit 0b546bbe9474ff23e6843916ad6d567f703b2396 ]
Use a clock divider tuned to a 200MHz FSI bus frequency (the maximum). Use of the previous divider at 200MHz results in corrupt data from endpoint devices. Ideally the clock divider would be calculated from the FSI clock, but that would require some significant work on the FSI driver. With FSI frequencies slower than 200MHz, the SPI clock will simply run slower, but safely.
--- drivers/spi/spi-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsi.c +1 -1
@@ -403,7 +403,7 @@ static int fsi_spi_transfer_init(struct fsi_spi *ctx)u64 status =0ULL ;u64 wanted_clock_cfg =SPI_FSI_CLOCK_CFG_ECC_DISABLE |SPI_FSI_CLOCK_CFG_SCK_NO_DEL | -FIELD_PREP (SPI_FSI_CLOCK_CFG_SCK_DIV ,4 ); +FIELD_PREP (SPI_FSI_CLOCK_CFG_SCK_DIV ,19 ); end = jiffies +msecs_to_jiffies (SPI_FSI_INIT_TIMEOUT_MS ); do {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 662/757 blk-mq: always allow reserved allocation in hctx_may_queue
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 285008501c65a3fcee05d2c2c26cbf629ceff2f0 ]
NVMe shares tagset between fabric queue and admin queue or between connect_q and NS queue, so hctx_may_queue() can be called to allocate request for these queues.
Tags can be reserved in these tagset. Before error recovery, there is often lots of in-flight requests which can't be completed, and new reserved request may be needed in error recovery path. However, hctx_may_queue() can always return false because there is too many in-flight requests which can't be completed during error handling. Finally, nothing can proceed.
Fix this issue by always allowing reserved tag allocation in hctx_may_queue(). This is reasonable because reserved tags are supposed to always be available.
--- block/blk-mq-tag.c | 3 ++- block/blk-mq.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)
block/blk-mq-tag.c +2 -1
@@ -59,7 +59,8 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)static int __blk_mq_get_tag (struct blk_mq_alloc_data *data,struct sbitmap_queue *bt) { -if (!data->q->elevator && !hctx_may_queue (data->hctx, bt)) +if (!data->q->elevator && !(data->flags &BLK_MQ_REQ_RESERVED ) && + !hctx_may_queue (data->hctx, bt))return BLK_MQ_NO_TAG ;if (data->shallow_depth)
block/blk-mq.c +3 -2
@@ -1105,10 +1105,11 @@ static bool __blk_mq_get_driver_tag(struct request *rq)if (blk_mq_tag_is_reserved (rq->mq_hctx->sched_tags, rq->internal_tag)) { bt = &rq->mq_hctx->tags->breserved_tags; tag_offset =0 ; + }else { +if (!hctx_may_queue (rq->mq_hctx, bt)) +return false; } -if (!hctx_may_queue (rq->mq_hctx, bt)) -return false; tag =__sbitmap_queue_get (bt);if (tag ==BLK_MQ_NO_TAG )return false;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 663/757 x86/mce: Make mce_rdmsrl() panic on an inaccessible MSR
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit e2def7d49d0812ea40a224161b2001b2e815dce2 ]
If an exception needs to be handled while reading an MSR - which is in most of the cases caused by a #GP on a non-existent MSR - then this is most likely the incarnation of a BIOS or a hardware bug. Such bug violates the architectural guarantee that MCA banks are present with all MSRs belonging to them.
The proper fix belongs in the hardware/firmware - not in the kernel.
Handling an #MC exception which is raised while an NMI is being handled would cause the nasty NMI nesting issue because of the shortcoming of IRET of reenabling NMIs when executed. And the machine is in an #MC context already so <Deity> be at its side.
Tracing MSR accesses while in #MC is another no-no due to tracing being inherently a bad idea in atomic context:
vmlinux.o: warning: objtool: do_machine_check()+0x4a: call to mce_rdmsrl() leaves .noinstr.text section
so remove all that "additional" functionality from mce_rdmsrl() and provide it with a special exception handler which panics the machine when that MSR is not accessible.
The exception handler prints a human-readable message explaining what the panic reason is but, what is more, it panics while in the #GP handler and latter won't have executed an IRET, thus opening the NMI nesting issue in the case when the #MC has happened while handling an NMI. (#MC itself won't be reenabled until MCG_STATUS hasn't been cleared).
--- arch/x86/kernel/cpu/mce/core.c | 72 +++++++++++++++++++++++++----- arch/x86/kernel/cpu/mce/internal.h | 10 +++++ 2 files changed, 70 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/mce/core.c +60 -12
@@ -373,10 +373,28 @@ static int msr_to_offset(u32 msr)return -1 ; } +__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr) +{ +pr_emerg ("MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\n" , + (unsigned int )regs->cx, regs->ip, (void *)regs->ip); + +show_stack_regs (regs); + +panic ("MCA architectural violation!\n" ); + +while (true) +cpu_relax (); + +return true; +} +/* MSR access wrappers used for error injection */ static noinstr u64 mce_rdmsrl(u32 msr) { -u64 v; +DECLARE_ARGS (val, low, high);if (__this_cpu_read (injectm.finished)) {int offset;
@@ -395,21 +413,43 @@ static noinstr u64 mce_rdmsrl(u32 msr)return ret; } -if (rdmsrl_safe (msr, &v)) { -WARN_ONCE (1 ,"mce: Unable to read MSR 0x%x!\n" , msr); -/* -* Return zero in case the access faulted. This should -* not happen normally but can happen if the CPU does -* something weird, or if the code is buggy. -*/ - v =0 ; - } +/* +* RDMSR on MCA MSRs should not fault. If they do, this is very much an +* architectural violation and needs to be reported to hw vendor. Panic +* the box to not allow any further progress. +*/ + asm volatile("1: rdmsr\n" + "2:\n" + _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_fault) + : EAX_EDX_RET(val, low, high) : "c" (msr)); -return v; + +return EAX_EDX_VAL (val, low, high); +} + +__visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr) +{ +pr_emerg ("MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\n" , + (unsigned int )regs->cx, (unsigned int )regs->dx, (unsigned int )regs->ax, + regs->ip, (void *)regs->ip); + +show_stack_regs (regs); + +panic ("MCA architectural violation!\n" ); + +while (true) +cpu_relax (); + +return true; } static noinstr void mce_wrmsrl(u32 msr, u64 v) { +u32 low, high; +if (__this_cpu_read (injectm.finished)) {int offset;
@@ -423,7 +463,15 @@ static noinstr void mce_wrmsrl(u32 msr, u64 v)return ; } -wrmsrl (msr, v); + + low = (u32 )v; + high = (u32)(v >>32 ); + +/* See comment in mce_rdmsrl() */ + asm volatile("1: wrmsr\n" + "2:\n" + _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_wrmsr_fault) + : : "c" (msr), "a"(low), "d" (high) : "memory"); }/*
arch/x86/kernel/cpu/mce/internal.h +10 -0
@@ -185,4 +185,14 @@ extern bool amd_filter_mce(struct mce *m);static inline bool amd_filter_mce (struct mce *m) {return false; };#endif +__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr); + +__visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr); +#endif /* __X86_MCE_INTERNAL_H__ */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 664/757 media: uvcvideo: Ensure all probed info is returned to v4l2
In reply to Greg Kroah-HartmanFrom: Adam Goode <[email protected]>
[ Upstream commit 8a652a17e3c005dcdae31b6c8fdf14382a29cbbe ]
bFrameIndex and bFormatIndex can be negotiated by the camera during probing, resulting in the camera choosing a different format than expected. v4l2 can already accommodate such changes, but the code was not updating the proper fields.
Without such a change, v4l2 would potentially interpret the payload incorrectly, causing corrupted output. This was happening on the Elgato HD60 S+, which currently always renegotiates to format 1.
As an aside, the Elgato firmware is buggy and should not be renegotating, but it is still a valid thing for the camera to do. Both macOS and Windows will properly probe and read uncorrupted images from this camera.
With this change, both qv4l2 and chromium can now read uncorrupted video from the Elgato HD60 S+.
[Add blank lines, remove periods at the of messages]
--- drivers/media/usb/uvc/uvc_v4l2.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/media/usb/uvc/uvc_v4l2.c +30 -0
@@ -247,11 +247,41 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,if (ret <0 ) goto done; +/* After the probe, update fmt with the values returned from +* negotiation with the device. +*/ +for (i =0 ; i < stream->nformats; ++i) { +if (probe->bFormatIndex == stream->format[i].index) { + format = &stream->format[i]; +break ; + } + } + +if (i == stream->nformats) { +uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFormatIndex %u\n" , + probe->bFormatIndex); +return -EINVAL ; + } + +for (i =0 ; i < format->nframes; ++i) { +if (probe->bFrameIndex == format->frame[i].bFrameIndex) { + frame = &format->frame[i]; +break ; + } + } + +if (i == format->nframes) { +uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFrameIndex %u\n" , + probe->bFrameIndex); +return -EINVAL ; + } + fmt->fmt.pix.width = frame->wWidth; fmt->fmt.pix.height = frame->wHeight; fmt->fmt.pix.field =V4L2_FIELD_NONE ; fmt->fmt.pix.bytesperline =uvc_v4l2_get_bytesperline (format, frame); fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize; + fmt->fmt.pix.pixelformat = format->fcc; fmt->fmt.pix.colorspace = format->colorspace;if (uvc_format !=NULL )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 665/757 mmc: sdio: Check for CISTPL_VERS_1 buffer size
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 8ebe2607965d3e2dc02029e8c7dd35fbe508ffd0 ]
Before parsing CISTPL_VERS_1 structure check that its size is at least two bytes to prevent buffer overflow.
--- drivers/mmc/core/sdio_cis.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/core/sdio_cis.c +3 -0
@@ -26,6 +26,9 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func,unsigned i, nr_strings;char **buffer, *string; +if (size <2 ) +return 0 ; +/* Find all null-terminated (including zero length) strings in the TPLLV1_INFO field. Trailing garbage is ignored. */ buf +=2 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 666/757 media: saa7134: avoid a shift overflow
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 15a36aae1ec1c1f17149b6113b92631791830740 ]
As reported by smatch:
drivers/media/pci/saa7134//saa7134-tvaudio.c:686 saa_dsp_writel() warn: should 'reg << 2' be a 64 bit type?
On a 64-bits Kernel, the shift might be bigger than 32 bits.
In real, this should never happen, but let's shut up the warning.
--- drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/saa7134/saa7134-tvaudio.c +2 -1
@@ -683,7 +683,8 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) {int err; -audio_dbg (2 ,"dsp write reg 0x%x = 0x%06x\n" , reg <<2 , value); +audio_dbg (2 ,"dsp write reg 0x%x = 0x%06x\n" , + (reg <<2 ) &0xffffffff , value); err =saa_dsp_wait_bit (dev,SAA7135_DSP_RWSTATE_WRR );if (err <0 )return err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 667/757 media: atomisp: fix memleak in ia_css_stream_create
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit c1bca5b5ced0cbd779d56f60cdbc9f5e6f6449fe ]
When aspect_ratio_crop_init() fails, curr_stream needs to be freed just like what we've done in the following error paths. However, current code is returning directly and ends up leaking memory.
--- drivers/staging/media/atomisp/pci/sh_css.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/sh_css.c +1 -1
@@ -9521,7 +9521,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,if (err) {IA_CSS_LEAVE_ERR (err); -return err; + goto ERR; }#endif for (i =0 ; i < num_pipes; i++)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 668/757 media: venus: fixes for list corruption
In reply to Greg Kroah-HartmanFrom: Vikash Garodia <[email protected]>
[ Upstream commit e1c69c4eef61ffe295b747992c6fd849e6cd747d ]
There are few list handling issues while adding and deleting node in the registered buf list in the driver.
1. list addition - buffer added into the list during buf_init while not deleted during cleanup.
2. list deletion - In capture streamoff, the list was reinitialized. As a result, if any node was present in the list, it would lead to issue while cleaning up that node during buf_cleanup.
Corresponding call traces below:
[ 165.751014] Call trace: [ 165.753541] __list_add_valid+0x58/0x88 [ 165.757532] venus_helper_vb2_buf_init+0x74/0xa8 [venus_core] [ 165.763450] vdec_buf_init+0x34/0xb4 [venus_dec] [ 165.768271] __buf_prepare+0x598/0x8a0 [videobuf2_common] [ 165.773820] vb2_core_qbuf+0xb4/0x334 [videobuf2_common] [ 165.779298] vb2_qbuf+0x78/0xb8 [videobuf2_v4l2] [ 165.784053] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] [ 165.789067] v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem] [ 165.794624] v4l_qbuf+0x48/0x58
[ 1797.556001] Call trace: [ 1797.558516] __list_del_entry_valid+0x88/0x9c [ 1797.562989] vdec_buf_cleanup+0x54/0x228 [venus_dec] [ 1797.568088] __buf_prepare+0x270/0x8a0 [videobuf2_common] [ 1797.573625] vb2_core_qbuf+0xb4/0x338 [videobuf2_common] [ 1797.579082] vb2_qbuf+0x78/0xb8 [videobuf2_v4l2] [ 1797.583830] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] [ 1797.588843] v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem] [ 1797.594389] v4l_qbuf+0x48/0x58
--- drivers/media/platform/qcom/venus/vdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +8 -2
@@ -1088,8 +1088,6 @@ static int vdec_stop_capture(struct venus_inst *inst)break ; } -INIT_LIST_HEAD (&inst->registeredbufs); -return ret; }
@@ -1189,6 +1187,14 @@ static int vdec_buf_init(struct vb2_buffer *vb)static void vdec_buf_cleanup (struct vb2_buffer *vb) {struct venus_inst *inst =vb2_get_drv_priv (vb->vb2_queue); +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct venus_buffer *buf =to_venus_buffer (vbuf); + +mutex_lock (&inst->lock); +if (vb->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) +if (!list_empty (&inst->registeredbufs)) +list_del_init (&buf->reg_list); +mutex_unlock (&inst->lock); inst->buf_count--;if (!inst->buf_count)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 669/757 notifier: Fix broken error handling pattern
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 70d932985757fbe978024db313001218e9f8fe5c ]
The current notifiers have the following error handling pattern all over the place:
int err, nr; err = __foo_notifier_call_chain(&chain, val_up, v, -1, &nr); if (err & NOTIFIER_STOP_MASK) __foo_notifier_call_chain(&chain, val_down, v, nr-1, NULL)
And aside from the endless repetition thereof, it is broken. Consider blocking notifiers; both calls take and drop the rwsem, this means that the notifier list can change in between the two calls, making @nr meaningless.
Fix this by replacing all the __foo_notifier_call_chain() functions with foo_notifier_call_chain_robust() that embeds the above pattern, but ensures it is inside a single lock region.
Note: I switched atomic_notifier_call_chain_robust() to use
the spinlock, since RCU cannot provide the guarantee required for the recovery.
Note: software_resume() error handling was broken afaict.
--- include/linux/notifier.h | 15 ++- kernel/cpu_pm.c | 48 ++++------ kernel/notifier.c | 144 ++++++++++++++++++----------- kernel/power/hibernate.c | 39 ++++---- kernel/power/main.c | 8 +- kernel/power/power.h | 3 +- kernel/power/suspend.c | 14 ++- kernel/power/user.c | 14 +-- tools/power/pm-graph/sleepgraph.py | 2 +- 9 files changed, 147 insertions(+), 140 deletions(-)
include/linux/notifier.h +7 -8
@@ -161,20 +161,19 @@ extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh,extern int atomic_notifier_call_chain (struct atomic_notifier_head *nh,unsigned long val,void *v); -extern int __atomic_notifier_call_chain (struct atomic_notifier_head *nh, -unsigned long val,void *v,int nr_to_call,int *nr_calls);extern int blocking_notifier_call_chain (struct blocking_notifier_head *nh,unsigned long val,void *v); -extern int __blocking_notifier_call_chain (struct blocking_notifier_head *nh, -unsigned long val,void *v,int nr_to_call,int *nr_calls);extern int raw_notifier_call_chain (struct raw_notifier_head *nh,unsigned long val,void *v); -extern int __raw_notifier_call_chain (struct raw_notifier_head *nh, -unsigned long val,void *v,int nr_to_call,int *nr_calls);extern int srcu_notifier_call_chain (struct srcu_notifier_head *nh,unsigned long val,void *v); -extern int __srcu_notifier_call_chain (struct srcu_notifier_head *nh, -unsigned long val,void *v,int nr_to_call,int *nr_calls); + +extern int atomic_notifier_call_chain_robust (struct atomic_notifier_head *nh, +unsigned long val_up,unsigned long val_down,void *v); +extern int blocking_notifier_call_chain_robust (struct blocking_notifier_head *nh, +unsigned long val_up,unsigned long val_down,void *v); +extern int raw_notifier_call_chain_robust (struct raw_notifier_head *nh, +unsigned long val_up,unsigned long val_down,void *v);#define NOTIFY_DONE 0x0000/* Don't care */ #define NOTIFY_OK 0x0001/* Suits me */
kernel/cpu_pm.c +18 -30
86 lines not on this page · raw message
kernel/notifier.c +88 -56
240 lines not on this page · raw message
kernel/power/hibernate.c +18 -21
@@ -706,8 +706,8 @@ static int load_image_and_restore(void)*/ int hibernate (void ) { -int error, nr_calls =0 ;bool snapshot_test = false; +int error;if (!hibernation_available ()) {pm_pr_dbg ("Hibernation not available.\n" );
@@ -723,11 +723,9 @@ int hibernate(void)pr_info ("hibernation entry\n" );pm_prepare_console (); - error =__pm_notifier_call_chain (PM_HIBERNATION_PREPARE ,-1 , &nr_calls); -if (error) { - nr_calls--; - goto Exit; - } + error =pm_notifier_call_chain_robust (PM_HIBERNATION_PREPARE ,PM_POST_HIBERNATION ); +if (error) + goto Restore;ksys_sync_helper ();
@@ -785,7 +783,8 @@ int hibernate(void)/* Don't bother checking whether freezer_test_done is true */ freezer_test_done = false; Exit: -__pm_notifier_call_chain (PM_POST_HIBERNATION , nr_calls,NULL ); +pm_notifier_call_chain (PM_POST_HIBERNATION ); + Restore:pm_restore_console ();hibernate_release (); Unlock:
@@ -804,7 +803,7 @@ int hibernate(void)*/ int hibernate_quiet_exec (int (*func)(void *data),void *data) { -int error, nr_calls =0 ; +int error;lock_system_sleep ();
@@ -815,11 +814,9 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data)pm_prepare_console (); - error =__pm_notifier_call_chain (PM_HIBERNATION_PREPARE ,-1 , &nr_calls); -if (error) { - nr_calls--; - goto exit; - } + error =pm_notifier_call_chain_robust (PM_HIBERNATION_PREPARE ,PM_POST_HIBERNATION ); +if (error) + goto restore; error =freeze_processes ();if (error)
@@ -880,8 +877,9 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data)thaw_processes (); exit: -__pm_notifier_call_chain (PM_POST_HIBERNATION , nr_calls,NULL ); +pm_notifier_call_chain (PM_POST_HIBERNATION ); +restore:pm_restore_console ();hibernate_release ();
@@ -910,7 +908,7 @@ EXPORT_SYMBOL_GPL(hibernate_quiet_exec);*/ static int software_resume (void ) { -int error, nr_calls =0 ; +int error;/* * If the user said "noresume".. bail out early.
@@ -997,11 +995,9 @@ static int software_resume(void)pr_info ("resume from hibernation\n" );pm_prepare_console (); - error =__pm_notifier_call_chain (PM_RESTORE_PREPARE ,-1 , &nr_calls); -if (error) { - nr_calls--; - goto Close_Finish; - } + error =pm_notifier_call_chain_robust (PM_RESTORE_PREPARE ,PM_POST_RESTORE ); +if (error) + goto Restore;pm_pr_dbg ("Preparing processes for hibernation restore.\n" ); error =freeze_processes ();
@@ -1017,7 +1013,8 @@ static int software_resume(void) error =load_image_and_restore ();thaw_processes (); Finish: -__pm_notifier_call_chain (PM_POST_RESTORE , nr_calls,NULL ); +pm_notifier_call_chain (PM_POST_RESTORE ); + Restore:pm_restore_console ();pr_info ("resume failed (%d)\n" , error);hibernate_release ();
kernel/power/main.c +4 -4
@@ -80,18 +80,18 @@ int unregister_pm_notifier(struct notifier_block *nb) }EXPORT_SYMBOL_GPL (unregister_pm_notifier); -int __pm_notifier_call_chain (unsigned long val,int nr_to_call,int *nr_calls) +int pm_notifier_call_chain_robust (unsigned long val_up,unsigned long val_down) {int ret; - ret =__blocking_notifier_call_chain (&pm_chain_head, val,NULL , - nr_to_call, nr_calls); + ret =blocking_notifier_call_chain_robust (&pm_chain_head, val_up, val_down,NULL );return notifier_to_errno (ret); } +int pm_notifier_call_chain (unsigned long val) { -return __pm_notifier_call_chain (val,-1 ,NULL ); +return blocking_notifier_call_chain (&pm_chain_head, val,NULL ); }/* If set, devices may be suspended and resumed asynchronously. */
kernel/power/power.h +1 -2
@@ -210,8 +210,7 @@ static inline void suspend_test_finish(const char *label) {}#ifdef CONFIG_PM_SLEEP /* kernel/power/main.c */ -extern int __pm_notifier_call_chain (unsigned long val,int nr_to_call, -int *nr_calls); +extern int pm_notifier_call_chain_robust (unsigned long val_up,unsigned long val_down);extern int pm_notifier_call_chain (unsigned long val);#endif
kernel/power/suspend.c +6 -8
@@ -342,18 +342,16 @@ static int suspend_test(int level)*/ static int suspend_prepare (suspend_state_t state) { -int error, nr_calls =0 ; +int error;if (!sleep_state_supported (state))return -EPERM ;pm_prepare_console (); - error =__pm_notifier_call_chain (PM_SUSPEND_PREPARE ,-1 , &nr_calls); -if (error) { - nr_calls--; - goto Finish; - } + error =pm_notifier_call_chain_robust (PM_SUSPEND_PREPARE ,PM_POST_SUSPEND ); +if (error) + goto Restore;trace_suspend_resume (TPS ("freeze_processes" ),0 , true); error =suspend_freeze_processes ();
@@ -363,8 +361,8 @@ static int suspend_prepare(suspend_state_t state) suspend_stats.failed_freeze++;dpm_save_failed_step (SUSPEND_FREEZE ); - Finish: -__pm_notifier_call_chain (PM_POST_SUSPEND , nr_calls,NULL ); +pm_notifier_call_chain (PM_POST_SUSPEND ); + Restore:pm_restore_console ();return error; }
kernel/power/user.c +4 -10
@@ -46,7 +46,7 @@ int is_hibernate_resume_dev(const struct inode *bd_inode)static int snapshot_open (struct inode *inode,struct file *filp) {struct snapshot_data *data; -int error, nr_calls =0 ; +int error;if (!hibernation_available ())return -EPERM ;
@@ -73,9 +73,7 @@ static int snapshot_open(struct inode *inode, struct file *filp) swap_type_of(swsusp_resume_device, 0, NULL) : -1; data->mode =O_RDONLY ; data->free_bitmaps = false; - error =__pm_notifier_call_chain (PM_HIBERNATION_PREPARE ,-1 , &nr_calls); -if (error) -__pm_notifier_call_chain (PM_POST_HIBERNATION , --nr_calls,NULL ); + error =pm_notifier_call_chain_robust (PM_HIBERNATION_PREPARE ,PM_POST_HIBERNATION ); }else {/* * Resuming. We may need to wait for the image device to
@@ -85,15 +83,11 @@ static int snapshot_open(struct inode *inode, struct file *filp) data->swap =-1 ; data->mode =O_WRONLY ; - error =__pm_notifier_call_chain (PM_RESTORE_PREPARE ,-1 , &nr_calls); + error =pm_notifier_call_chain_robust (PM_RESTORE_PREPARE ,PM_POST_RESTORE );if (!error) { error =create_basic_memory_bitmaps (); data->free_bitmaps = !error; - }else - nr_calls--; - -if (error) -__pm_notifier_call_chain (PM_POST_RESTORE , nr_calls,NULL ); + } }if (error)hibernate_release ();
tools/power/pm-graph/sleepgraph.py +1 -1
@@ -171,7 +171,7 @@ class SystemValues: tracefuncs = { 'sys_sync': {}, 'ksys_sync': {}, - '__pm_notifier_call_chain': {}, + 'pm_notifier_call_chain_robust': {}, 'pm_prepare_console': {}, 'pm_notifier_call_chain': {}, 'freeze_processes': {},
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 670/757 fs: dlm: fix configfs memory leak
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 3d2825c8c6105b0f36f3ff72760799fa2e71420e ]
This patch fixes the following memory detected by kmemleak and umount gfs2 filesystem which removed the last lockspace:
unreferenced object 0xffff9264f482f600 (size 192):
comm "dlm_controld", pid 325, jiffies 4294690276 (age 48.136s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 6e 6f 64 65 73 00 00 00 ........nodes...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000060481d7>] make_space+0x41/0x130
[<000000008d905d46>] configfs_mkdir+0x1a2/0x5f0
[<00000000729502cf>] vfs_mkdir+0x155/0x210
[<000000000369bcf1>] do_mkdirat+0x6d/0x110
[<00000000cc478a33>] do_syscall_64+0x33/0x40
[<00000000ce9ccf01>] entry_SYSCALL_64_after_hwframe+0x44/0xa9The patch just remembers the "nodes" entry pointer in space as I think it's created as subdirectory when parent "spaces" is created. In function drop_space() we will lost the pointer reference to nds because configfs_remove_default_groups(). However as this subdirectory is always available when "spaces" exists it will just be freed when "spaces" will be freed.
--- fs/dlm/config.c | 3 +++ 1 file changed, 3 insertions(+)
fs/dlm/config.c +3 -0
@@ -221,6 +221,7 @@ struct dlm_space {struct list_head members;struct mutex members_lock;int members_count; +struct dlm_nodes *nds; };struct dlm_comms {
@@ -430,6 +431,7 @@ static struct config_group *make_space(struct config_group *g, const char *name)INIT_LIST_HEAD (&sp->members);mutex_init (&sp->members_lock); sp->members_count =0 ; + sp->nds = nds;return &sp->group; fail:
@@ -451,6 +453,7 @@ static void drop_space(struct config_group *g, struct config_item *i)static void release_space (struct config_item *i) {struct dlm_space *sp =config_item_to_space (i); +kfree (sp->nds);kfree (sp); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 671/757 media: venus: core: Fix error handling in probe
In reply to Greg Kroah-HartmanFrom: Rajendra Nayak <[email protected]>
[ Upstream commit 98cd831088c64aa8fe7e1d2a8bb94b6faba0462b ]
Post a successful pm_ops->core_get, an error in probe should exit by doing a pm_ops->core_put which seems to be missing. So fix it.
--- drivers/media/platform/qcom/venus/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/media/platform/qcom/venus/core.c +10 -5
@@ -224,13 +224,15 @@ static int venus_probe(struct platform_device *pdev) ret =dma_set_mask_and_coherent (dev, core->res->dma_mask);if (ret) -return ret; + goto err_core_put;if (!dev->dma_parms) { dev->dma_parms =devm_kzalloc (dev,sizeof (*dev->dma_parms),GFP_KERNEL ); -if (!dev->dma_parms) -return -ENOMEM ; +if (!dev->dma_parms) { + ret = -ENOMEM ; + goto err_core_put; + } }dma_set_max_seg_size (dev,DMA_BIT_MASK (32 ));
@@ -242,11 +244,11 @@ static int venus_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_ONESHOT , "venus", core);if (ret) -return ret; + goto err_core_put; ret =hfi_create (core, &venus_core_ops);if (ret) -return ret; + goto err_core_put;pm_runtime_enable (dev);
@@ -302,6 +304,9 @@ static int venus_probe(struct platform_device *pdev)pm_runtime_set_suspended (dev);pm_runtime_disable (dev);hfi_destroy (core); +err_core_put: +if (core->pm_ops->core_put) + core->pm_ops->core_put (dev);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 672/757 media: venus: core: Fix runtime PM imbalance in venus_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit bbe516e976fce538db96bd2b7287df942faa14a3 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. For other error paths after this call, things are the same.
Fix this by adding pm_runtime_put_noidle() after 'err_runtime_disable' label. But in this case, the error path after pm_runtime_put_sync() will decrease PM usage counter twice. Thus add an extra pm_runtime_get_noresume() in this path to balance PM counter.
--- drivers/media/platform/qcom/venus/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +4 -1
@@ -289,8 +289,10 @@ static int venus_probe(struct platform_device *pdev) goto err_core_deinit; ret =pm_runtime_put_sync (dev); -if (ret) +if (ret) { +pm_runtime_get_noresume (dev); goto err_dev_unregister; + }return 0 ;
@@ -301,6 +303,7 @@ static int venus_probe(struct platform_device *pdev) err_venus_shutdown:venus_shutdown (core); err_runtime_disable: +pm_runtime_put_noidle (dev);pm_runtime_set_suspended (dev);pm_runtime_disable (dev);hfi_destroy (core);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 673/757 ntfs: add check for mft record size in superblock
In reply to Greg Kroah-HartmanFrom: Rustam Kovhaev <[email protected]>
[ Upstream commit 4f8c94022f0bc3babd0a124c0a7dcdd7547bd94e ]
Number of bytes allocated for mft record should be equal to the mft record size stored in ntfs superblock as reported by syzbot, userspace might trigger out-of-bounds read by dereferencing ctx->attr in ntfs_attr_find()
--- fs/ntfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ntfs/inode.c +6 -0
@@ -1810,6 +1810,12 @@ int ntfs_read_inode_mount(struct inode *vi)brelse (bh); } +if (le32_to_cpu (m->bytes_allocated) != vol->mft_record_size) { +ntfs_error (sb,"Incorrect mft record size %u in superblock, should be %u." , +le32_to_cpu (m->bytes_allocated), vol->mft_record_size); + goto err_out; + } +/* Apply the mst fixups. */ if (post_read_mst_fixup ((NTFS_RECORD *)m, vol->mft_record_size)) {/* FIXME: Try to use the $MFTMirr now. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 674/757 ip_gre: set dev->hard_header_len and dev->needed_headroom properly
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit fdafed459998e2be0e877e6189b24cb7a0183224 ]
GRE tunnel has its own header_ops, ipgre_header_ops, and sets it conditionally. When it is set, it assumes the outer IP header is already created before ipgre_xmit().
This is not true when we send packets through a raw packet socket, where L2 headers are supposed to be constructed by user. Packet socket calls dev_validate_header() to validate the header. But GRE tunnel does not set dev->hard_header_len, so that check can be simply bypassed, therefore uninit memory could be passed down to ipgre_xmit(). Similar for dev->needed_headroom.
dev->hard_header_len is supposed to be the length of the header created by dev->header_ops->create(), so it should be used whenever header_ops is set, and dev->needed_headroom should be used when it is not set.
--- net/ipv4/ip_gre.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/ipv4/ip_gre.c +11 -4
@@ -625,9 +625,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, }if (dev->header_ops) { -/* Need space for new headers */ -if (skb_cow_head (skb, dev->needed_headroom - - (tunnel->hlen +sizeof (struct iphdr )))) +if (skb_cow_head (skb,0 )) goto free_skb; tnl_params = (const struct iphdr *)skb->data;
@@ -748,7 +746,11 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) len = tunnel->tun_hlen - len; tunnel->hlen = tunnel->hlen + len; - dev->needed_headroom = dev->needed_headroom + len; +if (dev->header_ops) + dev->hard_header_len += len; +else + dev->needed_headroom += len; +if (set_mtu) dev->mtu =max_t (int, dev->mtu - len,68 );
@@ -944,6 +946,7 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->parms.iph.protocol =IPPROTO_GRE ; tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; + dev->needed_headroom = tunnel->hlen +sizeof (tunnel->parms.iph); dev->features |=GRE_FEATURES ; dev->hw_features |=GRE_FEATURES ;
@@ -987,10 +990,14 @@ static int ipgre_tunnel_init(struct net_device *dev)return -EINVAL ; dev->flags =IFF_BROADCAST ; dev->header_ops = &ipgre_header_ops; + dev->hard_header_len = tunnel->hlen +sizeof (*iph); + dev->needed_headroom = 0; }#endif }else if (!tunnel->collect_md) { dev->header_ops = &ipgre_header_ops; + dev->hard_header_len = tunnel->hlen +sizeof (*iph); + dev->needed_headroom =0 ; }return ip_tunnel_init (dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 675/757 mac80211: handle lack of sband->bitrates in rates
In reply to Greg Kroah-HartmanFrom: Thomas Pedersen <[email protected]>
[ Upstream commit 8b783d104e7f40684333d2ec155fac39219beb2f ]
Even though a driver or mac80211 shouldn't produce a legacy bitrate if sband->bitrates doesn't exist, don't crash if that is the case either.
This fixes a kernel panic if station dump is run before last_rate can be updated with a data frame when sband->bitrates is missing (eg. in S1G bands).
--- net/mac80211/cfg.c | 3 ++- net/mac80211/sta_info.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +2 -1
@@ -709,7 +709,8 @@ void sta_set_rate_info_tx(struct sta_info *sta,u16 brate; sband =ieee80211_get_sband (sta->sdata); -if (sband) { +WARN_ON_ONCE (sband && !sband->bitrates); +if (sband && sband->bitrates) { brate = sband->bitrates[rate->idx].bitrate; rinfo->legacy =DIV_ROUND_UP (brate,1 << shift); }
net/mac80211/sta_info.c +4 -0
@@ -2122,6 +2122,10 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate,int rate_idx =STA_STATS_GET (LEGACY_IDX , rate); sband = local->hw.wiphy->bands[band]; + +if (WARN_ON_ONCE (!sband->bitrates)) +break ; + brate = sband->bitrates[rate_idx].bitrate;if (rinfo->bw ==RATE_INFO_BW_5 ) shift =2 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 676/757 staging: wfx: fix handling of MMIC error
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit 8d350c14ee5eb62ecd40b0991248bfbce511954d ]
As expected, when the device detect a MMIC error, it returns a specific status. However, it also strip IV from the frame (don't ask me why).
So, with the current code, mac80211 detects a corrupted frame and it drops it before it handle the MMIC error. The expected behavior would be to detect MMIC error then to renegotiate the EAP session.
So, this patch correctly informs mac80211 that IV is not available. So, mac80211 correctly takes into account the MMIC error.
--- drivers/staging/wfx/data_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/data_rx.c +1 -1
@@ -44,7 +44,7 @@ void wfx_rx_cb(struct wfx_vif *wvif,memset (hdr,0 ,sizeof (*hdr));if (arg->status ==HIF_STATUS_RX_FAIL_MIC ) - hdr->flag |=RX_FLAG_MMIC_ERROR ; + hdr->flag |=RX_FLAG_MMIC_ERROR |RX_FLAG_IV_STRIPPED ;else if (arg->status) goto drop;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 677/757 libbpf: Close map fd if init map slots failed
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit a0f2b7acb4b1d29127ff99c714233b973afd1411 ]
Previously we forgot to close the map fd if bpf_map_update_elem() failed during map slot init, which will leak map fd.
Let's move map slot initialization to new function init_map_slots() to simplify the code. And close the map fd if init slot failed.
--- tools/lib/bpf/libbpf.c | 55 ++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 21 deletions(-)
tools/lib/bpf/libbpf.c +34 -21
@@ -3841,6 +3841,36 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)return 0 ; } +static int init_map_slots (struct bpf_map *map) +{ +const struct bpf_map *targ_map; +unsigned int i; +int fd, err; + +for (i =0 ; i < map->init_slots_sz; i++) { +if (!map->init_slots[i]) +continue ; + + targ_map = map->init_slots[i]; + fd =bpf_map__fd (targ_map); + err =bpf_map_update_elem (map->fd, &i, &fd,0 ); +if (err) { + err = -errno; +pr_warn ("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %d\n" , + map->name, i, targ_map->name, + fd, err); +return err; + } +pr_debug ("map '%s': slot [%d] set to map '%s' fd=%d\n" , + map->name, i, targ_map->name, fd); + } + +zfree (&map->init_slots); + map->init_slots_sz =0 ; + +return 0 ; +} +static int bpf_object__create_maps (struct bpf_object *obj) {
@@ -3883,28 +3913,11 @@ bpf_object__create_maps(struct bpf_object *obj) }if (map->init_slots_sz) { -for (j =0 ; j < map->init_slots_sz; j++) { -const struct bpf_map *targ_map; -int fd; - -if (!map->init_slots[j]) -continue ; - - targ_map = map->init_slots[j]; - fd =bpf_map__fd (targ_map); - err =bpf_map_update_elem (map->fd, &j, &fd,0 ); -if (err) { - err = -errno; -pr_warn ("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %d\n" , - map->name, j, targ_map->name, - fd, err); - goto err_out; - } -pr_debug ("map '%s': slot [%d] set to map '%s' fd=%d\n" , - map->name, j, targ_map->name, fd); + err =init_map_slots (map); +if (err <0 ) { +zclose (map->fd); + goto err_out; } -zfree (&map->init_slots); - map->init_slots_sz =0 ; }if (map->pin_path && !map->pinned) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 678/757 bpf: Use raw_spin_trylock() for pcpu_freelist_push/pop in NMI
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit 39d8f0d1026a990604770a658708f5845f7dbec0 ]
Recent improvements in LOCKDEP highlighted a potential A-A deadlock with pcpu_freelist in NMI:
./tools/testing/selftests/bpf/test_progs -t stacktrace_build_id_nmi
[ 18.984807] ================================
[ 18.984807] WARNING: inconsistent lock state
[ 18.984808] 5.9.0-rc6-01771-g1466de1330e1 #2967 Not tainted
[ 18.984809] --------------------------------
[ 18.984809] inconsistent {INITIAL USE} -> {IN-NMI} usage.
[ 18.984810] test_progs/1990 [HC2[2]:SC0[0]:HE0:SE1] takes:
[ 18.984810] ffffe8ffffc219c0 (&head->lock){....}-{2:2}, at: __pcpu_freelist_pop+0xe3/0x180
[ 18.984813] {INITIAL USE} state was registered at:
[ 18.984814] lock_acquire+0x175/0x7c0
[ 18.984814] _raw_spin_lock+0x2c/0x40
[ 18.984815] __pcpu_freelist_pop+0xe3/0x180
[ 18.984815] pcpu_freelist_pop+0x31/0x40
[ 18.984816] htab_map_alloc+0xbbf/0xf40
[ 18.984816] __do_sys_bpf+0x5aa/0x3ed0
[ 18.984817] do_syscall_64+0x2d/0x40
[ 18.984818] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 18.984818] irq event stamp: 12
[...]
[ 18.984822] other info that might help us debug this:
[ 18.984823] Possible unsafe locking scenario:
[ 18.984823]
[ 18.984824] CPU0
[ 18.984824] ----
[ 18.984824] lock(&head->lock);
[ 18.984826] <Interrupt>
[ 18.984826] lock(&head->lock);
[ 18.984827]
[ 18.984828] *** DEADLOCK ***
[ 18.984828]
[ 18.984829] 2 locks held by test_progs/1990:
[...]
[ 18.984838] <NMI>
[ 18.984838] dump_stack+0x9a/0xd0
[ 18.984839] lock_acquire+0x5c9/0x7c0
[ 18.984839] ? lock_release+0x6f0/0x6f0
[ 18.984840] ? __pcpu_freelist_pop+0xe3/0x180
[ 18.984840] _raw_spin_lock+0x2c/0x40
[ 18.984841] ? __pcpu_freelist_pop+0xe3/0x180
[ 18.984841] __pcpu_freelist_pop+0xe3/0x180
[ 18.984842] pcpu_freelist_pop+0x17/0x40
[ 18.984842] ? lock_release+0x6f0/0x6f0
[ 18.984843] __bpf_get_stackid+0x534/0xaf0
[ 18.984843] bpf_prog_1fd9e30e1438d3c5_oncpu+0x73/0x350
[ 18.984844] bpf_overflow_handler+0x12f/0x3f0This is because pcpu_freelist_head.lock is accessed in both NMI and non-NMI context. Fix this issue by using raw_spin_trylock() in NMI.
Since NMI interrupts non-NMI context, when NMI context tries to lock the raw_spinlock, non-NMI context of the same CPU may already have locked a lock and is blocked from unlocking the lock. For a system with N CPUs, there could be N NMIs at the same time, and they may block N non-NMI raw_spinlocks. This is tricky for pcpu_freelist_push(), where unlike _pop(), failing _push() means leaking memory. This issue is more likely to trigger in non-SMP system.
Fix this issue with an extra list, pcpu_freelist.extralist. The extralist is primarily used to take _push() when raw_spin_trylock() failed on all the per CPU lists. It should be empty most of the time. The following table summarizes the behavior of pcpu_freelist in NMI and non-NMI:
non-NMI pop(): use _lock(); check per CPU lists first;
if all per CPU lists are empty, check extralist; if extralist is empty, return NULL.
non-NMI push(): use _lock(); only push to per CPU lists.
NMI pop(): use _trylock(); check per CPU lists first;
if all per CPU lists are locked or empty, check extralist; if extralist is locked or empty, return NULL.
NMI push(): use _trylock(); check per CPU lists first;
if all per CPU lists are locked; try push to extralist; if extralist is also locked, keep trying on per CPU lists.
--- kernel/bpf/percpu_freelist.c | 101 +++++++++++++++++++++++++++++++++-- kernel/bpf/percpu_freelist.h | 1 + 2 files changed, 97 insertions(+), 5 deletions(-)
kernel/bpf/percpu_freelist.c +96 -5
@@ -17,6 +17,8 @@ int pcpu_freelist_init(struct pcpu_freelist *s)raw_spin_lock_init (&head->lock); head->first =NULL ; } +raw_spin_lock_init (&s->extralist.lock); + s->extralist.first =NULL ;return 0 ; }
@@ -40,12 +42,50 @@ static inline void ___pcpu_freelist_push(struct pcpu_freelist_head *head,raw_spin_unlock (&head->lock); } +static inline bool pcpu_freelist_try_push_extra (struct pcpu_freelist *s, +struct pcpu_freelist_node *node) +{ +if (!raw_spin_trylock (&s->extralist.lock)) +return false; + +pcpu_freelist_push_node (&s->extralist, node); +raw_spin_unlock (&s->extralist.lock); +return true; +} + +static inline void ___pcpu_freelist_push_nmi (struct pcpu_freelist *s, +struct pcpu_freelist_node *node) +{ +int cpu, orig_cpu; + + orig_cpu = cpu =raw_smp_processor_id (); +while (1 ) { +struct pcpu_freelist_head *head; + + head =per_cpu_ptr (s->freelist, cpu); +if (raw_spin_trylock (&head->lock)) { +pcpu_freelist_push_node (head, node); +raw_spin_unlock (&head->lock); +return ; + } + cpu =cpumask_next (cpu, cpu_possible_mask); +if (cpu >= nr_cpu_ids) + cpu =0 ; + +/* cannot lock any per cpu lock, try extralist */ +if (cpu == orig_cpu && +pcpu_freelist_try_push_extra (s, node)) +return ; + } +} +void __pcpu_freelist_push (struct pcpu_freelist *s,struct pcpu_freelist_node *node) { -struct pcpu_freelist_head *head =this_cpu_ptr (s->freelist); - -___pcpu_freelist_push (head, node); +if (in_nmi ()) +___pcpu_freelist_push_nmi (s, node); +else +___pcpu_freelist_push (this_cpu_ptr (s->freelist), node); } void pcpu_freelist_push(struct pcpu_freelist *s,
@@ -81,7 +121,7 @@ void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size, } } -struct pcpu_freelist_node *__pcpu_freelist_pop (struct pcpu_freelist *s) +static struct pcpu_freelist_node *___pcpu_freelist_pop (struct pcpu_freelist *s) {struct pcpu_freelist_head *head;struct pcpu_freelist_node *node;
@@ -102,8 +142,59 @@ struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *s)if (cpu >= nr_cpu_ids) cpu =0 ;if (cpu == orig_cpu) -return NULL ; +break ; + } + +/* per cpu lists are all empty, try extralist */ +raw_spin_lock (&s->extralist.lock); + node = s->extralist.first; +if (node) + s->extralist.first = node->next; +raw_spin_unlock (&s->extralist.lock); +return node; +} + +static struct pcpu_freelist_node * +___pcpu_freelist_pop_nmi (struct pcpu_freelist *s) +{ +struct pcpu_freelist_head *head; +struct pcpu_freelist_node *node; +int orig_cpu, cpu; + + orig_cpu = cpu =raw_smp_processor_id (); +while (1 ) { + head =per_cpu_ptr (s->freelist, cpu); +if (raw_spin_trylock (&head->lock)) { + node = head->first; +if (node) { + head->first = node->next; +raw_spin_unlock (&head->lock); +return node; + } +raw_spin_unlock (&head->lock); + } + cpu =cpumask_next (cpu, cpu_possible_mask); +if (cpu >= nr_cpu_ids) + cpu =0 ; +if (cpu == orig_cpu) +break ; } + +/* cannot pop from per cpu lists, try extralist */ +if (!raw_spin_trylock (&s->extralist.lock)) +return NULL ; + node = s->extralist.first; +if (node) + s->extralist.first = node->next; +raw_spin_unlock (&s->extralist.lock); +return node; +} + +struct pcpu_freelist_node *__pcpu_freelist_pop (struct pcpu_freelist *s) +{ +if (in_nmi ()) +return ___pcpu_freelist_pop_nmi (s); +return ___pcpu_freelist_pop (s); }struct pcpu_freelist_node *pcpu_freelist_pop (struct pcpu_freelist *s)
kernel/bpf/percpu_freelist.h +1 -0
@@ -13,6 +13,7 @@ struct pcpu_freelist_head {struct pcpu_freelist {struct pcpu_freelist_head __percpu *freelist; +struct pcpu_freelist_head extralist; };struct pcpu_freelist_node {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 679/757 PM: hibernate: remove the bogus call to get_gendisk() in software_resume()
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 428805c0c5e76ef643b1fbc893edfb636b3d8aef ]
get_gendisk grabs a reference on the disk and file operation, so this code will leak both of them while having absolutely no use for the gendisk itself.
This effectively reverts commit 2df83fa4bce421f ("PM / Hibernate: Use get_gendisk to verify partition if resume_file is integer format")
--- kernel/power/hibernate.c | 11 ----------- 1 file changed, 11 deletions(-)
kernel/power/hibernate.c +0 -11
@@ -946,17 +946,6 @@ static int software_resume(void)/* Check if the device is there */ swsusp_resume_device =name_to_dev_t (resume_file); - -/* -* name_to_dev_t is ineffective to verify parition if resume_file is in -* integer format. (e.g. major:minor) -*/ -if (isdigit (resume_file[0 ]) && resume_wait) { -int partno; -while (!get_gendisk (swsusp_resume_device, &partno)) -msleep (10 ); - } -if (!swsusp_resume_device) {/* * Some device discovery might still be in progress; we need
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 680/757 scsi: mvumi: Fix error return in mvumi_io_attach()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit 055f15ab2cb4a5cbc4c0a775ef3d0066e0fa9b34 ]
Return PTR_ERR() from the error handling case instead of 0.
--- drivers/scsi/mvumi.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/mvumi.c +1 -0
@@ -2425,6 +2425,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba)if (IS_ERR (mhba->dm_thread)) {dev_err (&mhba->pdev->dev,"failed to create device scan thread\n" ); + ret =PTR_ERR (mhba->dm_thread);mutex_unlock (&mhba->sas_discovery_mutex); goto fail_create_thread; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 681/757 scsi: target: core: Add CONTROL field for trace events
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 7010645ba7256992818b518163f46bd4cdf8002a ]
trace-cmd report doesn't show events from target subsystem because scsi_command_size() leaks through event format string:
[target:target_sequencer_start] function scsi_command_size not defined [target:target_cmd_complete] function scsi_command_size not defined
Addition of scsi_command_size() to plugin_scsi.c in trace-cmd doesn't help because an expression is used inside TP_printk(). trace-cmd event parser doesn't understand minus sign inside [ ]:
Error: expected ']' but read '-'
Rather than duplicating kernel code in plugin_scsi.c, provide a dedicated field for CONTROL byte.
--- include/scsi/scsi_common.h | 7 +++++++ include/trace/events/target.h | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
include/scsi/scsi_common.h +7 -0
@@ -25,6 +25,13 @@ scsi_command_size(const unsigned char *cmnd) scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]); } +static inline unsigned char +scsi_command_control (const unsigned char *cmnd) +{ +return (cmnd[0 ] ==VARIABLE_LENGTH_CMD ) ? + cmnd[1 ] : cmnd[COMMAND_SIZE (cmnd[0 ]) -1 ]; +} +/* Returns a human-readable name for the device */ extern const char *scsi_device_type (unsigned type);
include/trace/events/target.h +6 -6
@@ -141,6 +141,7 @@ TRACE_EVENT(target_sequencer_start, __field( unsigned int, opcode ) __field( unsigned int, data_length ) __field( unsigned int, task_attribute ) + __field( unsigned char, control ) __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE ) __string( initiator, cmd->se_sess->se_node_acl->initiatorname ) ),
@@ -151,6 +152,7 @@ TRACE_EVENT(target_sequencer_start, __entry->opcode = cmd->t_task_cdb[0 ]; __entry->data_length = cmd->data_length; __entry->task_attribute = cmd->sam_task_attr; + __entry->control =scsi_command_control (cmd->t_task_cdb);memcpy (__entry->cdb, cmd->t_task_cdb,TCM_MAX_COMMAND_SIZE );__assign_str (initiator, cmd->se_sess->se_node_acl->initiatorname); ),
@@ -160,9 +162,7 @@ TRACE_EVENT(target_sequencer_start, __entry->tag,show_opcode_name (__entry->opcode), __entry->data_length,__print_hex (__entry->cdb,16 ),show_task_attribute_name (__entry->task_attribute), -scsi_command_size (__entry->cdb) <=16 ? - __entry->cdb[scsi_command_size (__entry->cdb) -1 ] : - __entry->cdb[1 ] + __entry->control ) );
@@ -178,6 +178,7 @@ TRACE_EVENT(target_cmd_complete, __field( unsigned int, opcode ) __field( unsigned int, data_length ) __field( unsigned int, task_attribute ) + __field( unsigned char, control ) __field( unsigned char, scsi_status ) __field( unsigned char, sense_length ) __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
@@ -191,6 +192,7 @@ TRACE_EVENT(target_cmd_complete, __entry->opcode = cmd->t_task_cdb[0 ]; __entry->data_length = cmd->data_length; __entry->task_attribute = cmd->sam_task_attr; + __entry->control =scsi_command_control (cmd->t_task_cdb); __entry->scsi_status = cmd->scsi_status; __entry->sense_length = cmd->scsi_status ==SAM_STAT_CHECK_CONDITION ?min (18 , ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET ] +8 ) :0 ;
@@ -208,9 +210,7 @@ TRACE_EVENT(target_cmd_complete,show_opcode_name (__entry->opcode), __entry->data_length,__print_hex (__entry->cdb,16 ),show_task_attribute_name (__entry->task_attribute), -scsi_command_size (__entry->cdb) <=16 ? - __entry->cdb[scsi_command_size (__entry->cdb) -1 ] : - __entry->cdb[1 ] + __entry->control ) );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 682/757 mic: vop: copy data to kernel space then write to io memory
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 675f0ad4046946e80412896436164d172cd92238 ]
Read and write io memory should address align on ARCH ARM. Change to use memcpy_toio to avoid kernel panic caused by the address un-align issue.
--- drivers/misc/mic/vop/vop_vringh.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/misc/mic/vop/vop_vringh.c +14 -6
@@ -602,6 +602,7 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,size_t partlen;bool dma =VOP_USE_DMA && vi->dma_ch;int err =0 ; +size_t offset =0 ;if (dma) { dma_alignment =1 << vi->dma_ch->device->copy_align;
@@ -655,13 +656,20 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,* We are copying to IO below and should ideally use something * like copy_from_user_toio(..) if it existed. */ -if (copy_from_user ((void __force *)dbuf, ubuf, len)) { - err = -EFAULT ; -dev_err (vop_dev (vdev),"%s %d err %d\n" , - __func__, __LINE__, err); - goto err; +while (len) { + partlen =min_t (size_t, len,VOP_INT_DMA_BUF_SIZE ); + +if (copy_from_user (vvr->buf, ubuf + offset, partlen)) { + err = -EFAULT ; +dev_err (vop_dev (vdev),"%s %d err %d\n" , + __func__, __LINE__, err); + goto err; + } +memcpy_toio (dbuf + offset, vvr->buf, partlen); + offset += partlen; + vdev->out_bytes += partlen; + len -= partlen; } - vdev->out_bytes += len; err =0 ; err: vpdev->hw_ops->unmap (vpdev, dbuf);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 683/757 misc: vop: add round_up(x,4) for vring_size to avoid kernel panic
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit cc1a2679865a94b83804822996eed010a50a7c1d ]
Since struct _mic_vring_info and vring are allocated together and follow vring, if the vring_size() is not four bytes aligned, which will cause the start address of struct _mic_vring_info is not four byte aligned. For example, when vring entries is 128, the vring_size() will be 5126 bytes. The _mic_vring_info struct layout in ddr looks like:0x90002400: 00000000 00390000 EE010000 0000C0FF
Here 0x39 is the avail_idx member, and 0xC0FFEE01 is the magic member.
When EP use ioread32(magic) to reads the magic in RC's share memory, it will cause kernel panic on ARM64 platform due to the cross-byte io read. Here read magic in user space use le32toh(vr0->info->magic) will meet the same issue.
So add round_up(x,4) for vring_size, then the struct _mic_vring_info will store in this way:0x90002400: 00000000 00000000 00000039 C0FFEE01
Which will avoid kernel panic when read magic in struct _mic_vring_info.
--- drivers/misc/mic/vop/vop_main.c | 2 +- drivers/misc/mic/vop/vop_vringh.c | 4 ++-- samples/mic/mpssd/mpssd.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/misc/mic/vop/vop_main.c +1 -1
@@ -320,7 +320,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev,/* First assign the vring's allocated in host memory */ vqconfig =_vop_vq_config (vdev->desc) + index;memcpy_fromio (&config, vqconfig,sizeof (config)); - _vr_size =vring_size (le16_to_cpu (config.num),MIC_VIRTIO_RING_ALIGN ); + _vr_size =round_up (vring_size (le16_to_cpu (config.num),MIC_VIRTIO_RING_ALIGN ),4 ); vr_size =PAGE_ALIGN (_vr_size +sizeof (struct _mic_vring_info )); va = vpdev->hw_ops->remap (vpdev,le64_to_cpu (config.address), vr_size);if (!va)
drivers/misc/mic/vop/vop_vringh.c +2 -2
@@ -296,7 +296,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, num =le16_to_cpu (vqconfig[i].num);mutex_init (&vvr->vr_mutex); - vr_size =PAGE_ALIGN (vring_size (num,MIC_VIRTIO_RING_ALIGN ) + + vr_size =PAGE_ALIGN (round_up (vring_size (num,MIC_VIRTIO_RING_ALIGN ),4 ) +sizeof (struct _mic_vring_info )); vr->va = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
@@ -308,7 +308,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, goto err; } vr->len = vr_size; - vr->info = vr->va +vring_size (num,MIC_VIRTIO_RING_ALIGN ); + vr->info = vr->va +round_up (vring_size (num,MIC_VIRTIO_RING_ALIGN ),4 ); vr->info->magic =cpu_to_le32 (MIC_MAGIC + vdev->virtio_id + i); vr_addr =dma_map_single (&vpdev->dev, vr->va, vr_size,DMA_BIDIRECTIONAL );
samples/mic/mpssd/mpssd.c +2 -2
@@ -403,9 +403,9 @@ mic_virtio_copy(struct mic_info *mic, int fd,static inline unsigned _vring_size (unsigned int num,unsigned long align) { -return ((sizeof (struct vring_desc ) * num +sizeof (__u16) * (3 + num) +return _ALIGN_UP (((sizeof (struct vring_desc ) * num +sizeof (__u16) * (3 + num) + align -1 ) & ~(align -1 )) - +sizeof (__u16) *3 +sizeof (struct vring_used_elem ) * num; + +sizeof (__u16) *3 +sizeof (struct vring_used_elem ) * num,4 ); }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 684/757 usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc
In reply to Greg Kroah-HartmanFrom: Yu Chen <[email protected]>
[ Upstream commit f580170f135af14e287560d94045624d4242d712 ]
SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.
[mchehab: dropped a dev_dbg() as only traces are now allowwed on this driver]
--- drivers/usb/dwc3/core.c | 25 +++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ 2 files changed, 32 insertions(+)
drivers/usb/dwc3/core.c +25 -0
@@ -119,6 +119,7 @@ static void __dwc3_set_mode(struct work_struct *work)struct dwc3 *dwc =work_to_dwc (work);unsigned long flags;int ret; +u32 reg;if (dwc->dr_mode !=USB_DR_MODE_OTG )return ;
@@ -172,6 +173,11 @@ static void __dwc3_set_mode(struct work_struct *work)otg_set_vbus (dwc->usb2_phy->otg, true);phy_set_mode (dwc->usb2_generic_phy,PHY_MODE_USB_HOST );phy_set_mode (dwc->usb3_generic_phy,PHY_MODE_USB_HOST ); +if (dwc->dis_split_quirk) { + reg =dwc3_readl (dwc->regs,DWC3_GUCTL3 ); + reg |=DWC3_GUCTL3_SPLITDISABLE ; +dwc3_writel (dwc->regs,DWC3_GUCTL3 , reg); + } }break ;case DWC3_GCTL_PRTCAP_DEVICE :
@@ -1349,6 +1355,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_metastability_quirk =device_property_read_bool (dev,"snps,dis_metastability_quirk" ); + dwc->dis_split_quirk =device_property_read_bool (dev, +"snps,dis-split-quirk" ); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis;
@@ -1866,10 +1875,26 @@ static int dwc3_resume(struct device *dev) return 0; } + +static void dwc3_complete (struct device *dev) +{ +struct dwc3 *dwc =dev_get_drvdata (dev); +u32 reg; + +if (dwc->current_dr_role ==DWC3_GCTL_PRTCAP_HOST && + dwc->dis_split_quirk) { + reg =dwc3_readl (dwc->regs,DWC3_GUCTL3 ); + reg |=DWC3_GUCTL3_SPLITDISABLE ; +dwc3_writel (dwc->regs,DWC3_GUCTL3 , reg); + } +} +#else +#define dwc3_complete NULL#endif /* CONFIG_PM_SLEEP */ static const struct dev_pm_ops dwc3_dev_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (dwc3_suspend, dwc3_resume) + .complete = dwc3_complete,SET_RUNTIME_PM_OPS (dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) };
drivers/usb/dwc3/core.h +7 -0
@@ -138,6 +138,7 @@#define DWC3_GEVNTCOUNT (n) (0xc40c + ((n) * 0x10))#define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GUCTL3 0xc60c#define DWC3_GFLADJ 0xc630/* Device Registers */
@@ -380,6 +381,9 @@/* Global User Control Register 2 */ #define DWC3_GUCTL2_RST_ACTBITLATER BIT(14) +/* Global User Control Register 3 */ +#define DWC3_GUCTL3_SPLITDISABLE BIT(14) +/* Device Configuration Register */ #define DWC3_DCFG_DEVADDR (addr) ((addr) << 3)#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
@@ -1052,6 +1056,7 @@ struct dwc3_scratchpad_array {* 2 - No de-emphasis * 3 - Reserved * @dis_metastability_quirk: set to disable metastability quirk. +* @dis_split_quirk: set to disable split boundary. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */
@@ -1245,6 +1250,8 @@ struct dwc3 { unsigned dis_metastability_quirk:1; + unsigned dis_split_quirk:1; +u16 imod_interval; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 685/757 usb: gadget: function: printer: fix use-after-free in __lock_acquire
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 ]
Fix this by increase object reference count.
BUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831 Read of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377 CPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xce/0x128 lib/dump_stack.c:118 print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374 __kasan_report+0x131/0x1b0 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:641 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135 __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831 lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159 printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0xfb/0x130 fs/ioctl.c:763 __do_sys_ioctl fs/ioctl.c:772 [inline] __se_sys_ioctl fs/ioctl.c:770 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4531a9 Code: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9
RDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61
R13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff
Allocated by task 2393: save_stack+0x21/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529 kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:669 [inline] gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416 usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61 config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444 configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202 vfs_symlink+0x33d/0x5b0 fs/namei.c:4201 do_symlinkat+0x11b/0x1d0 fs/namei.c:4228 __do_sys_symlinkat fs/namei.c:4242 [inline] __se_sys_symlinkat fs/namei.c:4239 [inline] __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3368: save_stack+0x21/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] kasan_set_free_info mm/kasan/common.c:337 [inline] __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485 slab_free_hook mm/slub.c:1444 [inline] slab_free_freelist_hook mm/slub.c:1477 [inline] slab_free mm/slub.c:3034 [inline] kfree+0xf7/0x410 mm/slub.c:3995 gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353 usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87 config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485 configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250 vfs_unlink+0x287/0x570 fs/namei.c:4073 do_unlinkat+0x4f9/0x620 fs/namei.c:4137 __do_sys_unlink fs/namei.c:4184 [inline] __se_sys_unlink fs/namei.c:4182 [inline] __x64_sys_unlink+0x42/0x50 fs/namei.c:4182 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880683b0000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 24 bytes inside of 1024-byte region [ffff8880683b0000, ffff8880683b0400) The buggy address belongs to the page: page:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300 index:0xffff8880683b1800 compound_mapcount: 0 flags: 0x100000000010200(slab|head) raw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300 raw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected
--- drivers/usb/gadget/function/f_printer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_printer.c +14 -2
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/ctype.h> #include <linux/cdev.h> +#include <linux/kref.h> #include <asm/byteorder.h> #include <linux/io.h>
@@ -64,7 +65,7 @@ struct printer_dev {struct usb_gadget *gadget;s8 interface;struct usb_ep *in_ep, *out_ep; - +struct kref kref;struct list_head rx_reqs;/* List of free RX structs */ struct list_head rx_reqs_active;/* List of Active RX xfers */ struct list_head rx_buffers;/* List of completed xfers */
@@ -218,6 +219,13 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget,/*-------------------------------------------------------------------------*/ +static void printer_dev_free (struct kref *kref) +{ + struct printer_dev *dev = container_of(kref, struct printer_dev, kref); + +kfree (dev); +} +static struct usb_request *printer_req_alloc (struct usb_ep *ep,unsigned len,gfp_t gfp_flags) {
@@ -353,6 +361,7 @@ printer_open(struct inode *inode, struct file *fd)spin_unlock_irqrestore (&dev->lock, flags); +kref_get (&dev->kref);DBG (dev,"printer_open returned %x\n" , ret);return ret; }
@@ -370,6 +379,7 @@ printer_close(struct inode *inode, struct file *fd) dev->printer_status &= ~PRINTER_SELECTED ;spin_unlock_irqrestore (&dev->lock, flags); +kref_put (&dev->kref, printer_dev_free);DBG (dev,"printer_close\n" );return 0 ;
@@ -1386,7 +1396,8 @@ static void gprinter_free(struct usb_function *f)struct f_printer_opts *opts; opts = container_of(f->fi, struct f_printer_opts, func_inst); -kfree (dev); + +kref_put (&dev->kref, printer_dev_free);mutex_lock (&opts->lock); --opts->refcnt;mutex_unlock (&opts->lock);
@@ -1455,6 +1466,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi)return ERR_PTR (-ENOMEM ); } +kref_init (&dev->kref); ++opts->refcnt; dev->minor = opts->minor; dev->pnp_string = opts->pnp_string;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 686/757 rtw88: pci: Power cycle device during shutdown
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 44492e70adc8086c42d3745d21d591657a427f04 ]
There are reports that 8822CE fails to work rtw88 with "failed to read DBI register" error. Also I have a system with 8723DE which freezes the whole system when the rtw88 is probing the device.
According to [1], platform firmware may not properly power manage the device during shutdown. I did some expirements and putting the device to D3 can workaround the issue.
So let's power cycle the device by putting the device to D3 at shutdown to prevent the issue from happening.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=206411#c9
--- drivers/net/wireless/realtek/rtw88/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/pci.c +2 -0
@@ -1599,6 +1599,8 @@ void rtw_pci_shutdown(struct pci_dev *pdev)if (chip->ops->shutdown) chip->ops->shutdown (rtwdev); + +pci_set_power_state (pdev, PCI_D3hot); }EXPORT_SYMBOL (rtw_pci_shutdown);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 687/757 udf: Limit sparing table size
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 44ac6b829c4e173fdf6df18e6dd86aecf9a3dc99 ]
Although UDF standard allows it, we don't support sparing table larger than a single block. Check it during mount so that we don't try to access memory beyond end of buffer.
--- fs/udf/super.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/udf/super.c +6 -0
@@ -1353,6 +1353,12 @@ static int udf_load_sparable_map(struct super_block *sb, (int)spm->numSparingTables);return -EIO ; } +if (le32_to_cpu (spm->sizeSparingTable) > sb->s_blocksize) { +udf_err (sb,"error loading logical volume descriptor: " +"Too big sparing table size (%u)\n" , +le32_to_cpu (spm->sizeSparingTable)); +return -EIO ; + }for (i =0 ; i < spm->numSparingTables; i++) { loc =le32_to_cpu (spm->locSparingTable[i]);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 688/757 udf: Avoid accessing uninitialized data on failed inode read
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 044e2e26f214e5ab26af85faffd8d1e4ec066931 ]
When we fail to read inode, some data accessed in udf_evict_inode() may be uninitialized. Move the accesses to !is_bad_inode() branch.
--- fs/udf/inode.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
fs/udf/inode.c +14 -11
@@ -139,21 +139,24 @@ void udf_evict_inode(struct inode *inode)struct udf_inode_info *iinfo =UDF_I (inode);int want_delete =0 ; -if (!inode->i_nlink && !is_bad_inode (inode)) { - want_delete =1 ; -udf_setsize (inode,0 ); -udf_update_inode (inode,IS_SYNC (inode)); +if (!is_bad_inode (inode)) { +if (!inode->i_nlink) { + want_delete =1 ; +udf_setsize (inode,0 ); +udf_update_inode (inode,IS_SYNC (inode)); + } +if (iinfo->i_alloc_type !=ICBTAG_FLAG_AD_IN_ICB && + inode->i_size != iinfo->i_lenExtents) { +udf_warn (inode->i_sb, +"Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n" , + inode->i_ino, inode->i_mode, + (unsigned long long )inode->i_size, + (unsigned long long )iinfo->i_lenExtents); + } }truncate_inode_pages_final (&inode->i_data);invalidate_inode_buffers (inode);clear_inode (inode); -if (iinfo->i_alloc_type !=ICBTAG_FLAG_AD_IN_ICB && - inode->i_size != iinfo->i_lenExtents) { -udf_warn (inode->i_sb,"Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n" , - inode->i_ino, inode->i_mode, - (unsigned long long )inode->i_size, - (unsigned long long )iinfo->i_lenExtents); - }kfree (iinfo->i_ext.i_data); iinfo->i_ext.i_data =NULL ;udf_clear_extent_cache (inode);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 689/757 rtw88: increse the size of rx buffer size
In reply to Greg Kroah-HartmanFrom: Tzu-En Huang <[email protected]>
[ Upstream commit ee755732b7a16af018daa77d9562d2493fb7092f ]
The vht capability of MAX_MPDU_LENGTH is 11454 in rtw88; however, the rx buffer size for each packet is 8192. When receiving packets that are larger than rx buffer size, it will leads to rx buffer ring overflow.
--- drivers/net/wireless/realtek/rtw88/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/pci.h +2 -2
@@ -9,8 +9,8 @@#define RTK_BEQ_TX_DESC_NUM 256#define RTK_MAX_RX_DESC_NUM 512 -/* 8K + rx desc size */ -#define RTK_PCI_RX_BUF_SIZE (8192 + 24) +/* 11K + rx desc size */ +#define RTK_PCI_RX_BUF_SIZE (11454 + 24)#define RTK_PCI_CTRL 0x300#define BIT_RST_TRXDMA_INTF BIT(20)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 690/757 selftests/bpf: Fix overflow tests to reflect iter size increase
In reply to Greg Kroah-HartmanFrom: Alan Maguire <[email protected]>
[ Upstream commit eb58bbf2e5c7917aa30bf8818761f26bbeeb2290 ]
bpf iter size increase to PAGE_SIZE << 3 means overflow tests assuming page size need to be bumped also.
--- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_iter.c +7 -7
@@ -331,7 +331,7 @@ static void test_overflow(bool test_e2big_overflow, bool ret1)struct bpf_map_info map_info = {};struct bpf_iter_test_kern4 *skel;struct bpf_link *link; -__u32 page_size; +__u32 iter_size;char *buf; skel =bpf_iter_test_kern4__open ();
@@ -353,19 +353,19 @@ static void test_overflow(bool test_e2big_overflow, bool ret1) "map_creation failed: %s\n", strerror(errno))) goto free_map1; -/* bpf_seq_printf kernel buffer is one page, so one map +/* bpf_seq_printf kernel buffer is 8 pages, so one map * bpf_seq_write will mostly fill it, and the other map * will partially fill and then trigger overflow and need * bpf_seq_read restart. */ - page_size =sysconf (_SC_PAGE_SIZE); + iter_size =sysconf (_SC_PAGE_SIZE) <<3 ;if (test_e2big_overflow) { - skel->rodata->print_len = (page_size +8 ) /8 ; - expected_read_len =2 * (page_size +8 ); + skel->rodata->print_len = (iter_size +8 ) /8 ; + expected_read_len =2 * (iter_size +8 ); }else if (!ret1) { - skel->rodata->print_len = (page_size -8 ) /8 ; - expected_read_len =2 * (page_size -8 ); + skel->rodata->print_len = (iter_size -8 ) /8 ; + expected_read_len =2 * (iter_size -8 ); }else { skel->rodata->print_len =1 ; expected_read_len =2 *8 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 691/757 USB: cdc-acm: handle broken union descriptors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 960c7339de27c6d6fec13b54880501c3576bb08d ]
Handle broken union functional descriptors where the master-interface doesn't exist or where its class is of neither Communication or Data type (as required by the specification) by falling back to "combined-interface" probing.
Note that this still allows for handling union descriptors with switched interfaces.
This specifically makes the Whistler radio scanners TRX series devices work with the driver without adding further quirks to the device-id table.
--- drivers/usb/class/cdc-acm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/class/cdc-acm.c +12 -0
@@ -1243,9 +1243,21 @@ static int acm_probe(struct usb_interface *intf, } } }else { +int class =-1 ; + data_intf_num = union_header->bSlaveInterface0; control_interface =usb_ifnum_to_if (usb_dev, union_header->bMasterInterface0); data_interface =usb_ifnum_to_if (usb_dev, data_intf_num); + +if (control_interface) + class = control_interface->cur_altsetting->desc.bInterfaceClass; + +if (class !=USB_CLASS_COMM && class !=USB_CLASS_CDC_DATA ) { +dev_dbg (&intf->dev,"Broken union descriptor, assuming single interface\n" ); + combined_interfaces =1 ; + control_interface = data_interface = intf; + goto look_for_collapsed_interface; + } }if (!control_interface || !data_interface) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 692/757 mt76: mt7915: do not do any work in napi poll after calling napi_complete_done()
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 38b04398c532e9bb9aa90fc07846ad0b0845fe94 ]
Fixes a race condition where multiple tx cleanup or sta poll tasks could run in parallel.
--- drivers/net/wireless/mediatek/mt76/mt7915/dma.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/dma.c +3 -6
@@ -95,16 +95,13 @@ static int mt7915_poll_tx(struct napi_struct *napi, int budget) dev = container_of(napi, struct mt7915_dev, mt76.tx_napi);mt7915_tx_cleanup (dev); - -if (napi_complete_done (napi,0 )) -mt7915_irq_enable (dev,MT_INT_TX_DONE_ALL ); - -mt7915_tx_cleanup (dev); -mt7915_mac_sta_poll (dev);tasklet_schedule (&dev->mt76.tx_tasklet); +if (napi_complete_done (napi,0 )) +mt7915_irq_enable (dev,MT_INT_TX_DONE_ALL ); +return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 693/757 usb: dwc3: simple: add support for Hikey 970
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit b68d9251561f33661e53dd618f1cafe7ec9ec3c2 ]
This binding driver is needed for Hikey 970 to work, as otherwise a Serror is produced:
[ 1.837458] SError Interrupt on CPU0, code 0xbf000002 -- SError
[ 1.837462] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
[ 1.837463] Hardware name: HiKey970 (DT)
[ 1.837465] Workqueue: events deferred_probe_work_func
[ 1.837467] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--)
[ 1.837468] pc : _raw_spin_unlock_irqrestore+0x18/0x50
[ 1.837469] lr : regmap_unlock_spinlock+0x14/0x20
[ 1.837470] sp : ffff8000124dba60
[ 1.837471] x29: ffff8000124dba60 x28: 0000000000000000
[ 1.837474] x27: ffff0001b7e854c8 x26: ffff80001204ea18
[ 1.837476] x25: 0000000000000005 x24: ffff800011f918f8
[ 1.837479] x23: ffff800011fbb588 x22: ffff0001b7e40e00
[ 1.837481] x21: 0000000000000100 x20: 0000000000000000
[ 1.837483] x19: ffff0001b767ec00 x18: 00000000ff10c000
[ 1.837485] x17: 0000000000000002 x16: 0000b0740fdb9950
[ 1.837488] x15: ffff8000116c1198 x14: ffffffffffffffff
[ 1.837490] x13: 0000000000000030 x12: 0101010101010101
[ 1.837493] x11: 0000000000000020 x10: ffff0001bf17d130
[ 1.837495] x9 : 0000000000000000 x8 : ffff0001b6938080
[ 1.837497] x7 : 0000000000000000 x6 : 000000000000003f
[ 1.837500] x5 : 0000000000000000 x4 : 0000000000000000
[ 1.837502] x3 : ffff80001096a880 x2 : 0000000000000000
[ 1.837505] x1 : ffff0001b7e40e00 x0 : 0000000100000001
[ 1.837507] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 1.837509] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
[ 1.837510] Hardware name: HiKey970 (DT)
[ 1.837511] Workqueue: events deferred_probe_work_func
[ 1.837513] Call trace:
[ 1.837514] dump_backtrace+0x0/0x1e0
[ 1.837515] show_stack+0x18/0x24
[ 1.837516] dump_stack+0xc0/0x11c
[ 1.837517] panic+0x15c/0x324
[ 1.837518] nmi_panic+0x8c/0x90
[ 1.837519] arm64_serror_panic+0x78/0x84
[ 1.837520] do_serror+0x158/0x15c
[ 1.837521] el1_error+0x84/0x100
[ 1.837522] _raw_spin_unlock_irqrestore+0x18/0x50
[ 1.837523] regmap_write+0x58/0x80
[ 1.837524] hi3660_reset_deassert+0x28/0x34
[ 1.837526] reset_control_deassert+0x50/0x260
[ 1.837527] reset_control_deassert+0xf4/0x260
[ 1.837528] dwc3_probe+0x5dc/0xe6c
[ 1.837529] platform_drv_probe+0x54/0xb0
[ 1.837530] really_probe+0xe0/0x490
[ 1.837531] driver_probe_device+0xf4/0x160
[ 1.837532] __device_attach_driver+0x8c/0x114
[ 1.837533] bus_for_each_drv+0x78/0xcc
[ 1.837534] __device_attach+0x108/0x1a0
[ 1.837535] device_initial_probe+0x14/0x20
[ 1.837537] bus_probe_device+0x98/0xa0
[ 1.837538] deferred_probe_work_func+0x88/0xe0
[ 1.837539] process_one_work+0x1cc/0x350
[ 1.837540] worker_thread+0x2c0/0x470
[ 1.837541] kthread+0x154/0x160
[ 1.837542] ret_from_fork+0x10/0x30
[ 1.837569] SMP: stopping secondary CPUs
[ 1.837570] Kernel Offset: 0x1d0000 from 0xffff800010000000
[ 1.837571] PHYS_OFFSET: 0x0
[ 1.837572] CPU features: 0x240002,20882004
[ 1.837573] Memory Limit: none--- drivers/usb/dwc3/dwc3-of-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-of-simple.c +1 -0
@@ -176,6 +176,7 @@ static const struct of_device_id of_dwc3_simple_match[] = { { .compatible = "cavium,octeon-7130-usb-uctl" }, { .compatible = "sprd,sc9860-dwc3" }, { .compatible = "allwinner,sun50i-h6-dwc3" }, + { .compatible = "hisilicon,hi3670-dwc3" }, {/* Sentinel */ } };MODULE_DEVICE_TABLE (of, of_dwc3_simple_match);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 694/757 habanalabs: cast to u64 before shift > 31 bits
In reply to Greg Kroah-HartmanFrom: Oded Gabbay <[email protected]>
[ Upstream commit f763946aefe67b3ea58696b75a930ba1ed886a83 ]
When shifting a boolean variable by more than 31 bits and putting the result into a u64 variable, we need to cast the boolean into unsigned 64 bits to prevent possible overflow.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 8 +++++--- drivers/misc/habanalabs/goya/goya.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +5 -3
@@ -6099,7 +6099,7 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << + *mask |= ((u64 ) !is_eng_idle) << (GAUDI_ENGINE_ID_DMA_0 + dma_id);if (s) seq_printf(s, fmt, dma_id,
@@ -6122,7 +6122,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GAUDI_ENGINE_ID_TPC_0 + i);if (s) seq_printf(s, fmt, i, is_eng_idle ? "Y" : "N",
@@ -6150,7 +6151,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GAUDI_ENGINE_ID_MME_0 + i);if (s) {if (!is_slave) seq_printf(s, fmt, i,
drivers/misc/habanalabs/goya/goya.c +5 -3
@@ -5166,7 +5166,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GOYA_ENGINE_ID_DMA_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GOYA_ENGINE_ID_DMA_0 + i);if (s)seq_printf (s, dma_fmt, i, is_eng_idle ?"Y" :"N" , qm_glbl_sts0, dma_core_sts0);
@@ -5189,7 +5190,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GOYA_ENGINE_ID_TPC_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GOYA_ENGINE_ID_TPC_0 + i);if (s)seq_printf (s, fmt, i, is_eng_idle ?"Y" :"N" , qm_glbl_sts0, cmdq_glbl_sts0, tpc_cfg_sts);
@@ -5209,7 +5211,7 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle <<GOYA_ENGINE_ID_MME_0 ; + *mask |= ((u64 ) !is_eng_idle) <<GOYA_ENGINE_ID_MME_0 ;if (s) {seq_printf (s, fmt,0 , is_eng_idle ?"Y" :"N" , qm_glbl_sts0, cmdq_glbl_sts0, mme_arch_sts);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 695/757 can: flexcan: flexcan_chip_stop(): add error handling and propagate error value
In reply to Greg Kroah-HartmanFrom: Joakim Zhang <[email protected]>
[ Upstream commit 9ad02c7f4f279504bdd38ab706fdc97d5f2b2a9c ]
This patch implements error handling and propagates the error value of flexcan_chip_stop(). This function will be called from flexcan_suspend() in an upcoming patch in some SoCs which support LPSR mode.
Add a new function flexcan_chip_stop_disable_on_error() that tries to disable the chip even in case of errors.
--- drivers/net/can/flexcan.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/net/can/flexcan.c +28 -6
@@ -1260,18 +1260,23 @@ static int flexcan_chip_start(struct net_device *dev)return err; } -/* flexcan_chip_stop +/* __flexcan_chip_stop * -* this functions is entered with clocks enabled +* this function is entered with clocks enabled */ -static void flexcan_chip_stop (struct net_device *dev) +static int __flexcan_chip_stop (struct net_device *dev,bool disable_on_error) {struct flexcan_priv *priv =netdev_priv (dev);struct flexcan_regs __iomem *regs = priv->regs; +int err;/* freeze + disable module */ -flexcan_chip_freeze (priv); -flexcan_chip_disable (priv); + err =flexcan_chip_freeze (priv); +if (err && !disable_on_error) +return err; + err =flexcan_chip_disable (priv); +if (err && !disable_on_error) + goto out_chip_unfreeze;/* Disable all interrupts */ priv->write (0 , ®s->imask2);
@@ -1281,6 +1286,23 @@ static void flexcan_chip_stop(struct net_device *dev)flexcan_transceiver_disable (priv); priv->can.state =CAN_STATE_STOPPED ; + +return 0 ; + + out_chip_unfreeze: +flexcan_chip_unfreeze (priv); + +return err; +} + +static inline int flexcan_chip_stop_disable_on_error (struct net_device *dev) +{ +return __flexcan_chip_stop (dev, true); +} + +static inline int flexcan_chip_stop (struct net_device *dev) +{ +return __flexcan_chip_stop (dev, false); }static int flexcan_open (struct net_device *dev)
@@ -1362,7 +1384,7 @@ static int flexcan_close(struct net_device *dev)netif_stop_queue (dev);can_rx_offload_disable (&priv->offload); -flexcan_chip_stop (dev); +flexcan_chip_stop_disable_on_error (dev);can_rx_offload_del (&priv->offload);free_irq (dev->irq, dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 696/757 HID: multitouch: Lenovo X1 Tablet Gen3 trackpoint and buttons
In reply to Greg Kroah-HartmanFrom: Mikael Wikström <[email protected]>
[ Upstream commit 140958da9ab53a7df9e9ccc7678ea64655279ac1 ]
One more device that needs 40d5bb87 to resolve regression for the trackpoint and three mouse buttons on the type cover of the Lenovo X1 Tablet Gen3.
It is probably also needed for the Lenovo X1 Tablet Gen2 with PID 0x60a3
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -727,6 +727,7 @@#define USB_DEVICE_ID_LENOVO_TP10UBKBD 0x6062#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 +#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e
drivers/hid/hid-multitouch.c +6 -0
@@ -1973,6 +1973,12 @@ static const struct hid_device_id mt_devices[] = { HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC, USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) }, +/* Lenovo X1 TAB Gen 3 */ + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, +HID_DEVICE (BUS_USB ,HID_GROUP_MULTITOUCH_WIN_8 , +USB_VENDOR_ID_LENOVO , + USB_DEVICE_ID_LENOVO_X1_TAB3) }, + /* MosArt panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 697/757 ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs()
In reply to Greg Kroah-HartmanFrom: Brooke Basile <[email protected]>
[ Upstream commit 03fb92a432ea5abe5909bca1455b7e44a9380480 ]
Calls to usb_kill_anchored_urbs() after usb_kill_urb() on multiprocessor systems create a race condition in which usb_kill_anchored_urbs() deallocates the URB before the completer callback is called in usb_kill_urb(), resulting in a use-after-free.
To fix this, add proper lock protection to usb_kill_urb() calls that can possibly run concurrently with usb_kill_anchored_urbs().
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +19 -0
@@ -449,10 +449,19 @@ static void hif_usb_stop(void *hif_handle)spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);/* The pending URBs have to be canceled. */ +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_pending, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb); +list_del (&tx_buf->list); +usb_free_urb (tx_buf->urb); +kfree (tx_buf->buf); +kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_anchored_urbs (&hif_dev->mgmt_submitted); }
@@ -762,27 +771,37 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)struct tx_buf *tx_buf =NULL , *tx_buf_tmp =NULL ;unsigned long flags; +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_buf, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb);list_del (&tx_buf->list);usb_free_urb (tx_buf->urb);kfree (tx_buf->buf);kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); hif_dev->tx.flags |=HIF_USB_TX_FLUSH ;spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_pending, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb);list_del (&tx_buf->list);usb_free_urb (tx_buf->urb);kfree (tx_buf->buf);kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_anchored_urbs (&hif_dev->mgmt_submitted); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 698/757 drm/panfrost: add Amlogic GPU integration quirks
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit afcd0c7d3d4c22afc8befcfc906db6ce3058d3ee ]
This adds the required GPU quirks, including the quirk in the PWR registers at the GPU reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +11 -0
@@ -667,7 +667,18 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_quirk = panfrost_gpu_amlogic_quirk, +}; +static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 699/757 drm/panfrost: add amlogic reset quirk callback
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 110003002291525bb209f47e6dbf121a63249a97 ]
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented we do not know what does these values, but they permit having a fully functional GPU running with Panfrost.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 3 files changed, 17 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gpu.c +11 -0
@@ -75,6 +75,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; } +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order +* to operate correctly. +*/ +gpu_write (pfdev,GPU_PWR_KEY ,GPU_PWR_KEY_UNLOCK ); +gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 )); +} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;
drivers/gpu/drm/panfrost/panfrost_gpu.h +2 -0
@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);void panfrost_gpu_power_on (struct panfrost_device *pfdev);void panfrost_gpu_power_off (struct panfrost_device *pfdev); +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev); +#endif
drivers/gpu/drm/panfrost/panfrost_regs.h +4 -0
@@ -51,6 +51,10 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x50/* (WO) Power manager key register */ +#define GPU_PWR_KEY_UNLOCK 0x2968A819 +#define GPU_PWR_OVERRIDE0 0x54/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x58/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 700/757 drm/panfrost: add support for vendor quirk
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 91e89097b86f566636ea5a7329c79d5521be46d2 ]
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers after each reset.
This adds a callback in the device compatible struct of permit this.
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/panfrost/panfrost_device.h +3 -0
@@ -69,6 +69,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* Vendor implementation quirks callback */ +void (*vendor_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -0
@@ -146,6 +146,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)if (quirks)gpu_write (pfdev,GPU_JM_CONFIG , quirks); + +/* Here goes platform specific quirks */ +if (pfdev->comp->vendor_quirk) + pfdev->comp->vendor_quirk (pfdev); }#define MAX_HW_REVS 6
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 701/757 bpf: Limit callers stack depth 256 for subprogs with tailcalls
In reply to Greg Kroah-HartmanFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit 7f6e4312e15a5c370e84eaa685879b6bdcc717e4 ]
Protect against potential stack overflow that might happen when bpf2bpf calls get combined with tailcalls. Limit the caller's stack depth for such case down to 256 so that the worst case scenario would result in 8k stack size (32 which is tailcall limit * 256 = 8k).
--- include/linux/bpf_verifier.h | 1 + kernel/bpf/verifier.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
include/linux/bpf_verifier.h +1 -0
@@ -358,6 +358,7 @@ struct bpf_subprog_info {u32 start;/* insn idx of function entry point */ u32 linfo_idx;/* The idx to the main_prog->aux->linfo */ u16 stack_depth;/* max. stack depth used by this function */ +bool has_tail_call; };/* single container for all structs
kernel/bpf/verifier.c +29 -0
@@ -1489,6 +1489,10 @@ static int check_subprogs(struct bpf_verifier_env *env)for (i =0 ; i < insn_cnt; i++) {u8 code = insn[i].code; +if (code == (BPF_JMP |BPF_CALL ) && + insn[i].imm == BPF_FUNC_tail_call && + insn[i].src_reg !=BPF_PSEUDO_CALL ) + subprog[cur_subprog].has_tail_call = true;if (BPF_CLASS (code) !=BPF_JMP &&BPF_CLASS (code) !=BPF_JMP32 ) goto next;if (BPF_OP (code) ==BPF_EXIT ||BPF_OP (code) ==BPF_CALL )
@@ -2974,6 +2978,31 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)int ret_prog[MAX_CALL_FRAMES ]; process_func: +/* protect against potential stack overflow that might happen when +* bpf2bpf calls get combined with tailcalls. Limit the caller's stack +* depth for such case down to 256 so that the worst case scenario +* would result in 8k stack size (32 which is tailcall limit * 256 = +* 8k). +* +* To get the idea what might happen, see an example: +* func1 -> sub rsp, 128 +* subfunc1 -> sub rsp, 256 +* tailcall1 -> add rsp, 256 +* func2 -> sub rsp, 192 (total stack size = 128 + 192 = 320) +* subfunc2 -> sub rsp, 64 +* subfunc22 -> sub rsp, 128 +* tailcall2 -> add rsp, 128 +* func3 -> sub rsp, 32 (total stack size 128 + 192 + 64 + 32 = 416) +* +* tailcall will unwind the current stack frame but it will not get rid +* of caller's stack as shown on the example above. +*/ +if (idx && subprog[idx].has_tail_call && depth >=256 ) { +verbose (env, +"tail_calls are not allowed when call stack of previous frames is %d bytes. Too large\n" , + depth); +return -EACCES ; + }/* round up to 32-bytes, since this is granularity * of interpreter stack size */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 702/757 dma-direct: Fix potential NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Thomas Tai <[email protected]>
[ Upstream commit f959dcd6ddfd29235030e8026471ac1b022ad2b0 ]
When booting the kernel v5.9-rc4 on a VM, the kernel would panic when printing a warning message in swiotlb_map(). The dev->dma_mask must not be a NULL pointer when calling the dma mapping layer. A NULL pointer check can potentially avoid the panic.
--- include/linux/dma-direct.h | 3 --- kernel/dma/mapping.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
include/linux/dma-direct.h +0 -3
@@ -62,9 +62,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size, {dma_addr_t end = addr + size -1 ; -if (!dev->dma_mask) -return false; -if (is_ram && !IS_ENABLED (CONFIG_ARCH_DMA_ADDR_T_64BIT ) &&min (addr, end) <phys_to_dma (dev,PFN_PHYS (min_low_pfn)))return false;
kernel/dma/mapping.c +11 -0
@@ -144,6 +144,10 @@ dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,dma_addr_t addr;BUG_ON (!valid_dma_direction (dir)); + +if (WARN_ON_ONCE (!dev->dma_mask)) +return DMA_MAPPING_ERROR ; +if (dma_map_direct (dev, ops)) addr =dma_direct_map_page (dev, page, offset, size, dir, attrs);else
@@ -179,6 +183,10 @@ int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents,int ents;BUG_ON (!valid_dma_direction (dir)); + +if (WARN_ON_ONCE (!dev->dma_mask)) +return 0 ; +if (dma_map_direct (dev, ops)) ents =dma_direct_map_sg (dev, sg, nents, dir, attrs);else
@@ -213,6 +221,9 @@ dma_addr_t dma_map_resource(struct device *dev, phys_addr_t phys_addr,BUG_ON (!valid_dma_direction (dir)); +if (WARN_ON_ONCE (!dev->dma_mask)) +return DMA_MAPPING_ERROR ; +/* Don't allow RAM to be mapped */ if (WARN_ON_ONCE (pfn_valid (PHYS_PFN (phys_addr))))return DMA_MAPPING_ERROR ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 703/757 misc: rtsx: Fix memory leak in rtsx_pci_probe
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
[ Upstream commit bc28369c6189009b66d9619dd9f09bd8c684bb98 ]
When mfd_add_devices() fail, pcr->slots should also be freed. However, the current implementation does not free the member, leading to a memory leak.
Fix this by adding a new goto label that frees pcr->slots.
--- drivers/misc/cardreader/rtsx_pcr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/cardreader/rtsx_pcr.c +3 -1
@@ -1562,12 +1562,14 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, ret =mfd_add_devices (&pcidev->dev, pcr->id, rtsx_pcr_cells,ARRAY_SIZE (rtsx_pcr_cells),NULL ,0 ,NULL );if (ret <0 ) - goto disable_irq; + goto free_slots;schedule_delayed_work (&pcr->idle_work,msecs_to_jiffies (200 ));return 0 ; +free_slots: +kfree (pcr->slots); disable_irq:free_irq (pcr->irq, (void *)pcr); disable_msi:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 704/757 reiserfs: only call unlock_new_inode() if I_NEW
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 8859bf2b1278d064a139e3031451524a49a56bd0 ]
unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.
This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).
--- fs/reiserfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/inode.c +2 -1
@@ -2159,7 +2159,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, out_inserted_sd:clear_nlink (inode); th->t_trans_id =0 ;/* so the caller can't use this handle later */ -unlock_new_inode (inode);/* OK to do even if we hadn't locked it */ +if (inode->i_state &I_NEW ) +unlock_new_inode (inode);iput (inode);return err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 705/757 opp: Prevent memory leak in dev_pm_opp_attach_genpd()
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit cb60e9602cce1593eb1e9cdc8ee562815078a354 ]
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU sharing the table), then it would result in unwanted behavior like memory leak, attaching the domain multiple times, etc.
Handle that by checking and returning earlier if the domains are already attached. Now that dev_pm_opp_detach_genpd() can get called multiple times as well, we need to protect that too.
Note that the virtual device pointers aren't returned in this case, as they may become unavailable to some callers during the middle of the operation.
--- drivers/opp/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/opp/core.c +6 -0
@@ -1949,6 +1949,9 @@ static void _opp_detach_genpd(struct opp_table *opp_table) {int index; +if (!opp_table->genpd_virt_devs) +return ; +for (index =0 ; index < opp_table->required_opp_count; index++) {if (!opp_table->genpd_virt_devs[index])continue ;
@@ -1995,6 +1998,9 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,if (!opp_table)return ERR_PTR (-ENOMEM ); +if (opp_table->genpd_virt_devs) +return opp_table; +/* * If the genpd's OPP table isn't already initialized, parsing of the * required-opps fail for dev. We should retry this after genpd's OPP
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 706/757 xfs: make sure the rt allocator doesnt run off the end
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 2a6ca4baed620303d414934aa1b7b0a8e7bab05f ]
There's an overflow bug in the realtime allocator. If the rt volume is large enough to handle a single allocation request that is larger than the maximum bmap extent length and the rt bitmap ends exactly on a bitmap block boundary, it's possible that the near allocator will try to check the freeness of a range that extends past the end of the bitmap. This fails with a corruption error and shuts down the fs.
Therefore, constrain maxlen so that the range scan cannot run off the end of the rt bitmap.
--- fs/xfs/xfs_rtalloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/xfs/xfs_rtalloc.c +11 -0
@@ -247,6 +247,9 @@ xfs_rtallocate_extent_block( end =XFS_BLOCKTOBIT (mp, bbno +1 ) -1 ; i <= end; i++) { +/* Make sure we don't scan off the end of the rt volume. */ + maxlen =min (mp->m_sb.sb_rextents, i + maxlen) - i; +/* * See if there's a free extent of maxlen starting at i. * If it's not so then next will contain the first non-free.
@@ -442,6 +445,14 @@ xfs_rtallocate_extent_near(*/ if (bno >= mp->m_sb.sb_rextents) bno = mp->m_sb.sb_rextents -1 ; + +/* Make sure we don't run off the end of the rt volume. */ + maxlen =min (mp->m_sb.sb_rextents, bno + maxlen) - bno; +if (maxlen < minlen) { + *rtblock =NULLRTBLOCK ; +return 0 ; + } +/* * Try the exact allocation first. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 707/757 usb: ohci: Default to per-port over-current protection
In reply to Greg Kroah-HartmanFrom: Hamish Martin <[email protected]>
[ Upstream commit b77d2a0a223bc139ee8904991b2922d215d02636 ]
Some integrated OHCI controller hubs do not expose all ports of the hub to pins on the SoC. In some cases the unconnected ports generate spurious over-current events. For example the Broadcom 56060/Ranger 2 SoC contains a nominally 3 port hub but only the first port is wired.
Default behaviour for ohci-platform driver is to use global over-current protection mode (AKA "ganged"). This leads to the spurious over-current events affecting all ports in the hub.
We now alter the default to use per-port over-current protection.
This patch results in the following configuration changes depending on quirks:
- For quirk OHCI_QUIRK_SUPERIO no changes. These systems remain set up for ganged power switching and no over-current protection.
- For quirk OHCI_QUIRK_AMD756 or OHCI_QUIRK_HUB_POWER power switching remains at none, while over-current protection is now guaranteed to be set to per-port rather than the previous behaviour where it was either none or global over-current protection depending on the value at function entry.
--- drivers/usb/host/ohci-hcd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/host/ohci-hcd.c +10 -6
@@ -673,20 +673,24 @@ static int ohci_run (struct ohci_hcd *ohci)/* handle root hub init quirks ... */ val =roothub_a (ohci); - val &= ~(RH_A_PSM |RH_A_OCPM ); +/* Configure for per-port over-current protection by default */ + val &= ~RH_A_NOCP ; + val |=RH_A_OCPM ;if (ohci->flags &OHCI_QUIRK_SUPERIO ) { -/* NSC 87560 and maybe others */ +/* NSC 87560 and maybe others. +* Ganged power switching, no over-current protection. +*/ val |=RH_A_NOCP ; - val &= ~(RH_A_POTPGT |RH_A_NPS ); -ohci_writel (ohci, val, &ohci->regs->roothub.a); + val &= ~(RH_A_POTPGT |RH_A_NPS |RH_A_PSM |RH_A_OCPM ); }else if ((ohci->flags &OHCI_QUIRK_AMD756 ) || (ohci->flags &OHCI_QUIRK_HUB_POWER )) {/* hub power always on; required for AMD-756 and some -* Mac platforms. ganged overcurrent reporting, if any. +* Mac platforms. */ val |=RH_A_NPS ; -ohci_writel (ohci, val, &ohci->regs->roothub.a); } +ohci_writel (ohci, val, &ohci->regs->roothub.a); +ohci_writel (ohci,RH_HS_LPSC , &ohci->regs->roothub.status);ohci_writel (ohci, (val &RH_A_NPS ) ?0 :RH_B_PPCM , &ohci->regs->roothub.b);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 708/757 drm: fix double free for gbo in drm_gem_vram_init and drm_gem_vram_create
In reply to Greg Kroah-HartmanFrom: Jia Yang <[email protected]>
[ Upstream commit da62cb7230f0871c30dc9789071f63229158d261 ]
I got a use-after-free report when doing some fuzz test:
If ttm_bo_init() fails, the "gbo" and "gbo->bo.base" will be freed by ttm_buffer_object_destroy() in ttm_bo_init(). But then drm_gem_vram_create() and drm_gem_vram_init() will free "gbo" and "gbo->bo.base" again.
BUG: KMSAN: use-after-free in drm_vma_offset_remove+0xb3/0x150 CPU: 0 PID: 24282 Comm: syz-executor.1 Tainted: G B W 5.7.0-rc4-msan #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack dump_stack+0x1c9/0x220 kmsan_report+0xf7/0x1e0 __msan_warning+0x58/0xa0 drm_vma_offset_remove+0xb3/0x150 drm_gem_free_mmap_offset drm_gem_object_release+0x159/0x180 drm_gem_vram_init drm_gem_vram_create+0x7c5/0x990 drm_gem_vram_fill_create_dumb drm_gem_vram_driver_dumb_create+0x238/0x590 drm_mode_create_dumb drm_mode_create_dumb_ioctl+0x41d/0x450 drm_ioctl_kernel+0x5a4/0x710 drm_ioctl+0xc6f/0x1240 vfs_ioctl ksys_ioctl __do_sys_ioctl __se_sys_ioctl+0x2e9/0x410 __x64_sys_ioctl+0x4a/0x70 do_syscall_64+0xb8/0x160 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x4689b9 Code: fd e0 fa ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb e0 fa ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f368fa4dc98 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000076bf00 RCX: 00000000004689b9 RDX: 0000000020000240 RSI: 00000000c02064b2 RDI: 0000000000000003 RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00000000004d17e0 R14: 00007f368fa4e6d4 R15: 000000000076bf0c
Uninit was created at:
kmsan_save_stack_with_flags
kmsan_internal_poison_shadow+0x66/0xd0 kmsan_slab_free+0x6e/0xb0 slab_free_freelist_hook slab_free kfree+0x571/0x30a0 drm_gem_vram_destroy ttm_buffer_object_destroy+0xc8/0x130 ttm_bo_release kref_put ttm_bo_put+0x117d/0x23e0 ttm_bo_init_reserved+0x11c0/0x11d0 ttm_bo_init+0x289/0x3f0 drm_gem_vram_init drm_gem_vram_create+0x775/0x990 drm_gem_vram_fill_create_dumb drm_gem_vram_driver_dumb_create+0x238/0x590 drm_mode_create_dumb drm_mode_create_dumb_ioctl+0x41d/0x450 drm_ioctl_kernel+0x5a4/0x710 drm_ioctl+0xc6f/0x1240 vfs_ioctl ksys_ioctl __do_sys_ioctl __se_sys_ioctl+0x2e9/0x410 __x64_sys_ioctl+0x4a/0x70 do_syscall_64+0xb8/0x160 entry_SYSCALL_64_after_hwframe+0x44/0xa9
If ttm_bo_init() fails, the "gbo" will be freed by ttm_buffer_object_destroy() in ttm_bo_init(). But then drm_gem_vram_create() and drm_gem_vram_init() will free "gbo" again.
--- drivers/gpu/drm/drm_gem_vram_helper.c | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +16 -12
@@ -167,6 +167,10 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, } } +/* +* Note that on error, drm_gem_vram_init will free the buffer object. +*/ +static int drm_gem_vram_init (struct drm_device *dev,struct drm_gem_vram_object *gbo,size_t size,unsigned long pg_align)
@@ -176,15 +180,19 @@ static int drm_gem_vram_init(struct drm_device *dev,int ret;size_t acc_size; -if (WARN_ONCE (!vmm,"VRAM MM not initialized" )) +if (WARN_ONCE (!vmm,"VRAM MM not initialized" )) { +kfree (gbo);return -EINVAL ; + } bdev = &vmm->bdev; gbo->bo.base.funcs = &drm_gem_vram_object_funcs; ret =drm_gem_object_init (dev, &gbo->bo.base, size); -if (ret) +if (ret) { +kfree (gbo);return ret; + } acc_size =ttm_bo_dma_acc_size (bdev, size,sizeof (*gbo));
@@ -195,13 +203,13 @@ static int drm_gem_vram_init(struct drm_device *dev, &gbo->placement, pg_align, false, acc_size, NULL, NULL, ttm_buffer_object_destroy);if (ret) - goto err_drm_gem_object_release; +/* +* A failing ttm_bo_init will call ttm_buffer_object_destroy +* to release gbo->bo.base and kfree gbo. +*/ +return ret;return 0 ; - -err_drm_gem_object_release: -drm_gem_object_release (&gbo->bo.base); -return ret; }/**
@@ -235,13 +243,9 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev, ret =drm_gem_vram_init (dev, gbo, size, pg_align);if (ret <0 ) - goto err_kfree; +return ERR_PTR (ret);return gbo; - -err_kfree: -kfree (gbo); -return ERR_PTR (ret); }EXPORT_SYMBOL (drm_gem_vram_create);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 709/757 Bluetooth: Only mark socket zapped after unlocking
In reply to Greg Kroah-HartmanFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit 20ae4089d0afeb24e9ceb026b996bfa55c983cc2 ]
Since l2cap_sock_teardown_cb doesn't acquire the channel lock before setting the socket as zapped, it could potentially race with l2cap_sock_release which frees the socket. Thus, wait until the cleanup is complete before marking the socket as zapped.
This race was reproduced on a JBL GO speaker after the remote device rejected L2CAP connection due to resource unavailability.
Here is a dmesg log with debug logs from a repro of this bug:
[ 3465.424086] Bluetooth: hci_core.c:hci_acldata_packet() hci0 len 16 handle 0x0003 flags 0x0002 [ 3465.424090] Bluetooth: hci_conn.c:hci_conn_enter_active_mode() hcon 00000000cfedd07d mode 0 [ 3465.424094] Bluetooth: l2cap_core.c:l2cap_recv_acldata() conn 000000007eae8952 len 16 flags 0x2 [ 3465.424098] Bluetooth: l2cap_core.c:l2cap_recv_frame() len 12, cid 0x0001 [ 3465.424102] Bluetooth: l2cap_core.c:l2cap_raw_recv() conn 000000007eae8952 [ 3465.424175] Bluetooth: l2cap_core.c:l2cap_sig_channel() code 0x03 len 8 id 0x0c [ 3465.424180] Bluetooth: l2cap_core.c:l2cap_connect_create_rsp() dcid 0x0045 scid 0x0000 result 0x02 status 0x00 [ 3465.424189] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 4 [ 3465.424196] Bluetooth: l2cap_core.c:l2cap_chan_del() chan 000000006acf9bff, conn 000000007eae8952, err 111, state BT_CONNECT [ 3465.424203] Bluetooth: l2cap_sock.c:l2cap_sock_teardown_cb() chan 000000006acf9bff state BT_CONNECT [ 3465.424221] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 3 [ 3465.424226] Bluetooth: hci_core.h:hci_conn_drop() hcon 00000000cfedd07d orig refcnt 6 [ 3465.424234] BUG: spinlock bad magic on CPU#2, kworker/u17:0/159 [ 3465.425626] Bluetooth: hci_sock.c:hci_sock_sendmsg() sock 000000002bb0cb64 sk 00000000a7964053 [ 3465.430330] lock: 0xffffff804410aac0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 3465.430332] Causing a watchdog bite!
--- net/bluetooth/l2cap_sock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/bluetooth/l2cap_sock.c +4 -3
@@ -1521,8 +1521,6 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err) parent =bt_sk (sk)->parent; -sock_set_flag (sk,SOCK_ZAPPED ); -switch (chan->state) {case BT_OPEN :case BT_BOUND :
@@ -1549,8 +1547,11 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)break ; } -release_sock (sk); + +/* Only zap after cleanup to avoid use after free race */ +sock_set_flag (sk,SOCK_ZAPPED ); + } static void l2cap_sock_state_change_cb(struct l2cap_chan *chan, int state,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 710/757 drm/msm/a6xx: fix a potential overflow issue
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit 08d3ab4b46339bc6f97e83b54a3fb4f8bf8f4cd9 ]
It's allocating an array of a6xx_gpu_state_obj structure rathor than its pointers.
This patch fix it.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +1 -1
@@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,int i; a6xx_state->indexed_regs =state_kcalloc (a6xx_state, count, -sizeof (a6xx_state->indexed_regs)); +sizeof (*a6xx_state->indexed_regs));if (!a6xx_state->indexed_regs)return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 711/757 drm/xlnx: Use devm_drm_dev_alloc
In reply to Greg Kroah-HartmanFrom: Daniel Vetter <[email protected]>
[ Upstream commit 075342ea3d93044d68f821cf91c1a1a7d2fa569e ]
Gets rid of drmm_add_final_kfree, which I want to unexport so that it stops confusion people about this transitional state of rolling drm managed memory out.
This also fixes the missing drm_dev_put in the error path of the probe code.
v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all other paths leaked on error, this should have been in zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of devm_drm_dev_alloc.
--- drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)
drivers/gpu/drm/xlnx/zynqmp_dpsub.c +6 -21
@@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)/* Initialize mode config, vblank and the KMS poll helper. */ ret =drmm_mode_config_init (drm);if (ret <0 ) - goto err_dev_put; +return ret; drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs; drm->mode_config.min_width =0 ;
@@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub) ret =drm_vblank_init (drm,1 );if (ret) - goto err_dev_put; +return ret; drm->irq_enabled =1 ;
@@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub) err_poll_fini:drm_kms_helper_poll_fini (drm); -err_dev_put: -drm_dev_put (drm);return ret; }
@@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)int ret;/* Allocate private data. */ - dpsub =kzalloc (sizeof (*dpsub),GFP_KERNEL ); -if (!dpsub) -return -ENOMEM ; + dpsub =devm_drm_dev_alloc (&pdev->dev, &zynqmp_dpsub_drm_driver, + struct zynqmp_dpsub, drm); +if (IS_ERR (dpsub)) +return PTR_ERR (dpsub); dpsub->dev = &pdev->dev;platform_set_drvdata (pdev, dpsub);dma_set_mask (dpsub->dev,DMA_BIT_MASK (ZYNQMP_DISP_MAX_DMA_BIT )); -/* -* Initialize the DRM device early, as the DRM core mandates usage of -* the managed memory helpers tied to the DRM device. -*/ - ret =drm_dev_init (&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev); -if (ret <0 ) { -kfree (dpsub); -return ret; - } - -drmm_add_final_kfree (&dpsub->drm, dpsub); -/* Try the reserved memory. Proceed if there's none. */ of_reserved_mem_device_init (&pdev->dev);
@@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)clk_disable_unprepare (dpsub->apb_clk);of_reserved_mem_device_release (&pdev->dev); -drm_dev_put (drm); -return 0 ; }
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 712/757 iomap: fix WARN_ON_ONCE() from unprivileged users
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit a805c111650cdba6ee880f528abdd03c1af82089 ]
It is trivial to trigger a WARN_ON_ONCE(1) in iomap_dio_actor() by unprivileged users which would taint the kernel, or worse - panic if panic_on_warn or panic_on_taint is set. Hence, just convert it to pr_warn_ratelimited() to let users know their workloads are racing. Thank Dave Chinner for the initial analysis of the racing reproducers.
--- fs/iomap/direct-io.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/iomap/direct-io.c +10 -0
@@ -388,6 +388,16 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length,return iomap_dio_bio_actor (inode, pos, length, dio, iomap);case IOMAP_INLINE :return iomap_dio_inline_actor (inode, pos, length, dio, iomap); +case IOMAP_DELALLOC : +/* +* DIO is not serialised against mmap() access at all, and so +* if the page_mkwrite occurs between the writeback and the +* iomap_apply() call in the DIO path, then it will see the +* DELALLOC block that the page-mkwrite allocated. +*/ +pr_warn_ratelimited ("Direct I/O collision with buffered writes! File: %pD4 Comm: %.20s\n" , + dio->iocb->ki_filp, current->comm); +return -EIO ;default :WARN_ON_ONCE (1 );return -EIO ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 713/757 scsi: ibmvfc: Fix error return in ibmvfc_probe()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit 5e48a084f4e824e1b624d3fd7ddcf53d2ba69e53 ]
Fix to return error code PTR_ERR() from the error handling case instead of 0.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ibmvscsi/ibmvfc.c +1 -0
@@ -4928,6 +4928,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)if (IS_ERR (vhost->work_thread)) {dev_err (dev,"Couldn't create kernel thread: %ld\n" ,PTR_ERR (vhost->work_thread)); + rc =PTR_ERR (vhost->work_thread); goto free_host_mem; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 714/757 scsi: qla2xxx: Warn if done() or free() are called on an already freed srb
In reply to Greg Kroah-HartmanFrom: Daniel Wagner <[email protected]>
[ Upstream commit c0014f94218ea3a312f6235febea0d626c5f2154 ]
Emit a warning when ->done or ->free are called on an already freed srb. There is a hidden use-after-free bug in the driver which corrupts the srb memory pool which originates from the cleanup callbacks.
An extensive search didn't bring any lights on the real problem. The initial fix was to set both pointers to NULL and try to catch invalid accesses. But instead the memory corruption was gone and the driver didn't crash. Since not all calling places check for NULL pointer, add explicitly default handlers. With this we workaround the memory corruption and add a debug help.
--- drivers/scsi/qla2xxx/qla_init.c | 10 ++++++++++ drivers/scsi/qla2xxx/qla_inline.h | 5 +++++ 2 files changed, 15 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +10 -0
@@ -63,6 +63,16 @@ void qla2x00_sp_free(srb_t *sp)qla2x00_rel_sp (sp); } +void qla2xxx_rel_done_warning (srb_t *sp,int res) +{ +WARN_ONCE (1 ,"Calling done() of an already freed srb %p object\n" , sp); +} + +void qla2xxx_rel_free_warning (srb_t *sp) +{ +WARN_ONCE (1 ,"Calling free() of an already freed srb %p object\n" , sp); +} +/* Asynchronous Login/Logout Routines -------------------------------------- */ unsigned long
drivers/scsi/qla2xxx/qla_inline.h +5 -0
@@ -207,10 +207,15 @@ qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair,return sp; } +void qla2xxx_rel_done_warning (srb_t *sp,int res); +void qla2xxx_rel_free_warning (srb_t *sp); +static inline void qla2xxx_rel_qpair_sp (struct qla_qpair *qpair,srb_t *sp) { sp->qpair =NULL ; + sp->done = qla2xxx_rel_done_warning; + sp->free = qla2xxx_rel_free_warning;mempool_free (sp, qpair->srb_mempool);QLA_QPAIR_MARK_NOT_BUSY (qpair); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 715/757 selftests/bpf: Fix test_sysctl_loop{1, 2} failure due to clang change
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 7fb5eefd76394cfefb380724a87ca40b47d44405 ]
Andrii reported that with latest clang, when building selftests, we have
error likes:
error: progs/test_sysctl_loop1.c:23:16: in function sysctl_tcp_mem i32 (%struct.bpf_sysctl*):
Looks like the BPF stack limit of 512 bytes is exceeded.
Please move large on stack variables into BPF per-cpu array map.
The error is triggered by the following LLVM patch:
https://reviews.llvm.org/D87134
For example, the following code is from test_sysctl_loop1.c:
static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx)
{
volatile char tcp_mem_name[] = "net/ipv4/tcp_mem/very_very_very_very_long_pointless_string";
... }
Without the above LLVM patch, the compiler did optimization to load the string (59 bytes long) with 7 64bit loads, 1 8bit load and 1 16bit load, occupying 64 byte stack size.
With the above LLVM patch, the compiler only uses 8bit loads, but subregister is 32bit. So stack requirements become 4 * 59 = 236 bytes. Together with other stuff on the stack, total stack size exceeds 512 bytes, hence compiler complains and quits.
To fix the issue, removing "volatile" key word or changing "volatile" to "const"/"static const" does not work, the string is put in .rodata.str1.1 section, which libbpf did not process it and errors out with
libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
libbpf: prog 'sysctl_tcp_mem': bad map relo against '.L__const.is_tcp_mem.tcp_mem_name'
in section '.rodata.str1.1'
Defining the string const as global variable can fix the issue as it puts the string constant in '.rodata' section which is recognized by libbpf. In the future, when libbpf can process '.rodata.str*.*' properly, the global definition can be changed back to local definition.
Defining tcp_mem_name as a global, however, triggered a verifier failure.
./test_progs -n 7/21
libbpf: load bpf program failed: Permission denied
libbpf: -- BEGIN DUMP LOG ---
libbpf:
invalid stack off=0 size=1
verification time 6975 usec
stack depth 160+64
processed 889 insns (limit 1000000) max_states_per_insn 4 total_states 14 peak_states 14 mark_read 10
libbpf: -- END LOG --
libbpf: failed to load program 'sysctl_tcp_mem'
libbpf: failed to load object 'test_sysctl_loop2.o' test_bpf_verif_scale:FAIL:114
#7/21 test_sysctl_loop2.o:FAIL
This actually exposed a bpf program bug. In test_sysctl_loop{1,2}, we have code like
const char tcp_mem_name[] = "<...long string...>";
...
char name[64];
...
for (i = 0; i < sizeof(tcp_mem_name); ++i)
if (name[i] != tcp_mem_name[i])
return 0;In the above code, if sizeof(tcp_mem_name) > 64, name[i] access may be out of bound. The sizeof(tcp_mem_name) is 59 for test_sysctl_loop1.c and 79 for test_sysctl_loop2.c.
Without promotion-to-global change, old compiler generates code where the overflowed stack access is actually filled with valid value, so hiding the bpf program bug. With promotion-to-global change, the code is different, more specifically, the previous loading constants to stack is gone, and "name" occupies stack[-64:0] and overflow access triggers a verifier error. To fix the issue, adjust "name" buffer size properly.
--- tools/testing/selftests/bpf/progs/test_sysctl_loop1.c | 4 ++-- tools/testing/selftests/bpf/progs/test_sysctl_loop2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/progs/test_sysctl_loop1.c +2 -2
@@ -18,11 +18,11 @@#define MAX_ULONG_STR_LEN 7#define MAX_VALUE_STR_LEN (TCP_MEM_LOOPS * MAX_ULONG_STR_LEN) +const char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string" ; static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx) { -volatile char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string" ;unsigned char i; -char name[64 ]; +char name[sizeof (tcp_mem_name)];int ret;memset (name,0 ,sizeof (name));
tools/testing/selftests/bpf/progs/test_sysctl_loop2.c +2 -2
@@ -18,11 +18,11 @@#define MAX_ULONG_STR_LEN 7#define MAX_VALUE_STR_LEN (TCP_MEM_LOOPS * MAX_ULONG_STR_LEN) +const char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string_to_stress_byte_loop" ;static __attribute__((noinline))int is_tcp_mem (struct bpf_sysctl *ctx) { -volatile char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string_to_stress_byte_loop" ;unsigned char i; -char name[64 ]; +char name[sizeof (tcp_mem_name)];int ret;memset (name,0 ,sizeof (name));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 716/757 soundwire: cadence: fix race condition between suspend and Slave device alerts
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit d2068da5c85697b5880483dd7beaba98e0b62e02 ]
In system suspend stress cases, the SOF CI reports timeouts. The root cause is that an alert is generated while the system suspends. The interrupt handling generates transactions on the bus that will never be handled because the interrupts are disabled in parallel.
As a result, the transaction never completes and times out on resume. This error doesn't seem too problematic since it happens in a work queue, and the system recovers without issues.
Nevertheless, this race condition should not happen. When doing a system suspend, or when disabling interrupts, we should make sure the current transaction can complete, and prevent new work from being queued.
--- drivers/soundwire/cadence_master.c | 24 +++++++++++++++++++++++- drivers/soundwire/cadence_master.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-)
drivers/soundwire/cadence_master.c +23 -1
@@ -791,7 +791,16 @@ irqreturn_t sdw_cdns_irq(int irq, void *dev_id) CDNS_MCP_INT_SLAVE_MASK, 0); int_status &= ~CDNS_MCP_INT_SLAVE_MASK ; -schedule_work (&cdns->work); + +/* +* Deal with possible race condition between interrupt +* handling and disabling interrupts on suspend. +* +* If the master is in the process of disabling +* interrupts, don't schedule a workqueue +*/ +if (cdns->interrupt_enabled) +schedule_work (&cdns->work); }cdns_writel (cdns,CDNS_MCP_INTSTAT , int_status);
@@ -924,6 +933,19 @@ int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state) slave_state =cdns_readl (cdns,CDNS_MCP_SLAVE_INTSTAT1 );cdns_writel (cdns,CDNS_MCP_SLAVE_INTSTAT1 , slave_state); } + cdns->interrupt_enabled = state; + +/* +* Complete any on-going status updates before updating masks, +* and cancel queued status updates. +* +* There could be a race with a new interrupt thrown before +* the 3 mask updates below are complete, so in the interrupt +* we use the 'interrupt_enabled' status to prevent new work +* from being queued. +*/ +if (!state) +cancel_work_sync (&cdns->work);cdns_writel (cdns,CDNS_MCP_SLAVE_INTMASK0 , slave_intmask0);cdns_writel (cdns,CDNS_MCP_SLAVE_INTMASK1 , slave_intmask1);
drivers/soundwire/cadence_master.h +1 -0
@@ -129,6 +129,7 @@ struct sdw_cdns {bool link_up;unsigned int msg_count; +bool interrupt_enabled;struct work_struct work;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 717/757 brcmsmac: fix memory leak in wlc_phy_attach_lcnphy
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
[ Upstream commit f4443293d741d1776b86ed1dd8c4e4285d0775fc ]
When wlc_phy_txpwr_srom_read_lcnphy fails in wlc_phy_attach_lcnphy, the allocated pi->u.pi_lcnphy is leaked, since struct brcms_phy will be freed in the caller function.
Fix this by calling wlc_phy_detach_lcnphy in the error handler of wlc_phy_txpwr_srom_read_lcnphy before returning.
--- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +3 -1
@@ -5065,8 +5065,10 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft; pi->pi_fptr.detach = wlc_phy_detach_lcnphy; -if (!wlc_phy_txpwr_srom_read_lcnphy (pi)) +if (!wlc_phy_txpwr_srom_read_lcnphy (pi)) { +kfree (pi->u.pi_lcnphy);return false; + }if (LCNREV_IS (pi->pubpi.phy_rev,1 )) {if (pi_lcn->lcnphy_tempsense_option ==3 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 718/757 rtl8xxxu: prevent potential memory leak
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
[ Upstream commit 86279456a4d47782398d3cb8193f78f672e36cac ]
Free the skb if usb_submit_urb fails on rx_urb. And free the urb no matter usb_submit_urb succeeds or not in rtl8xxxu_submit_int_urb.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +9 -1
@@ -5795,7 +5795,6 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) ret =usb_submit_urb (urb,GFP_KERNEL );if (ret) {usb_unanchor_urb (urb); -usb_free_urb (urb); goto error; }
@@ -5804,6 +5803,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw)rtl8xxxu_write32 (priv,REG_USB_HIMR , val32); error: +usb_free_urb (urb);return ret; }
@@ -6318,6 +6318,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)struct rtl8xxxu_priv *priv = hw->priv;struct rtl8xxxu_rx_urb *rx_urb;struct rtl8xxxu_tx_urb *tx_urb; +struct sk_buff *skb;unsigned long flags;int ret, i;
@@ -6368,6 +6369,13 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) rx_urb->hw = hw; ret =rtl8xxxu_submit_rx_urb (priv, rx_urb); +if (ret) { +if (ret != -ENOMEM ) { + skb = (struct sk_buff *)rx_urb->urb.context; +dev_kfree_skb (skb); + } +rtl8xxxu_queue_rx_urb (priv, rx_urb); + } }schedule_delayed_work (&priv->ra_watchdog,2 *HZ );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 719/757 Fix use after free in get_capset_info callback.
In reply to Greg Kroah-HartmanFrom: Doug Horn <[email protected]>
[ Upstream commit e219688fc5c3d0d9136f8d29d7e0498388f01440 ]
If a response to virtio_gpu_cmd_get_capset_info takes longer than five seconds to return, the callback will access freed kernel memory in vg->capsets.
--- drivers/gpu/drm/virtio/virtgpu_kms.c | 2 ++ drivers/gpu/drm/virtio/virtgpu_vq.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_kms.c +2 -0
@@ -80,8 +80,10 @@ static void virtio_gpu_get_capsets(struct virtio_gpu_device *vgdev, vgdev->capsets[i].id > 0, 5 * HZ);if (ret ==0 ) {DRM_ERROR ("timed out waiting for cap set %d\n" , i); +spin_lock (&vgdev->display_info_lock);kfree (vgdev->capsets); vgdev->capsets =NULL ; +spin_unlock (&vgdev->display_info_lock);return ; } DRM_INFO("cap set %d: id %d, max-version %d, max-size %d\n",
drivers/gpu/drm/virtio/virtgpu_vq.c +7 -3
@@ -684,9 +684,13 @@ static void virtio_gpu_cmd_get_capset_info_cb(struct virtio_gpu_device *vgdev,int i =le32_to_cpu (cmd->capset_index);spin_lock (&vgdev->display_info_lock); - vgdev->capsets[i].id =le32_to_cpu (resp->capset_id); - vgdev->capsets[i].max_version =le32_to_cpu (resp->capset_max_version); - vgdev->capsets[i].max_size =le32_to_cpu (resp->capset_max_size); +if (vgdev->capsets) { + vgdev->capsets[i].id =le32_to_cpu (resp->capset_id); + vgdev->capsets[i].max_version =le32_to_cpu (resp->capset_max_version); + vgdev->capsets[i].max_size =le32_to_cpu (resp->capset_max_size); + }else { +DRM_ERROR ("invalid capset memory." ); + }spin_unlock (&vgdev->display_info_lock);wake_up (&vgdev->resp_wq); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 720/757 HID: ite: Add USB id match for Acer One S1003 keyboard dock
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 5bf2f2f331ad812c9b7eea6e14a3ea328acbffc0 ]
The Acer One S1003 2-in-1 keyboard dock uses a Synaptics S910xx touchpad which is connected to an ITE 8910 USB keyboard controller chip.
This keyboard has the same quirk for its rfkill / airplane mode hotkey as other keyboards with ITE keyboard chips, it only sends a single release event when pressed and released, it never sends a press event.
This commit adds this keyboards USB id to the hid-ite id-table, fixing the rfkill key not working on this keyboard. Note that like for the Acer Aspire Switch 10 (SW5-012) the id-table entry matches on the HID_GROUP_GENERIC generic group so that hid-ite only binds to the keyboard interface and the mouse/touchpad interface is left untouched so that hid-multitouch can bind to it.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-ite.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1124,6 +1124,7 @@#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 +#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
drivers/hid/hid-ite.c +4 -0
@@ -44,6 +44,10 @@ static const struct hid_device_id ite_devices[] = { {HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC ,USB_VENDOR_ID_SYNAPTICS , USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, +/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */ + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, +USB_VENDOR_ID_SYNAPTICS , + USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003) }, { } };MODULE_DEVICE_TABLE (hid, ite_devices);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 721/757 scsi: qedf: Return SUCCESS if stale rport is encountered
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
[ Upstream commit 10aff62fab263ad7661780816551420cea956ebb ]
If SUCCESS is not returned, error handling will escalate. Return SUCCESS similar to other conditions in this function.
--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -726,7 +726,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) rdata = fcport->rdata;if (!rdata || !kref_get_unless_zero (&rdata->kref)) {QEDF_ERR (&qedf->dbg_ctx,"stale rport, sc_cmd=%p\n" , sc_cmd); - rc =1 ; + rc =SUCCESS ; goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 722/757 scsi: qedi: Mark all connections for recovery on link down event
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit 4118879be3755b38171063dfd4a57611d4b20a83 ]
For short time cable pulls, the in-flight I/O to the firmware is never cleaned up, resulting in the behaviour of stale I/O completion causing list_del corruption and soft lockup of the system.
On link down event, mark all the connections for recovery, causing cleanup of all the in-flight I/O immediately.
--- drivers/scsi/qedi/qedi_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/qedi/qedi_main.c +10 -0
@@ -1127,6 +1127,15 @@ static void qedi_schedule_recovery_handler(void *dev)schedule_delayed_work (&qedi->recovery_work,0 ); } +static void qedi_set_conn_recovery (struct iscsi_cls_session *cls_session) +{ +struct iscsi_session *session = cls_session->dd_data; +struct iscsi_conn *conn = session->leadconn; +struct qedi_conn *qedi_conn = conn->dd_data; + +qedi_start_conn_recovery (qedi_conn->qedi, qedi_conn); +} +static void qedi_link_update (void *dev,struct qed_link_output *link) {struct qedi_ctx *qedi = (struct qedi_ctx *)dev;
@@ -1138,6 +1147,7 @@ static void qedi_link_update(void *dev, struct qed_link_output *link)QEDI_INFO (&qedi->dbg_ctx,QEDI_LOG_INFO ,"Link Down event.\n" );atomic_set (&qedi->link_state,QEDI_LINK_DOWN ); +iscsi_host_for_each_session (qedi->shost, qedi_set_conn_recovery); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 723/757 scsi: qedi: Protect active command list to avoid list corruption
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit c0650e28448d606c84f76c34333dba30f61de993 ]
Protect active command list for non-I/O commands like login response, logout response, text response, and recovery cleanup of active list to avoid list corruption.
--- drivers/scsi/qedi/qedi_fw.c | 8 ++++++++ drivers/scsi/qedi/qedi_iscsi.c | 2 ++ 2 files changed, 10 insertions(+)
drivers/scsi/qedi/qedi_fw.c +8 -0
@@ -59,6 +59,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi,"Freeing tid=0x%x for cid=0x%x\n" , cmd->task_id, qedi_conn->iscsi_conn_id); +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd);
@@ -69,6 +70,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, cmd->task_id, qedi_conn->iscsi_conn_id, &cmd->io_cmd); } +spin_unlock (&qedi_conn->list_lock); cmd->state =RESPONSE_RECEIVED ;qedi_clear_task_idx (qedi, cmd->task_id);
@@ -122,6 +124,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi,"Freeing tid=0x%x for cid=0x%x\n" , cmd->task_id, qedi_conn->iscsi_conn_id); +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd);
@@ -132,6 +135,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, cmd->task_id, qedi_conn->iscsi_conn_id, &cmd->io_cmd); } +spin_unlock (&qedi_conn->list_lock); cmd->state =RESPONSE_RECEIVED ;qedi_clear_task_idx (qedi, cmd->task_id);
@@ -222,11 +226,13 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, tmf_hdr = (struct iscsi_tm *)qedi_cmd->task->hdr; +spin_lock (&qedi_conn->list_lock);if (likely (qedi_cmd->io_cmd_in_list)) { qedi_cmd->io_cmd_in_list = false;list_del_init (&qedi_cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock); if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) ||
@@ -288,11 +294,13 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi,ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK ; qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len; +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock);memset (task_ctx,'\0' ,sizeof (*task_ctx));
drivers/scsi/qedi/qedi_iscsi.c +2 -0
@@ -975,11 +975,13 @@ static void qedi_cleanup_active_cmd_list(struct qedi_conn *qedi_conn) {struct qedi_cmd *cmd, *cmd_tmp; +spin_lock (&qedi_conn->list_lock);list_for_each_entry_safe (cmd, cmd_tmp, &qedi_conn->active_cmd_list, io_cmd) {list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock); }static void qedi_ep_disconnect (struct iscsi_endpoint *ep)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 724/757 scsi: qedi: Fix list_del corruption while removing active I/O
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit 28b35d17f9f8573d4646dd8df08917a4076a6b63 ]
While aborting the I/O, the firmware cleanup task timed out and driver deleted the I/O from active command list. Some time later the firmware sent the cleanup task response and driver again deleted the I/O from active command list causing firmware to send completion for non-existent I/O and list_del corruption of active command list.
Add fix to check if I/O is present before deleting it from the active command list to ensure firmware sends valid I/O completion and protect against list_del corruption.
--- drivers/scsi/qedi/qedi_fw.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/scsi/qedi/qedi_fw.c +11 -4
@@ -824,8 +824,11 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,qedi_clear_task_idx (qedi_conn->qedi, rtid);spin_lock (&qedi_conn->list_lock); -list_del_init (&dbg_cmd->io_cmd); - qedi_conn->active_cmd_count--; +if (likely (dbg_cmd->io_cmd_in_list)) { + dbg_cmd->io_cmd_in_list = false; +list_del_init (&dbg_cmd->io_cmd); + qedi_conn->active_cmd_count--; + }spin_unlock (&qedi_conn->list_lock); qedi_cmd->state =CLEANUP_RECV ;wake_up_interruptible (&qedi_conn->wait_queue);
@@ -1243,6 +1246,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, qedi_conn->cmd_cleanup_req++;qedi_iscsi_cleanup_task (ctask, true); + cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; QEDI_WARN(&qedi->dbg_ctx,
@@ -1454,8 +1458,11 @@ static void qedi_tmf_work(struct work_struct *work)spin_unlock_bh (&qedi_conn->tmf_work_lock);spin_lock (&qedi_conn->list_lock); -list_del_init (&cmd->io_cmd); - qedi_conn->active_cmd_count--; +if (likely (cmd->io_cmd_in_list)) { + cmd->io_cmd_in_list = false; +list_del_init (&cmd->io_cmd); + qedi_conn->active_cmd_count--; + }spin_unlock (&qedi_conn->list_lock);clear_bit (QEDI_CONN_FW_CLEANUP , &qedi_conn->flags);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 725/757 fbmem: add margin check to fb_check_caps()
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
[ Upstream commit a49145acfb975d921464b84fe00279f99827d816 ]
A fb_ioctl() FBIOPUT_VSCREENINFO call with invalid xres setting or yres setting in struct fb_var_screeninfo will result in a
KASAN: vmalloc-out-of-bounds failure in bitfill_aligned() as
the margins are being cleared. The margins are cleared in chunks and if the xres setting or yres setting is a value of zero upto the chunk size, the failure will occur.
Add a margin check to validate xres and yres settings.
--- drivers/video/fbdev/core/fbmem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/video/fbdev/core/fbmem.c +4 -0
@@ -1006,6 +1006,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)return 0 ; } +/* bitfill_aligned() assumes that it's at least 8x8 */ +if (var->xres <8 || var->yres <8 ) +return -EINVAL ; + ret = info->fbops->fb_check_var (var, info);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 726/757 tty: ipwireless: fix error handling
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit db332356222d9429731ab9395c89cca403828460 ]
ipwireless_send_packet() can only return 0 on success and -ENOMEM on error, the caller should check non zero for error condition
--- drivers/tty/ipwireless/network.c | 4 ++-- drivers/tty/ipwireless/tty.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/tty/ipwireless/network.c +2 -2
@@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, skb->len, notify_packet_sent, network); -if (ret ==-1 ) { +if (ret <0 ) {skb_pull (skb,2 );return 0 ; }
@@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, notify_packet_sent, network);kfree (buf); -if (ret ==-1 ) +if (ret <0 )return 0 ; }kfree_skb (skb);
drivers/tty/ipwireless/tty.c +1 -1
@@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty, ret =ipwireless_send_packet (tty->hardware,IPW_CHANNEL_RAS , buf, count, ipw_write_packet_sent_callback, tty); -if (ret ==-1 ) { +if (ret <0 ) {mutex_unlock (&tty->ipw_tty_mutex);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 727/757 Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d33fe77bdf75806d785dabf90d21d962122e5296 ]
When kmalloc() on buf fails, urb should be freed just like when kmalloc() on dr fails.
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -2896,6 +2896,7 @@ static int btusb_mtk_submit_wmt_recv_urb(struct hci_dev *hdev) buf =kmalloc (size,GFP_KERNEL );if (!buf) {kfree (dr); +usb_free_urb (urb);return -ENOMEM ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 728/757 ipvs: Fix uninit-value in do_ip_vs_set_ctl()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit c5a8a8498eed1c164afc94f50a939c1a10abf8ad ]
do_ip_vs_set_ctl() is referencing uninitialized stack value when len is zero. Fix it.
--- net/netfilter/ipvs/ip_vs_ctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +4 -3
@@ -2508,6 +2508,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, sockptr_t ptr, unsigned int len)/* Set timeout values for (tcp tcpfin udp) */ ret =ip_vs_set_timeout (ipvs, (struct ip_vs_timeout_user *)arg); goto out_unlock; + }else if (!len) { +/* No more commands with len == 0 below */ + ret = -EINVAL ; + goto out_unlock; } usvc_compat = (struct ip_vs_service_user *)arg;
@@ -2584,9 +2588,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, sockptr_t ptr, unsigned int len)break ;case IP_VS_SO_SET_DELDEST : ret =ip_vs_del_dest (svc, &udest); -break ; -default : - ret = -EINVAL ; } out_unlock:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 729/757 reiserfs: Fix memory leak in reiserfs_parse_options()
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit e9d4709fcc26353df12070566970f080e651f0c9 ]
When a usrjquota or grpjquota mount option is used multiple times, we will leak memory allocated for the file name. Make sure the last setting is used and all the previous ones are properly freed.
--- fs/reiserfs/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/reiserfs/super.c +4 -4
@@ -1258,6 +1258,10 @@ static int reiserfs_parse_options(struct super_block *s, "turned on.");return 0 ; } +if (qf_names[qtype] != +REISERFS_SB (s)->s_qf_names[qtype]) +kfree (qf_names[qtype]); + qf_names[qtype] =NULL ; if (*arg) { /* Some filename specified? */ if (REISERFS_SB(s)->s_qf_names[qtype] && strcmp(REISERFS_SB(s)->s_qf_names[qtype],
@@ -1287,10 +1291,6 @@ static int reiserfs_parse_options(struct super_block *s,else *mount_options |=1 <<REISERFS_GRPQUOTA ; }else { -if (qf_names[qtype] != -REISERFS_SB (s)->s_qf_names[qtype]) -kfree (qf_names[qtype]); - qf_names[qtype] =NULL ;if (qtype ==USRQUOTA ) *mount_options &= ~(1 <<REISERFS_USRQUOTA );else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 730/757 s390/qeth: strictly order bridge address events
In reply to Greg Kroah-HartmanFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 9d6a569a4cbab5a8b4c959d4e312daeecb7c9f09 ]
The current code for bridge address events has two shortcomings in its control sequence:
1. after disabling address events via PNSO, we don't flush the remaining events from the event_wq. So if the feature is re-enabled fast enough, stale events could leak over.
2. PNSO and the events' arrival via the READ ccw device are unordered. So even if we flushed the workqueue, it's difficult to say whether the READ device might produce more events onto the workqueue afterwards.
Fix this by
1. explicitly fencing off the events when we no longer care, in the READ device's event handler. This ensures that once we flush the workqueue, it doesn't get additional address events.
2. Flush the workqueue after disabling the events & fencing them off. As the code that triggers the flush will typically hold the sbp_lock, we need to rework the worker code to avoid a deadlock here in case of a 'notifications-stopped' event. In case of lock contention, requeue such an event with a delay. We'll eventually aquire the lock, or spot that the feature has been disabled and the event can thus be discarded.
This leaves the theoretical race that a stale event could arrive _after_ we re-enabled ourselves to receive events again. Such an event would be impossible to distinguish from a 'good' event, nothing we can do about it.
--- drivers/s390/net/qeth_core.h | 6 ++++ drivers/s390/net/qeth_l2_main.c | 53 ++++++++++++++++++++++++++++----- drivers/s390/net/qeth_l2_sys.c | 1 + 3 files changed, 52 insertions(+), 8 deletions(-)
drivers/s390/net/qeth_core.h +6 -0
@@ -680,6 +680,11 @@ struct qeth_card_blkt {int inter_packet_jumbo; }; +enum qeth_pnso_mode { +QETH_PNSO_NONE , +QETH_PNSO_BRIDGEPORT , +}; +#define QETH_BROADCAST_WITH_ECHO 0x01#define QETH_BROADCAST_WITHOUT_ECHO 0x02struct qeth_card_info {
@@ -696,6 +701,7 @@ struct qeth_card_info {/* no bitfield, we take a pointer on these two: */ u8 has_lp2lp_cso_v6;u8 has_lp2lp_cso_v4; +enum qeth_pnso_mode pnso_mode;enum qeth_card_types type;enum qeth_link_types link_type;int broadcast_capable;
drivers/s390/net/qeth_l2_main.c +45 -8
117 lines not on this page · raw message
drivers/s390/net/qeth_l2_sys.c +1 -0
@@ -157,6 +157,7 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev, rc = -EBUSY ; else if (qeth_card_hw_is_reachable(card)) { rc =qeth_bridgeport_an_set (card, enable); +/* sbp_lock ensures ordering vs notifications-stopped events */ if (!rc) card->options.sbp.hostnotification = enable; } else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 731/757 mwifiex: dont call del_timer_sync() on uninitialized timer
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 621a3a8b1c0ecf16e1e5667ea5756a76a082b738 ]
syzbot is reporting that del_timer_sync() is called from mwifiex_usb_cleanup_tx_aggr() from mwifiex_unregister_dev() without checking timer_setup() from mwifiex_usb_tx_init() was called [1].
Ganapathi Bhat proposed a possibly cleaner fix, but it seems that that fix was forgotten [2].
"grep -FrB1 'del_timer' drivers/ | grep -FA1 '.function)'" says that currently there are 28 locations which call del_timer[_sync]() only if that timer's function field was initialized (because timer_setup() sets that timer's function field). Therefore, let's use same approach here.
[1] https://syzkaller.appspot.com/bug?id=26525f643f454dd7be0078423e3cdb0d57744959
[2] https://lkml.kernel.org/r/CA+ASDXMHt2gq9Hy+iP_BYkWXsSreWdp3_bAfMkNcuqJ3K+-jbQ@mail.gmail.com
--- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/usb.c +2 -1
@@ -1353,7 +1353,8 @@ static void mwifiex_usb_cleanup_tx_aggr(struct mwifiex_adapter *adapter) skb_dequeue(&port->tx_aggr.aggr_list)))mwifiex_write_data_complete (adapter, skb_tmp,0 ,-1 ); -del_timer_sync (&port->tx_aggr.timer_cnxt.hold_timer); +if (port->tx_aggr.timer_cnxt.hold_timer.function) +del_timer_sync (&port->tx_aggr.timer_cnxt.hold_timer); port->tx_aggr.timer_cnxt.is_hold_timer_set = false; port->tx_aggr.timer_cnxt.hold_tmo_msecs =0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 732/757 ALSA: hda/ca0132 - Add AE-7 microphone selection commands.
In reply to Greg Kroah-HartmanFrom: Connor McAdams <[email protected]>
[ Upstream commit ed93f9750c6c2ed371347d0aac3dcd31cb9cf256 ]
Add AE-7 quirk data for setting of microphone. The AE-7 has no front panel connector, so only rear-mic/line-in have new commands.
--- sound/pci/hda/patch_ca0132.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +21 -1
@@ -4675,6 +4675,15 @@ static int ca0132_alt_select_in(struct hda_codec *codec)ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 ); tmp =FLOAT_THREE ;break ; +case QUIRK_AE7 : +ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 ); + tmp =FLOAT_THREE ; +chipio_set_conn_rate (codec,MEM_CONNID_MICIN2 , +SR_96_000 ); +chipio_set_conn_rate (codec,MEM_CONNID_MICOUT2 , +SR_96_000 ); +dspio_set_uint_param (codec,0x80 ,0x01 ,FLOAT_ZERO ); +break ;default : tmp =FLOAT_ONE ;break ;
@@ -4720,6 +4729,14 @@ static int ca0132_alt_select_in(struct hda_codec *codec)case QUIRK_AE5 :ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 );break ; +case QUIRK_AE7 : +ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x3f ); +chipio_set_conn_rate (codec,MEM_CONNID_MICIN2 , +SR_96_000 ); +chipio_set_conn_rate (codec,MEM_CONNID_MICOUT2 , +SR_96_000 ); +dspio_set_uint_param (codec,0x80 ,0x01 ,FLOAT_ZERO ); +break ;default :break ; }
@@ -4729,7 +4746,10 @@ static int ca0132_alt_select_in(struct hda_codec *codec)if (ca0132_quirk (spec) ==QUIRK_R3DI )chipio_set_conn_rate (codec,0x0F ,SR_96_000 ); - tmp =FLOAT_ZERO ; +if (ca0132_quirk (spec) ==QUIRK_AE7 ) + tmp =FLOAT_THREE ; +else + tmp =FLOAT_ZERO ;dspio_set_uint_param (codec,0x80 ,0x00 , tmp);switch (ca0132_quirk (spec)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 733/757 ALSA: hda/ca0132 - Add new quirk ID for SoundBlaster AE-7.
In reply to Greg Kroah-HartmanFrom: Connor McAdams <[email protected]>
[ Upstream commit 620f08eea6d6961b789af3fa3ea86725c8c93ece ]
Add a new PCI subsystem ID for the SoundBlaster AE-7 card.
--- sound/pci/hda/patch_ca0132.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_ca0132.c +2 -0
@@ -1065,6 +1065,7 @@ enum {QUIRK_R3DI ,QUIRK_R3D ,QUIRK_AE5 , + QUIRK_AE7, };#ifdef CONFIG_PCI
@@ -1184,6 +1185,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = {SND_PCI_QUIRK (0x1102 ,0x0013 ,"Recon3D" ,QUIRK_R3D ),SND_PCI_QUIRK (0x1102 ,0x0018 ,"Recon3D" ,QUIRK_R3D ),SND_PCI_QUIRK (0x1102 ,0x0051 ,"Sound Blaster AE-5" ,QUIRK_AE5 ), + SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7), {} };
Signature · 1 line
2.25.1
Re: [PATCH 5.9 733/757] ALSA: hda/ca0132 - Add new quirk ID for SoundBlaster AE-7.
Quoted 11 lines · Greg Kroah-Hartman
From: Connor McAdams <[email protected]>
[ Upstream commit
620f08eea6d6961b789af3fa3ea86725c8c93ece]Add a new PCI subsystem ID for the SoundBlaster AE-7 card.
Signed-off-by Connor McAdams <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sorry to be delayed for reviewing.
This patch and the commit ed93f9750c6c lookl wrong to be picked up for stable. AE-7 won't work without the full backport, and this and another patches only just a part of iceberg.
Please drop them.
thanks,
Takashi
Greg Kroah-Hartman
maintainerPATCH 734/757 ASoC: SOF: Add topology filename override based on dmi data match
In reply to Greg Kroah-HartmanFrom: Sathyanarayana Nujella <[email protected]>
[ Upstream commit 5253a73d567dcd75e62834ff5f502ea9470e5722 ]
Add topology filename override based on system DMI data matching, typically to account for a different hardware layout.
In ACPI based systems, the tplg_filename is pre-defined in an ACPI machine table. When a DMI quirk is detected, the sof_pdata->tplg_filename is not set with the hard-coded ACPI value, and instead is set with the DMI-specific filename.
--- sound/soc/sof/intel/hda.c | 8 +++++++- sound/soc/sof/sof-pci-dev.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
sound/soc/sof/intel/hda.c +7 -1
@@ -1179,7 +1179,13 @@ void hda_machine_select(struct snd_sof_dev *sdev) mach =snd_soc_acpi_find_machine (desc->machines);if (mach) { - sof_pdata->tplg_filename = mach->sof_tplg_filename; +/* +* If tplg file name is overridden, use it instead of +* the one set in mach table +*/ +if (!sof_pdata->tplg_filename) + sof_pdata->tplg_filename = mach->sof_tplg_filename; + sof_pdata->machine = mach;if (mach->link_mask) {
sound/soc/sof/sof-pci-dev.c +24 -0
@@ -35,8 +35,28 @@ static int sof_pci_debug;module_param_named (sof_pci_debug, sof_pci_debug, int,0444 );MODULE_PARM_DESC (sof_pci_debug,"SOF PCI debug options (0x0 all off)" ); +static const char *sof_override_tplg_name; +#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) +static int sof_tplg_cb (const struct dmi_system_id *id) +{ + sof_override_tplg_name = id->driver_data; +return 1 ; +} + +static const struct dmi_system_id sof_tplg_table[] = { + { + .callback = sof_tplg_cb, + .matches = { +DMI_MATCH (DMI_PRODUCT_FAMILY ,"Google_Volteer" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Terrador" ), + }, + .driver_data ="sof-tgl-rt5682-ssp0-max98373-ssp2.tplg" , + }, + {} +}; +static const struct dmi_system_id community_key_platforms[] = { { .ident ="Up Squared" ,
@@ -347,6 +367,10 @@ static int sof_pci_probe(struct pci_dev *pci, sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path; +dmi_check_system (sof_tplg_table); +if (sof_override_tplg_name) + sof_pdata->tplg_filename = sof_override_tplg_name; +#if IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )/* set callback to enable runtime_pm */ sof_pdata->sof_probe_complete = sof_pci_probe_complete;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 735/757 ASoC: Intel: sof_rt5682: override quirk data for tgl_max98373_rt5682
In reply to Greg Kroah-HartmanFrom: Sathyanarayana Nujella <[email protected]>
[ Upstream commit 3e1734b64ce786c54dc98adcfe67941e6011d735 ]
A Chrome System based on tgl_max98373_rt5682 has different SSP interface configurations. Using DMI data of this variant DUT, override quirk data.
--- sound/soc/intel/boards/sof_rt5682.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/intel/boards/sof_rt5682.c +13 -0
@@ -119,6 +119,19 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { .driver_data = (void *)(SOF_RT5682_MCLK_EN | SOF_RT5682_SSP_CODEC(0)), }, + { + .callback = sof_rt5682_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Terrador"), + }, + .driver_data = (void *)(SOF_RT5682_MCLK_EN | + SOF_RT5682_SSP_CODEC(0) | + SOF_SPEAKER_AMP_PRESENT | + SOF_MAX98373_SPEAKER_AMP_PRESENT | + SOF_RT5682_SSP_AMP(2) | + SOF_RT5682_NUM_HDMIDEV(4)), + }, {} };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 736/757 scsi: smartpqi: Avoid crashing kernel for controller issues
In reply to Greg Kroah-HartmanFrom: Kevin Barnett <[email protected]>
[ Upstream commit 9e68cccc8ef7206f0bccd590378d0dca8f9b4f57 ]
Eliminate kernel panics when getting invalid responses from controller. Take controller offline instead of causing kernel panics.
--- drivers/scsi/smartpqi/smartpqi.h | 2 +- drivers/scsi/smartpqi/smartpqi_init.c | 101 +++++++++++++++++--------- 2 files changed, 68 insertions(+), 35 deletions(-)
drivers/scsi/smartpqi/smartpqi.h +1 -1
@@ -359,7 +359,7 @@ struct pqi_event_response {struct pqi_iu_header header;u8 event_type; u8 reserved2 : 7; - u8 request_acknowlege : 1; + u8 request_acknowledge : 1;__le16 event_id;__le32 additional_event_id;union {
drivers/scsi/smartpqi/smartpqi_init.c +67 -34
191 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 737/757 brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 6c151410d5b57e6bb0d91a735ac511459539a7bf ]
When brcmf_proto_msgbuf_attach fail and msgbuf->txflow_wq != NULL, we should destroy the workqueue.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +2 -0
@@ -1620,6 +1620,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)BRCMF_TX_IOCTL_MAX_MSG_SIZE , msgbuf->ioctbuf, msgbuf->ioctbuf_handle); +if (msgbuf->txflow_wq) +destroy_workqueue (msgbuf->txflow_wq);kfree (msgbuf); }return -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 738/757 usb: core: Solve race condition in anchor cleanup functions
In reply to Greg Kroah-HartmanFrom: Eli Billauer <[email protected]>
[ Upstream commit fbc299437c06648afcc7891e6e2e6638dd48d4df ]
usb_kill_anchored_urbs() is commonly used to cancel all URBs on an anchor just before releasing resources which the URBs rely on. By doing so, users of this function rely on that no completer callbacks will take place from any URB on the anchor after it returns.
However if this function is called in parallel with __usb_hcd_giveback_urb processing a URB on the anchor, the latter may call the completer callback after usb_kill_anchored_urbs() returns. This can lead to a kernel panic due to use after release of memory in interrupt context.
The race condition is that __usb_hcd_giveback_urb() first unanchors the URB and then makes the completer callback. Such URB is hence invisible to usb_kill_anchored_urbs(), allowing it to return before the completer has been called, since the anchor's urb_list is empty.
Even worse, if the racing completer callback resubmits the URB, it may remain in the system long after usb_kill_anchored_urbs() returns.
Hence list_empty(&anchor->urb_list), which is used in the existing while-loop, doesn't reliably ensure that all URBs of the anchor are gone.
A similar problem exists with usb_poison_anchored_urbs() and usb_scuttle_anchored_urbs().
This patch adds an external do-while loop, which ensures that all URBs are indeed handled before these three functions return. This change has no effect at all unless the race condition occurs, in which case the loop will busy-wait until the racing completer callback has finished. This is a rare condition, so the CPU waste of this spinning is negligible.
The additional do-while loop relies on usb_anchor_check_wakeup(), which returns true iff the anchor list is empty, and there is no __usb_hcd_giveback_urb() in the system that is in the middle of the unanchor-before-complete phase. The @suspend_wakeups member of struct usb_anchor is used for this purpose, which was introduced to solve another problem which the same race condition causes, in commit 6ec4147e7bdb ("usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done").
The surely_empty variable is necessary, because usb_anchor_check_wakeup() must be called with the lock held to prevent races. However the spinlock must be released and reacquired if the outer loop spins with an empty URB list while waiting for the unanchor-before-complete passage to finish:
The completer callback may very well attempt to take the very same lock.
To summarize, using usb_anchor_check_wakeup() means that the patched functions can return only when the anchor's list is empty, and there is no invisible URB being processed. Since the inner while loop finishes on the empty list condition, the new do-while loop will terminate as well, except for when the said race condition occurs.
--- drivers/usb/core/urb.c | 89 +++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 35 deletions(-)
drivers/usb/core/urb.c +54 -35
@@ -772,11 +772,12 @@ void usb_block_urb(struct urb *urb)EXPORT_SYMBOL_GPL (usb_block_urb);/** -* usb_kill_anchored_urbs - cancel transfer requests en masse +* usb_kill_anchored_urbs - kill all URBs associated with an anchor * @anchor: anchor the requests are bound to * -* this allows all outstanding URBs to be killed starting -* from the back of the queue +* This kills all outstanding URBs starting from the back of the queue, +* with guarantee that no completer callbacks will take place from the +* anchor after this function returns. * * This routine should not be called by a driver after its disconnect * method has returned.
@@ -784,20 +785,26 @@ EXPORT_SYMBOL_GPL(usb_block_urb);void usb_kill_anchored_urbs (struct usb_anchor *anchor) {struct urb *victim; +int surely_empty; -spin_lock_irq (&anchor->lock); -while (!list_empty (&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.prev, struct urb, - anchor_list); -/* we must make sure the URB isn't freed before we kill it*/ -usb_get_urb (victim); -spin_unlock_irq (&anchor->lock); -/* this will unanchor the URB */ -usb_kill_urb (victim); -usb_put_urb (victim); +do {spin_lock_irq (&anchor->lock); - } -spin_unlock_irq (&anchor->lock); +while (!list_empty (&anchor->urb_list)) { + victim =list_entry (anchor->urb_list.prev, + struct urb, anchor_list); +/* make sure the URB isn't freed before we kill it */ +usb_get_urb (victim); +spin_unlock_irq (&anchor->lock); +/* this will unanchor the URB */ +usb_kill_urb (victim); +usb_put_urb (victim); +spin_lock_irq (&anchor->lock); + } + surely_empty =usb_anchor_check_wakeup (anchor); + +spin_unlock_irq (&anchor->lock); +cpu_relax (); + }while (!surely_empty); }EXPORT_SYMBOL_GPL (usb_kill_anchored_urbs);
@@ -816,21 +823,27 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);void usb_poison_anchored_urbs (struct usb_anchor *anchor) {struct urb *victim; +int surely_empty; -spin_lock_irq (&anchor->lock); - anchor->poisoned =1 ; -while (!list_empty (&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.prev, struct urb, - anchor_list); -/* we must make sure the URB isn't freed before we kill it*/ -usb_get_urb (victim); -spin_unlock_irq (&anchor->lock); -/* this will unanchor the URB */ -usb_poison_urb (victim); -usb_put_urb (victim); +do {spin_lock_irq (&anchor->lock); - } -spin_unlock_irq (&anchor->lock); + anchor->poisoned =1 ; +while (!list_empty (&anchor->urb_list)) { + victim =list_entry (anchor->urb_list.prev, + struct urb, anchor_list); +/* make sure the URB isn't freed before we kill it */ +usb_get_urb (victim); +spin_unlock_irq (&anchor->lock); +/* this will unanchor the URB */ +usb_poison_urb (victim); +usb_put_urb (victim); +spin_lock_irq (&anchor->lock); + } + surely_empty =usb_anchor_check_wakeup (anchor); + +spin_unlock_irq (&anchor->lock); +cpu_relax (); + }while (!surely_empty); }EXPORT_SYMBOL_GPL (usb_poison_anchored_urbs);
@@ -970,14 +983,20 @@ void usb_scuttle_anchored_urbs(struct usb_anchor *anchor) {struct urb *victim;unsigned long flags; +int surely_empty; + +do { +spin_lock_irqsave (&anchor->lock, flags); +while (!list_empty (&anchor->urb_list)) { + victim =list_entry (anchor->urb_list.prev, + struct urb, anchor_list); +__usb_unanchor_urb (victim, anchor); + } + surely_empty =usb_anchor_check_wakeup (anchor); -spin_lock_irqsave (&anchor->lock, flags); -while (!list_empty (&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.prev, struct urb, - anchor_list); -__usb_unanchor_urb (victim, anchor); - } -spin_unlock_irqrestore (&anchor->lock, flags); +spin_unlock_irqrestore (&anchor->lock, flags); +cpu_relax (); + }while (!surely_empty); }EXPORT_SYMBOL_GPL (usb_scuttle_anchored_urbs);
Signature · 1 line
2.25.1