5.8.17-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 311/633 drm/panfrost: increase readl_relaxed_poll_timeout values
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit c2df75ad2a9f205820e4bc0db936d3d9af3da1ae ]
Amlogic SoC devices report the following errors frequently causing excessive dmesg log spam and early log rotataion, although the errors appear to be harmless as everything works fine:
[ 7.202702] panfrost ffe40000.gpu: error powering up gpu L2 [ 7.203760] panfrost ffe40000.gpu: error powering up gpu shader
ARM staff have advised increasing the timeout values to eliminate the errors in most normal scenarios, and testing with several different G31/G52 devices shows 20000 to be a reliable value.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +2 -2
@@ -309,13 +309,13 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev)/* Just turn on everything for now */ gpu_write (pfdev,L2_PWRON_LO , pfdev->features.l2_present); ret =readl_relaxed_poll_timeout (pfdev->iomem +L2_READY_LO , - val, val == pfdev->features.l2_present,100 ,1000 ); + val, val == pfdev->features.l2_present,100 ,20000 );if (ret)dev_err (pfdev->dev,"error powering up gpu L2" );gpu_write (pfdev,SHADER_PWRON_LO , pfdev->features.shader_present); ret =readl_relaxed_poll_timeout (pfdev->iomem +SHADER_READY_LO , - val, val == pfdev->features.shader_present,100 ,1000 ); + val, val == pfdev->features.shader_present,100 ,20000 );if (ret)dev_err (pfdev->dev,"error powering up gpu shader" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 508/633 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 484/633 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
@@ -359,9 +359,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 501/633 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 502/633 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
@@ -431,12 +431,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 493/633 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
@@ -2357,7 +2357,7 @@ mdp: mdp@ae01000 { <19200000>; interrupt-parent = <&mdss>; - interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <0>; status = "disabled";
@@ -2380,7 +2380,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 489/633 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
@@ -2193,7 +2193,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 445/633 remoteproc/mediatek: fix null pointer dereference on null scp pointer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 434ac4d51407ce3764a6ae96a89d90b8ae2826fb ]
Currently when pointer scp is null a dev_err is being called that references the pointer which is the very thing we are trying to avoid doing. Remove the extraneous error message to avoid this issue.
Addresses-Coverity: ("Dereference after null check")
--- drivers/remoteproc/mtk_scp_ipi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/remoteproc/mtk_scp_ipi.c +1 -3
@@ -30,10 +30,8 @@ int scp_ipi_register(struct mtk_scp *scp, scp_ipi_handler_t handler, void *priv) { -if (!scp) { -dev_err (scp->dev,"scp device is not ready\n" ); +if (!scp)return -EPROBE_DEFER ; - }if (WARN_ON (id >=SCP_IPI_MAX ) ||WARN_ON (handler ==NULL ))return -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 452/633 kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit bac977cbc0d6731fb8e67c2be0e4acbd959e10b3 ]
Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost"), with CONFIG_MODULES disabled, "make deb-pkg" (or "make bindeb-pkg") fails with:
find: ‘Module.symvers’: No such file or directory
If CONFIG_MODULES is disabled, it doesn't really make sense to build the linux-headers package.
--- scripts/package/builddeb | 6 ++++-- scripts/package/mkdebian | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-)
scripts/package/builddeb +4 -2
@@ -202,8 +202,10 @@ EOF done if [ "$ARCH" != "um" ]; then - deploy_kernel_headers debian/linux-headers - create_package linux-headers-$version debian/linux-headers + if is_enabled CONFIG_MODULES; then + deploy_kernel_headers debian/linux-headers + create_package linux-headers-$version debian/linux-headers + fi deploy_libc_headers debian/linux-libc-dev create_package linux-libc-dev debian/linux-libc-dev
scripts/package/mkdebian +12 -7
@@ -183,13 +183,6 @@ Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other files, version: $version. -Package: $kernel_headers_packagename -Architecture: $debarch -Description: Linux kernel headers for $version on $debarch - This package provides kernel header files for $version on $debarch - . - This is useful for people who need to build external modules - Package: linux-libc-dev Section: devel Provides: linux-kernel-headers
@@ -200,6 +193,18 @@ Description: Linux support headers for userspace development Multi-Arch: same EOF +if is_enabled CONFIG_MODULES; then +cat <<EOF >> debian/control + +Package: $kernel_headers_packagename +Architecture: $debarch +Description: Linux kernel headers for $version on $debarch + This package provides kernel header files for $version on $debarch + . + This is useful for people who need to build external modules +EOF +fi + if is_enabled CONFIG_DEBUG_INFO; then cat <<EOF >> debian/control
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 450/633 clk: at91: clk-main: update key before writing AT91_CKGR_MOR
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 85d071e7f19a6a9abf30476b90b3819642568756 ]
SAMA5D2 datasheet specifies on chapter 33.22.8 (PMC Clock Generator Main Oscillator Register) that writing any value other than 0x37 on KEY field aborts the write operation. Use the key when selecting main clock parent.
--- drivers/clk/at91/clk-main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clk/at91/clk-main.c +8 -3
@@ -437,12 +437,17 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index)return -EINVAL ;regmap_read (regmap,AT91_CKGR_MOR , &tmp); - tmp &= ~MOR_KEY_MASK ;if (index && !(tmp &AT91_PMC_MOSCSEL )) -regmap_write (regmap,AT91_CKGR_MOR , tmp |AT91_PMC_MOSCSEL ); + tmp =AT91_PMC_MOSCSEL ;else if (!index && (tmp &AT91_PMC_MOSCSEL )) -regmap_write (regmap,AT91_CKGR_MOR , tmp & ~AT91_PMC_MOSCSEL ); + tmp =0 ; +else +return 0 ; + +regmap_update_bits (regmap,AT91_CKGR_MOR , +AT91_PMC_MOSCSEL |MOR_KEY_MASK , + tmp |AT91_PMC_KEY );while (!clk_sam9x5_main_ready (regmap))cpu_relax ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 454/633 watchdog: Use put_device on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 937425d4cd3ae4e2882b41e332bbbab616bcf0ad ]
We should use put_device() instead of freeing device directly after device_initialize().
--- drivers/watchdog/watchdog_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/watchdog_dev.c +1 -1
@@ -1020,7 +1020,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)pr_err ("%s: a legacy watchdog module is probably present.\n" , wdd->info->identity); old_wd_data =NULL ; -kfree (wd_data); +put_device (&wd_data->dev);return err; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 451/633 clk: bcm2835: add missing release if devm_clk_hw_register fails
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit f6c992ca7dd4f49042eec61f3fb426c94d901675 ]
In the implementation of bcm2835_register_pll(), the allocated pll is leaked if devm_clk_hw_register() fails to register hw. Release pll if devm_clk_hw_register() fails.
--- drivers/clk/bcm/clk-bcm2835.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +3 -1
@@ -1337,8 +1337,10 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman, pll->hw.init = &init; ret =devm_clk_hw_register (cprman->dev, &pll->hw); -if (ret) +if (ret) { +kfree (pll);return NULL ; + }return &pll->hw; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 481/633 arm64: dts: meson: vim3: correct led polarity
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 1f9d87d08e4a2299e86f8a1600aedf87ecd3b636 ]
The LEDs on the vim3 are active when the gpio is high, not low.
--- arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +2 -2
@@ -41,13 +41,13 @@ leds { led-white { label = "vim3:white:sys"; - gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; + gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; }; led-red { label = "vim3:red"; - gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; + gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 490/633 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 480/633 soc: xilinx: Fix error code in zynqmp_pm_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a6f2f0fdc73aacc6e10ae48ae78634dba26702d4 ]
This should be returning PTR_ERR() but it returns IS_ERR() instead.
--- drivers/soc/xilinx/zynqmp_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/zynqmp_power.c +1 -1
@@ -205,7 +205,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) rx_chan =mbox_request_channel_byname (client,"rx" );if (IS_ERR (rx_chan)) {dev_err (&pdev->dev,"Failed to request rx channel\n" ); -return IS_ERR (rx_chan); +return PTR_ERR (rx_chan); } }else if (of_find_property (pdev->dev.of_node,"interrupts" ,NULL )) { irq =platform_get_irq (pdev,0 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 346/633 xfs: fix deadlock and streamline xfs_getfsmap performance
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 8ffa90e1145c70c7ac47f14b59583b2296d89e72 ]
Refactor xfs_getfsmap to improve its performance: instead of indirectly calling a function that copies one record to userspace at a time, create a shadow buffer in the kernel and copy the whole array once at the end. On the author's computer, this reduces the runtime on his /home by ~20%.
This also eliminates a deadlock when running GETFSMAP against the realtime device. The current code locks the rtbitmap to create fsmappings and copies them into userspace, having not released the rtbitmap lock. If the userspace buffer is an mmap of a sparse file that itself resides on the realtime device, the write page fault will recurse into the fs for allocation, which will deadlock on the rtbitmap lock.
--- fs/xfs/xfs_fsmap.c | 45 +++++++------- fs/xfs/xfs_fsmap.h | 6 +- fs/xfs/xfs_ioctl.c | 144 ++++++++++++++++++++++++++++++--------------- 3 files changed, 124 insertions(+), 71 deletions(-)
fs/xfs/xfs_fsmap.c +25 -20
@@ -26,7 +26,7 @@#include "xfs_rtalloc.h" /* Convert an xfs_fsmap to an fsmap. */ -void +static void xfs_fsmap_from_internal (struct fsmap *dest,struct xfs_fsmap *src)
@@ -155,8 +155,7 @@ xfs_fsmap_owner_from_rmap(/* getfsmap query state */ struct xfs_getfsmap_info {struct xfs_fsmap_head *head; -xfs_fsmap_format_t formatter;/* formatting fn */ -void *format_arg;/* format buffer */ +struct fsmap *fsmap_recs;/* mapping records */ struct xfs_buf *agf_bp;/* AGF, for refcount queries */ xfs_daddr_t next_daddr;/* next daddr we expect */ u64 missing_owner;/* owner of holes */
@@ -224,6 +223,20 @@ xfs_getfsmap_is_shared(return 0 ; } +static inline void +xfs_getfsmap_format ( +struct xfs_mount *mp, +struct xfs_fsmap *xfm, +struct xfs_getfsmap_info *info) +{ +struct fsmap *rec; + +trace_xfs_getfsmap_mapping (mp, xfm); + + rec = &info->fsmap_recs[info->head->fmh_entries++]; +xfs_fsmap_from_internal (rec, xfm); +} +/* * Format a reverse mapping for getfsmap, having translated rm_startblock * into the appropriate daddr units.
@@ -288,10 +301,7 @@ xfs_getfsmap_helper( fmr.fmr_offset =0 ; fmr.fmr_length = rec_daddr - info->next_daddr; fmr.fmr_flags =FMR_OF_SPECIAL_OWNER ; - error = info->formatter (&fmr, info->format_arg); -if (error) -return error; - info->head->fmh_entries++; +xfs_getfsmap_format (mp, &fmr, info); }if (info->last)
@@ -323,11 +333,8 @@ xfs_getfsmap_helper(if (shared) fmr.fmr_flags |=FMR_OF_SHARED ; } - error = info->formatter (&fmr, info->format_arg); -if (error) -return error; - info->head->fmh_entries++; +xfs_getfsmap_format (mp, &fmr, info); out: rec_daddr +=XFS_FSB_TO_BB (mp, rec->rm_blockcount);if (info->next_daddr < rec_daddr)
@@ -795,11 +802,11 @@ xfs_getfsmap_check_keys(#endif /* CONFIG_XFS_RT */ /* -* Get filesystem's extents as described in head, and format for -* output. Calls formatter to fill the user's buffer until all -* extents are mapped, until the passed-in head->fmh_count slots have -* been filled, or until the formatter short-circuits the loop, if it -* is tracking filled-in extents on its own. +* Get filesystem's extents as described in head, and format for output. Fills +* in the supplied records array until there are no more reverse mappings to +* return or head.fmh_entries == head.fmh_count. In the second case, this +* function returns -ECANCELED to indicate that more records would have been +* returned. * * Key to Confusion * ----------------
@@ -819,8 +826,7 @@ intxfs_getfsmap ( struct xfs_mount *mp, struct xfs_fsmap_head *head, - xfs_fsmap_format_t formatter, - void *arg) + struct fsmap *fsmap_recs) { struct xfs_trans *tp = NULL;struct xfs_fsmap dkeys[2 ];/* per-dev keys */
@@ -895,8 +901,7 @@ xfs_getfsmap( info.next_daddr = head->fmh_keys[0 ].fmr_physical + head->fmh_keys[0 ].fmr_length; - info.formatter = formatter; - info.format_arg = arg; + info.fsmap_recs = fsmap_recs; info.head = head;/*
fs/xfs/xfs_fsmap.h +1 -5
@@ -27,13 +27,9 @@ struct xfs_fsmap_head { struct xfs_fsmap fmh_keys[2]; /* low and high keys */ }; -void xfs_fsmap_from_internal (struct fsmap *dest,struct xfs_fsmap *src);void xfs_fsmap_to_internal (struct xfs_fsmap *dest,struct fsmap *src); -/* fsmap to userspace formatter - copy to user & advance pointer */ -typedef int (*xfs_fsmap_format_t )(struct xfs_fsmap *,void *); -int xfs_getfsmap (struct xfs_mount *mp,struct xfs_fsmap_head *head, -xfs_fsmap_format_t formatter,void *arg); +struct fsmap *out_recs);#endif /* __XFS_FSMAP_H__ */
fs/xfs/xfs_ioctl.c +98 -46
175 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 448/633 clk: mediatek: add UART0 clock support
In reply to Greg Kroah-HartmanFrom: Hanks Chen <[email protected]>
[ Upstream commit 804a892456b73604b7ecfb1b00a96a29f3d2aedf ]
Add MT6779 UART0 clock support.
--- drivers/clk/mediatek/clk-mt6779.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/mediatek/clk-mt6779.c +2 -0
@@ -919,6 +919,8 @@ static const struct mtk_gate infra_clks[] = { "pwm_sel", 19),GATE_INFRA0 (CLK_INFRA_PWM ,"infra_pwm" ,"pwm_sel" ,21 ), +GATE_INFRA0 (CLK_INFRA_UART0 ,"infra_uart0" , +"uart_sel" ,22 ),GATE_INFRA0 (CLK_INFRA_UART1 ,"infra_uart1" ,"uart_sel" ,23 ), GATE_INFRA0(CLK_INFRA_UART2, "infra_uart2",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 310/633 mwifiex: fix double free
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 53708f4fd9cfe389beab5c8daa763bcd0e0b4aef ]
clang static analysis reports this problem:
sdio.c:2403:3: warning: Attempt to free released memory
kfree(card->mpa_rx.buf);
^~~~~~~~~~~~~~~~~~~~~~~When mwifiex_init_sdio() fails in its first call to mwifiex_alloc_sdio_mpa_buffer, it falls back to calling it again. If the second alloc of mpa_tx.buf fails, the error handler will try to free the old, previously freed mpa_rx.buf. Reviewing the code, it looks like a second double free would happen with mwifiex_cleanup_sdio().
So set both pointers to NULL when they are freed.
--- drivers/net/wireless/marvell/mwifiex/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/sdio.c +2 -0
@@ -1976,6 +1976,8 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,kfree (card->mpa_rx.buf); card->mpa_tx.buf_size =0 ; card->mpa_rx.buf_size =0 ; + card->mpa_tx.buf =NULL ; + card->mpa_rx.buf =NULL ; }return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 343/633 arc: plat-hsdk: fix kconfig dependency warning when !RESET_CONTROLLER
In reply to Greg Kroah-HartmanFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 63bcf87cb1c57956e1179f1a78dde625c7e3cba7 ]
When ARC_SOC_HSDK is enabled and RESET_CONTROLLER is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for RESET_HSDK
Depends on [n]: RESET_CONTROLLER [=n] && HAS_IOMEM [=y] && (ARC_SOC_HSDK [=y] || COMPILE_TEST [=n]) Selected by [y]:
- ARC_SOC_HSDK [=y] && ISA_ARCV2 [=y]
The reason is that ARC_SOC_HSDK selects RESET_HSDK without depending on or selecting RESET_CONTROLLER while RESET_HSDK is subordinate to RESET_CONTROLLER.
Honor the kconfig menu hierarchy to remove kconfig dependency warnings.
--- arch/arc/plat-hsdk/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arc/plat-hsdk/Kconfig +1 -0
@@ -8,5 +8,6 @@ menuconfig ARC_SOC_HSDK select ARC_HAS_ACCL_REGS select ARC_IRQ_NO_AUTOSAVE select CLK_HSDK + select RESET_CONTROLLER select RESET_HSDK select HAVE_PCI
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 347/633 nfs: add missing "posix" local_lock constant table definition
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
[ Upstream commit a2d24bcb97dc7b0be1cb891e60ae133bdf36c786 ]
"mount -o local_lock=posix..." was broken by the mount API conversion due to the missing constant.
--- fs/nfs/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/fs_context.c +1 -0
@@ -94,6 +94,7 @@ enum {static const struct constant_table nfs_param_enums_local_lock[] = { {"all" , Opt_local_lock_all }, {"flock" , Opt_local_lock_flock }, + {"posix" , Opt_local_lock_posix }, {"none" , Opt_local_lock_none }, {} };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 483/633 ARM: at91: pm: of_node_put() after its usage
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit e222f943519564978e082c152b4140a47e93392c ]
Put node after it has been used.
--- arch/arm/mach-at91/pm.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-at91/pm.c +1 -0
@@ -800,6 +800,7 @@ static void __init at91_pm_init(void (*pm_idle)(void)) pmc_np =of_find_matching_node_and_match (NULL , atmel_pmc_ids, &of_id); soc_pm.data.pmc =of_iomap (pmc_np,0 ); +of_node_put (pmc_np);if (!soc_pm.data.pmc) {pr_err ("AT91: PM not supported, PMC not found\n" );return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 476/633 netfilter: conntrack: connection timeout after re-register
In reply to Greg Kroah-HartmanFrom: Francesco Ruggeri <[email protected]>
[ Upstream commit 4f25434bccc28cf8a07876ef5142a2869a674353 ]
If the first packet conntrack sees after a re-register is an outgoing keepalive packet with no data (SEG.SEQ = SND.NXT-1), td_end is set to SND.NXT-1.
When the peer correctly acknowledges SND.NXT, tcp_in_window fails check III (Upper bound for valid (s)ack: sack <= receiver.td_end) and returns false, which cascades into nf_conntrack_in setting skb->_nfct = 0 and in later conntrack iptables rules not matching. In cases where iptables are dropping packets that do not match conntrack rules this can result in idle tcp connections to time out.
v2: adjust td_end when getting the reply rather than when sending out
the keepalive packet.
--- net/netfilter/nf_conntrack_proto_tcp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +13 -6
@@ -541,13 +541,20 @@ static bool tcp_in_window(const struct nf_conn *ct, swin = win << sender->td_scale; sender->td_maxwin = (swin ==0 ?1 : swin); sender->td_maxend = end + sender->td_maxwin; -/* -* We haven't seen traffic in the other direction yet -* but we have to tweak window tracking to pass III -* and IV until that happens. -*/ -if (receiver->td_maxwin ==0 ) +if (receiver->td_maxwin ==0 ) { +/* We haven't seen traffic in the other +* direction yet but we have to tweak window +* tracking to pass III and IV until that +* happens. +*/ receiver->td_end = receiver->td_maxend = sack; + }else if (sack == receiver->td_end +1 ) { +/* Likely a reply to a keepalive. +* Needed for III. +*/ + receiver->td_end++; + } + } } else if (((state->state == TCP_CONNTRACK_SYN_SENT && dir == IP_CT_DIR_ORIGINAL)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 473/633 KVM: x86: emulating RDPID failure shall return #UD rather than #GP
In reply to Greg Kroah-HartmanFrom: Robert Hoo <[email protected]>
[ Upstream commit a9e2e0ae686094571378c72d8146b5a1a92d0652 ]
Per Intel's SDM, RDPID takes a #UD if it is unsupported, which is more or less what KVM is emulating when MSR_TSC_AUX is not available. In fact, there are no scenarios in which RDPID is supposed to #GP.
Message-Id: <[email protected]>
--- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/emulate.c +1 -1
@@ -3594,7 +3594,7 @@ static int em_rdpid(struct x86_emulate_ctxt *ctxt)u64 tsc_aux =0 ;if (ctxt->ops->get_msr (ctxt,MSR_TSC_AUX , &tsc_aux)) -return emulate_gp (ctxt,0 ); +return emulate_ud (ctxt); ctxt->dst.val = tsc_aux;return X86EMUL_CONTINUE ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 467/633 Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 30df23c5ecdfb8da5b0bc17ceef67eff9e1b0957 ]
If imx6ul_tsc_init() fails then we need to clean up the clocks.
I reversed the "if (input_dev->users) {" condition to make the code a bit simpler.
--- drivers/input/touchscreen/imx6ul_tsc.c | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/input/touchscreen/imx6ul_tsc.c +16 -11
@@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)mutex_lock (&input_dev->mutex); -if (input_dev->users) { - retval =clk_prepare_enable (tsc->adc_clk); -if (retval) - goto out; - - retval =clk_prepare_enable (tsc->tsc_clk); -if (retval) { -clk_disable_unprepare (tsc->adc_clk); - goto out; - } +if (!input_dev->users) + goto out; - retval =imx6ul_tsc_init (tsc); + retval =clk_prepare_enable (tsc->adc_clk); +if (retval) + goto out; + + retval =clk_prepare_enable (tsc->tsc_clk); +if (retval) { +clk_disable_unprepare (tsc->adc_clk); + goto out; } + retval =imx6ul_tsc_init (tsc); +if (retval) { +clk_disable_unprepare (tsc->tsc_clk); +clk_disable_unprepare (tsc->adc_clk); + goto out; + } out:mutex_unlock (&input_dev->mutex);return retval;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 466/633 Input: elants_i2c - fix typo for an attribute to show calibration count
In reply to Greg Kroah-HartmanFrom: Johnny Chuang <[email protected]>
[ Upstream commit 93f634069707cfe562c38739f5062feccbe9a834 ]
Fixed typo for command from 0xE0 to 0xD0.
--- drivers/input/touchscreen/elants_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/elants_i2c.c +1 -1
@@ -90,7 +90,7 @@/* FW read command, 0x53 0x?? 0x0, 0x01 */ #define E_ELAN_INFO_FW_VER 0x00#define E_ELAN_INFO_BC_VER 0x10 -#define E_ELAN_INFO_REK 0xE0 +#define E_ELAN_INFO_REK 0xD0#define E_ELAN_INFO_TEST_VER 0xE0#define E_ELAN_INFO_FW_ID 0xF0#define E_INFO_OSR 0xD6
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 447/633 clk: rockchip: Initialize hw to error to avoid undefined behavior
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit b608f11d49ec671739604cc763248d8e8fadbbeb ]
We can get down to this return value from ERR_CAST() without initializing hw. Set it to -ENOMEM so that we always return something sane.
Fixes the following smatch warning:
drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() error: uninitialized symbol 'hw'. drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() warn: passing zero to 'ERR_CAST'
--- drivers/clk/rockchip/clk-half-divider.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-half-divider.c +1 -1
@@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name,unsigned long flags, spinlock_t *lock) { - struct clk *clk; + struct clk *clk = ERR_PTR(-ENOMEM);struct clk_mux *mux =NULL ;struct clk_gate *gate =NULL ;struct clk_divider *div =NULL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 465/633 platform/chrome: cros_ec_lightbar: Reduce ligthbar get version command
In reply to Greg Kroah-HartmanFrom: Gwendal Grignou <[email protected]>
[ Upstream commit 1e7913ff5f9f1b73146ad8522958bd266f22a510 ]
By default, the lightbar commands are set to the biggest lightbar command and response. That length is greater than 128 bytes and may not work on all machines. But all EC are probed for lightbar by sending a get version request. Set that request size precisely.
Before the command would be:
cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128, result: 0
Afer:
cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 1, insize: 8, result: 0
--- drivers/platform/chrome/cros_ec_lightbar.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/chrome/cros_ec_lightbar.c +2 -0
@@ -116,6 +116,8 @@ static int get_lightbar_version(struct cros_ec_dev *ec, param = (struct ec_params_lightbar *)msg->data; param->cmd =LIGHTBAR_CMD_VERSION ; + msg->outsize =sizeof (param->cmd); + msg->result =sizeof (resp->version); ret =cros_ec_cmd_xfer_status (ec->ec_dev, msg);if (ret <0 ) { ret =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 459/633 ext4: disallow modifying DAX inode flag if inline_data has been set
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit aa2f77920b743c44e02e2dc8474bbf8bd30007a2 ]
inline_data is mutually exclusive to DAX so enabling both of them triggers the following issue:
------------------------------------------
# mkfs.ext4 -F -O inline_data /dev/pmem1 ... # mount /dev/pmem1 /mnt # echo 'test' >/mnt/file # lsattr -l /mnt/file /mnt/file Inline_Data # xfs_io -c "chattr +x" /mnt/file # xfs_io -c "lsattr -v" /mnt/file [dax] /mnt/file # umount /mnt # mount /dev/pmem1 /mnt # cat /mnt/file cat: /mnt/file: Numerical result out of range ------------------------------------------
--- fs/ext4/ext4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4.h +1 -1
@@ -466,7 +466,7 @@ struct flex_groups {/* Flags which are mutually exclusive to DAX */ #define EXT4_DAX_MUT_EXCL (EXT4_VERITY_FL | EXT4_ENCRYPT_FL |\ - EXT4_JOURNAL_DATA_FL) + EXT4_JOURNAL_DATA_FL | EXT4_INLINE_DATA_FL)/* Mask out flags that are inappropriate for the given type of inode. */ static inline __u32 ext4_mask_flags (umode_t mode,__u32 flags)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 457/633 ext4: fix dead loop in ext4_mb_new_blocks
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 70022da804f0f3f152115688885608c39182082e ]
As we test disk offline/online with running fsstress, we find fsstress process is keeping running state.
kworker/u32:3-262 [004] ...1 140.787471: ext4_mb_discard_preallocations: dev 8,32 needed 114
....
kworker/u32:3-262 [004] ...1 140.787471: ext4_mb_discard_preallocations: dev 8,32 needed 114
ext4_mb_new_blocks
repeat:
ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)
freed = ext4_mb_discard_preallocations
ext4_mb_discard_group_preallocations
this_cpu_inc(discard_pa_seq);
---> freed == 0
seq_retry = ext4_get_discard_pa_seq_sum
for_each_possible_cpu(__cpu)
__seq += per_cpu(discard_pa_seq, __cpu);
if (seq_retry != *seq) {
*seq = seq_retry;
ret = true;
}As we see seq_retry is sum of discard_pa_seq every cpu, if ext4_mb_discard_group_preallocations return zero discard_pa_seq in this cpu maybe increase one, so condition "seq_retry != *seq" have always been met.
Ritesh Harjani suggest to in ext4_mb_discard_group_preallocations function we only increase discard_pa_seq when there is some PA to free.
--- fs/ext4/mballoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +3 -1
@@ -4066,7 +4066,6 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,INIT_LIST_HEAD (&list); repeat:ext4_lock_group (sb, group); -this_cpu_inc (discard_pa_seq);list_for_each_entry_safe (pa, tmp, &grp->bb_prealloc_list, pa_group_list) {spin_lock (&pa->pa_lock);
@@ -4083,6 +4082,9 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,/* seems this one can be freed ... */ ext4_mb_mark_pa_deleted (sb, pa); +if (!free) +this_cpu_inc (discard_pa_seq); +/* we can trust pa_free ... */ free += pa->pa_free;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 456/633 svcrdma: fix bounce buffers for unaligned offsets and multiple pages
In reply to Greg Kroah-HartmanFrom: Dan Aloni <[email protected]>
[ Upstream commit c327a310ec4d6ecbea13185ed56c11def441d9ab ]
This was discovered using O_DIRECT at the client side, with small unaligned file offsets or IOs that span multiple file pages.
--- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/svc_rdma_sendto.c +2 -1
@@ -637,10 +637,11 @@ static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma,while (remaining) { len =min_t (u32,PAGE_SIZE - pageoff, remaining); -memcpy (dst,page_address (*ppages), len); +memcpy (dst,page_address (*ppages) + pageoff, len); remaining -= len; dst += len; pageoff =0 ; + ppages++; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 411/633 perf trace: Fix off by ones in memset() after realloc() in arches using libaudit
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
[ Upstream commit f3013f7ed465479e60c1ab1921a5718fc541cc3b ]
'perf trace ls' started crashing after commit d21cb73a9025 on !HAVE_SYSCALL_TABLE_SUPPORT configs (armv7l here) like this:
0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:126
1 0xb6800780 in __vfprintf_internal (s=0xbeff9908, s@entry=0xbeff9900, format=0xa27160 "]: %s()", ap=..., mode_flags=<optimized out>) at vfprintf-internal.c:1688
...
5 0x0056ecdc in fprintf (__fmt=0xa27160 "]: %s()", __stream=<optimized out>) at /usr/include/bits/stdio2.h:100 6 trace__sys_exit (trace=trace@entry=0xbeffc710, evsel=evsel@entry=0xd968d0, event=<optimized out>, sample=sample@entry=0xbeffc3e8) at builtin-trace.c:2475 7 0x00566d40 in trace__handle_event (sample=0xbeffc3e8, event=<optimized out>, trace=0xbeffc710) at builtin-trace.c:3122
...
15 main (argc=2, argv=0xbefff6e8) at perf.c:538
It is because memset in trace__read_syscall_info zeroes wrong memory:
1) when initializing for the first time, it does not reset the last id.
2) in other cases, it resets the last id of previous buffer.
ad 1) it causes the crash above as sc->name used in the fprintf above
contains garbage.
ad 2) it sets nonexistent from true back to false for id 11 here. Not
sure, what the consequences are.
So fix it by introducing a special case for the initial initialization and do the right +1 in both cases.
--- tools/perf/builtin-trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +5 -1
@@ -1762,7 +1762,11 @@ static int trace__read_syscall_info(struct trace *trace, int id)if (table ==NULL )return -ENOMEM ; -memset (table + trace->sctbl->syscalls.max_id,0 , (id - trace->sctbl->syscalls.max_id) *sizeof (*sc)); +// Need to memset from offset 0 and +1 members if brand new +if (trace->syscalls.table ==NULL ) +memset (table,0 , (id +1 ) *sizeof (*sc)); +else +memset (table + trace->sctbl->syscalls.max_id +1 ,0 , (id - trace->sctbl->syscalls.max_id) *sizeof (*sc)); trace->syscalls.table = table; trace->sctbl->syscalls.max_id = id;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 455/633 watchdog: sp5100: Fix definition of EFCH_PM_DECODEEN3
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 08c619b4923056b5dd2d5045757468c76ad0e3fe ]
EFCH_PM_DECODEEN3 is supposed to access DECODEEN register bits 24..31, in other words the register at byte offset 3.
--- drivers/watchdog/sp5100_tco.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sp5100_tco.h +1 -1
@@ -70,7 +70,7 @@#define EFCH_PM_DECODEEN_WDT_TMREN BIT(7) -#define EFCH_PM_DECODEEN3 0x00 +#define EFCH_PM_DECODEEN3 0x03#define EFCH_PM_DECODEEN_SECOND_RES GENMASK(1, 0)#define EFCH_PM_WATCHDOG_DISABLE ((u8)GENMASK(3, 2))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 461/633 vfio/pci: Clear token on bypass registration failure
In reply to Greg Kroah-HartmanFrom: Alex Williamson <[email protected]>
[ Upstream commit 852b1beecb6ff9326f7ca4bc0fe69ae860ebdb9e ]
The eventfd context is used as our irqbypass token, therefore if an eventfd is re-used, our token is the same. The irqbypass code will return an -EBUSY in this case, but we'll still attempt to unregister the producer, where if that duplicate token still exists, results in removing the wrong object. Clear the token of failed producers so that they harmlessly fall out when unregistered.
--- drivers/vfio/pci/vfio_pci_intrs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_intrs.c +3 -1
@@ -352,11 +352,13 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, vdev->ctx[vector].producer.token = trigger; vdev->ctx[vector].producer.irq = irq; ret =irq_bypass_register_producer (&vdev->ctx[vector].producer); -if (unlikely (ret)) +if (unlikely (ret)) {dev_info (&pdev->dev,"irq bypass producer (token %p) registration fails: %d\n" , vdev->ctx[vector].producer.token, ret); + vdev->ctx[vector].producer.token =NULL ; + } vdev->ctx[vector].trigger = trigger;return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 419/633 mm/page_owner: change split_page_owner to take a count
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 8fb156c9ee2db94f7127c930c89917634a1a9f56 ]
The implementation of split_page_owner() prefers a count rather than the old order of the page. When we support a variable size THP, we won't have the order at this point, but we will have the number of pages. So change the interface to what the caller and callee would prefer.
--- include/linux/page_owner.h | 6 +++--- mm/huge_memory.c | 2 +- mm/page_alloc.c | 2 +- mm/page_owner.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
include/linux/page_owner.h +3 -3
@@ -11,7 +11,7 @@ extern struct page_ext_operations page_owner_ops;extern void __reset_page_owner (struct page *page,unsigned int order);extern void __set_page_owner (struct page *page,unsigned int order,gfp_t gfp_mask); -extern void __split_page_owner (struct page *page,unsigned int order); +extern void __split_page_owner (struct page *page,unsigned int nr);extern void __copy_page_owner (struct page *oldpage,struct page *newpage);extern void __set_page_owner_migrate_reason (struct page *page,int reason);extern void __dump_page_owner (struct page *page);
@@ -31,10 +31,10 @@ static inline void set_page_owner(struct page *page,__set_page_owner (page, order, gfp_mask); } -static inline void split_page_owner (struct page *page,unsigned int order) +static inline void split_page_owner (struct page *page,unsigned int nr) {if (static_branch_unlikely (&page_owner_inited)) -__split_page_owner (page, order); +__split_page_owner (page, nr); }static inline void copy_page_owner (struct page *oldpage,struct page *newpage) {
mm/huge_memory.c +1 -1
@@ -2449,7 +2449,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,ClearPageCompound (head); -split_page_owner (head,HPAGE_PMD_ORDER ); +split_page_owner (head,HPAGE_PMD_NR );/* See comment in __split_huge_page_tail() */ if (PageAnon (head)) {
mm/page_alloc.c +1 -1
@@ -3213,7 +3213,7 @@ void split_page(struct page *page, unsigned int order)for (i =1 ; i < (1 << order); i++)set_page_refcounted (page + i); -split_page_owner (page, order); +split_page_owner (page,1 << order); }EXPORT_SYMBOL_GPL (split_page);
mm/page_owner.c +2 -2
@@ -204,7 +204,7 @@ void __set_page_owner_migrate_reason(struct page *page, int reason) page_owner->last_migrate_reason = reason; } -void __split_page_owner (struct page *page,unsigned int order) +void __split_page_owner (struct page *page,unsigned int nr) {int i;struct page_ext *page_ext =lookup_page_ext (page);
@@ -213,7 +213,7 @@ void __split_page_owner(struct page *page, unsigned int order)if (unlikely (!page_ext))return ; -for (i =0 ; i < (1 << order); i++) { +for (i =0 ; i < nr; i++) { page_owner =get_page_owner (page_ext); page_owner->order =0 ; page_ext =page_ext_next (page_ext);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 417/633 afs: Fix cell removal
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 1d0e850a49a5b56f8f3cb51e74a11e2fedb96be6 ]
Fix cell removal by inserting a more final state than AFS_CELL_FAILED that indicates that the cell has been unpublished in case the manager is already requeued and will go through again. The new AFS_CELL_REMOVED state will just immediately leave the manager function.
Going through a second time in the AFS_CELL_FAILED state will cause it to try to remove the cell again, potentially leading to the proc list being removed.
--- fs/afs/cell.c | 16 ++++++++++------ fs/afs/internal.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-)
fs/afs/cell.c +10 -6
@@ -291,11 +291,11 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,wait_var_event (&cell->state, ({ state =smp_load_acquire (&cell->state);/* vs error */ - state ==AFS_CELL_ACTIVE || state ==AFS_CELL_FAILED ; + state ==AFS_CELL_ACTIVE || state ==AFS_CELL_REMOVED ; }));/* Check the state obtained from the wait check. */ -if (state ==AFS_CELL_FAILED ) { +if (state ==AFS_CELL_REMOVED ) { ret = cell->error; goto error; }
@@ -700,7 +700,6 @@ static void afs_deactivate_cell(struct afs_net *net, struct afs_cell *cell)static void afs_manage_cell (struct afs_cell *cell) {struct afs_net *net = cell->net; -bool deleted;int ret, active;_enter ("%s" , cell->name);
@@ -712,13 +711,15 @@ static void afs_manage_cell(struct afs_cell *cell)case AFS_CELL_FAILED :down_write (&net->cells_lock); active =1 ; - deleted =atomic_try_cmpxchg_relaxed (&cell->active, &active,0 ); -if (deleted) { +if (atomic_try_cmpxchg_relaxed (&cell->active, &active,0 )) {rb_erase (&cell->net_node, &net->cells); +smp_store_release (&cell->state,AFS_CELL_REMOVED ); }up_write (&net->cells_lock); -if (deleted) +if (cell->state ==AFS_CELL_REMOVED ) { +wake_up_var (&cell->state); goto final_destruction; + }if (cell->state ==AFS_CELL_FAILED ) goto done;smp_store_release (&cell->state,AFS_CELL_UNSET );
@@ -760,6 +761,9 @@ static void afs_manage_cell(struct afs_cell *cell)wake_up_var (&cell->state); goto again; +case AFS_CELL_REMOVED : + goto done; +default :break ; }
fs/afs/internal.h +1 -0
@@ -326,6 +326,7 @@ enum afs_cell_state {AFS_CELL_DEACTIVATING ,AFS_CELL_INACTIVE ,AFS_CELL_FAILED , + AFS_CELL_REMOVED, };/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 416/633 afs: Fix cell purging with aliases
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 286377f6bdf71568a4cf07104fe44006ae0dba6d ]
When the afs module is removed, one of the things that has to be done is to purge the cell database. afs_cell_purge() cancels the management timer and then starts the cell manager work item to do the purging. This does a single run through and then assumes that all cells are now purged - but this is no longer the case.
With the introduction of alias detection, a later cell in the database can now be holding an active count on an earlier cell (cell->alias_of). The purge scan passes by the earlier cell first, but this can't be got rid of until it has discarded the alias. Ordinarily, afs_unuse_cell() would handle this by setting the management timer to trigger another pass - but afs_set_cell_timer() doesn't do anything if the namespace is being removed (net->live == false). rmmod then hangs in the wait on cells_outstanding in afs_cell_purge().
Fix this by making afs_set_cell_timer() directly queue the cell manager if net->live is false. This causes additional management passes.
Queueing the cell manager increments cells_outstanding to make sure the wait won't complete until all cells are destroyed.
--- fs/afs/cell.c | 3 +++ 1 file changed, 3 insertions(+)
fs/afs/cell.c +3 -0
@@ -19,6 +19,7 @@ static unsigned __read_mostly afs_cell_gc_delay = 10;static unsigned __read_mostly afs_cell_min_ttl =10 *60 ;static unsigned __read_mostly afs_cell_max_ttl =24 *60 *60 ; +static void afs_queue_cell_manager (struct afs_net *);static void afs_manage_cell_work (struct work_struct *);static void afs_dec_cells_outstanding (struct afs_net *net)
@@ -37,6 +38,8 @@ static void afs_set_cell_timer(struct afs_net *net, time64_t delay)atomic_inc (&net->cells_outstanding);if (timer_reduce (&net->cells_timer, jiffies + delay *HZ ))afs_dec_cells_outstanding (net); + }else { +afs_queue_cell_manager (net); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 444/633 pwm: img: Fix null pointer access in probe
In reply to Greg Kroah-HartmanFrom: Hauke Mehrtens <[email protected]>
[ Upstream commit b39c0615d0667b3a6f2f5c4bf99ffadf3b518bb1 ]
dev_get_drvdata() is called in img_pwm_runtime_resume() before the driver data is set.
When pm_runtime_enabled() returns false in img_pwm_probe() it calls img_pwm_runtime_resume() which results in a null pointer access.
This patch fixes the problem by setting the driver data earlier in the img_pwm_probe() function.
This crash was seen when booting the Imagination Technologies Creator Ci40 (Marduk) with kernel 5.4 in OpenWrt.
--- drivers/pwm/pwm-img.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pwm/pwm-img.c +2 -1
@@ -277,6 +277,8 @@ static int img_pwm_probe(struct platform_device *pdev)return PTR_ERR (pwm->pwm_clk); } +platform_set_drvdata (pdev, pwm); +pm_runtime_set_autosuspend_delay (&pdev->dev,IMG_PWM_PM_TIMEOUT );pm_runtime_use_autosuspend (&pdev->dev);pm_runtime_enable (&pdev->dev);
@@ -313,7 +315,6 @@ static int img_pwm_probe(struct platform_device *pdev) goto err_suspend; } -platform_set_drvdata (pdev, pwm);return 0 ; err_suspend:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 415/633 afs: Fix cell refcounting by splitting the usage counter
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 88c853c3f5c0a07c5db61b494ee25152535cfeee ]
Management of the lifetime of afs_cell struct has some problems due to the usage counter being used to determine whether objects of that type are in use in addition to whether anyone might be interested in the structure.
This is made trickier by cell objects being cached for a period of time in case they're quickly reused as they hold the result of a setup process that may be slow (DNS lookups, AFS RPC ops).
Problems include the cached root volume from alias resolution pinning its parent cell record, rmmod occasionally hanging and occasionally producing assertion failures.
Fix this by splitting the count of active users from the struct reference count. Things then work as follows:
(1) The cell cache keeps +1 on the cell's activity count and this has to be dropped before the cell can be removed. afs_manage_cell() tries to exchange the 1 to a 0 with the cells_lock write-locked, and if successful, the record is removed from the net->cells.
(2) One struct ref is 'owned' by the activity count. That is put when the active count is reduced to 0 (final_destruction label).
(3) A ref can be held on a cell whilst it is queued for management on a work queue without confusing the active count. afs_queue_cell() is added to wrap this.
(4) The queue's ref is dropped at the end of the management. This is split out into a separate function, afs_manage_cell_work().
(5) The root volume record is put after a cell is removed (at the final_destruction label) rather then in the RCU destruction routine.
(6) Volumes hold struct refs, but aren't active users.
(7) Both counts are displayed in /proc/net/afs/cells.
There are some management function changes:
(*) afs_put_cell() now just decrements the refcount and triggers the RCU
destruction if it becomes 0. It no longer sets a timer to have the manager do this.
(*) afs_use_cell() and afs_unuse_cell() are added to increase and decrease
the active count. afs_unuse_cell() sets the management timer.
(*) afs_queue_cell() is added to queue a cell with approprate refs.
There are also some other fixes:
(*) Don't let /proc/net/afs/cells access a cell's vllist if it's NULL.
(*) Make sure that candidate cells in lookups are properly destroyed
rather than being simply kfree'd. This ensures the bits it points to are destroyed also.
(*) afs_dec_cells_outstanding() is now called in cell destruction rather
than at "final_destruction". This ensures that cell->net is still valid to the end of the destructor.
(*) As a consequence of the previous two changes, move the increment of
net->cells_outstanding that was at the point of insertion into the tree to the allocation routine to correctly balance things.
--- fs/afs/cell.c | 149 +++++++++++++++++++++++++++++++-------------- fs/afs/dynroot.c | 2 +- fs/afs/internal.h | 8 ++- fs/afs/mntpt.c | 4 +- fs/afs/proc.c | 23 ++++--- fs/afs/super.c | 12 ++-- fs/afs/vl_alias.c | 8 +-- fs/afs/vl_rotate.c | 2 +- fs/afs/volume.c | 4 +- 9 files changed, 136 insertions(+), 76 deletions(-)
fs/afs/cell.c +103 -46
@@ -19,7 +19,7 @@ static unsigned __read_mostly afs_cell_gc_delay = 10;static unsigned __read_mostly afs_cell_min_ttl =10 *60 ;static unsigned __read_mostly afs_cell_max_ttl =24 *60 *60 ; -static void afs_manage_cell (struct work_struct *); +static void afs_manage_cell_work (struct work_struct *);static void afs_dec_cells_outstanding (struct afs_net *net) {
@@ -62,8 +62,7 @@ static struct afs_cell *afs_find_cell_locked(struct afs_net *net, cell = net->ws_cell;if (!cell)return ERR_PTR (-EDESTADDRREQ ); -afs_get_cell (cell); -return cell; + goto found; } p = net->cells.rb_node;
@@ -85,12 +84,12 @@ static struct afs_cell *afs_find_cell_locked(struct afs_net *net,return ERR_PTR (-ENOENT ); found: -if (!atomic_inc_not_zero (&cell->usage)) -return ERR_PTR (-ENOENT ); - -return cell; +return afs_use_cell (cell); } +/* +* Look up and get an activation reference on a cell record. +*/ struct afs_cell *afs_find_cell (struct afs_net *net,const char *name,unsigned int namesz) {
@@ -153,8 +152,9 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net, cell->name[i] =tolower (name[i]); cell->name[i] =0 ; -atomic_set (&cell->usage,2 ); -INIT_WORK (&cell->manager, afs_manage_cell); +atomic_set (&cell->ref,1 ); +atomic_set (&cell->active,0 ); +INIT_WORK (&cell->manager, afs_manage_cell_work); cell->volumes =RB_ROOT ;INIT_HLIST_HEAD (&cell->proc_volumes);seqlock_init (&cell->volume_lock);
@@ -193,6 +193,7 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net, cell->dns_source = vllist->source; cell->dns_status = vllist->status;smp_store_release (&cell->dns_lookup_count,1 );/* vs source/status */ +atomic_inc (&net->cells_outstanding);_leave (" = %p" , cell);return cell;
@@ -275,12 +276,12 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net, cell = candidate; candidate =NULL ; +atomic_set (&cell->active,2 );rb_link_node_rcu (&cell->net_node, parent, pp);rb_insert_color (&cell->net_node, &net->cells); -atomic_inc (&net->cells_outstanding);up_write (&net->cells_lock); -queue_work (afs_wq, &cell->manager); +afs_queue_cell (cell); wait_for_cell:_debug ("wait_for_cell" );
@@ -305,16 +306,17 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,if (excl) { ret = -EEXIST ; }else { -afs_get_cell (cursor); +afs_use_cell (cursor); ret =0 ; }up_write (&net->cells_lock); -kfree (candidate); +if (candidate) +afs_put_cell (candidate);if (ret ==0 ) goto wait_for_cell; goto error_noput; error: -afs_put_cell (net, cell); +afs_unuse_cell (net, cell); error_noput:_leave (" = %d [error]" , ret);return ERR_PTR (ret);
@@ -359,7 +361,7 @@ int afs_cell_init(struct afs_net *net, const char *rootcell) }if (!test_and_set_bit (AFS_CELL_FL_NO_GC , &new_root->flags)) -afs_get_cell (new_root); +afs_use_cell (new_root);/* install the new cell */ down_write (&net->cells_lock);
@@ -367,7 +369,7 @@ int afs_cell_init(struct afs_net *net, const char *rootcell) net->ws_cell = new_root;up_write (&net->cells_lock); -afs_put_cell (net, old_root); +afs_unuse_cell (net, old_root);_leave (" = 0" );return 0 ; }
@@ -473,18 +475,21 @@ static int afs_update_cell(struct afs_cell *cell)static void afs_cell_destroy (struct rcu_head *rcu) { struct afs_cell *cell = container_of(rcu, struct afs_cell, rcu); +struct afs_net *net = cell->net; +int u;_enter ("%p{%s}" , cell, cell->name); - ASSERTCMP(atomic_read(&cell->usage), ==, 0); + u =atomic_read (&cell->ref); + ASSERTCMP(u, ==, 0); -afs_put_volume (cell->net, cell->root_volume, afs_volume_trace_put_cell_root); -afs_put_vlserverlist (cell->net,rcu_access_pointer (cell->vl_servers)); -afs_put_cell (cell->net, cell->alias_of); +afs_put_vlserverlist (net,rcu_access_pointer (cell->vl_servers)); +afs_unuse_cell (net, cell->alias_of);key_put (cell->anonymous_key);kfree (cell->name);kfree (cell); +afs_dec_cells_outstanding (net);_leave (" [destroyed]" ); }
@@ -519,16 +524,50 @@ void afs_cells_timer(struct timer_list *timer)*/ struct afs_cell *afs_get_cell (struct afs_cell *cell) { -atomic_inc (&cell->usage); +if (atomic_read (&cell->ref) <=0 ) +BUG (); + +atomic_inc (&cell->ref);return cell; }/* * Drop a reference on a cell record. */ -void afs_put_cell (struct afs_net *net,struct afs_cell *cell) +void afs_put_cell (struct afs_cell *cell) +{ +if (cell) { +unsigned int u, a; + + u =atomic_dec_return (&cell->ref); +if (u ==0 ) { + a =atomic_read (&cell->active); +WARN (a !=0 ,"Cell active count %u > 0\n" , a); +call_rcu (&cell->rcu, afs_cell_destroy); + } + } +} + +/* +* Note a cell becoming more active. +*/ +struct afs_cell *afs_use_cell (struct afs_cell *cell) +{ +if (atomic_read (&cell->ref) <=0 ) +BUG (); + +atomic_inc (&cell->active); +return cell; +} + +/* +* Record a cell becoming less active. When the active counter reaches 1, it +* is scheduled for destruction, but may get reactivated. +*/ +void afs_unuse_cell (struct afs_net *net,struct afs_cell *cell) {time64_t now, expire_delay; +int a;if (!cell)return ;
@@ -541,11 +580,21 @@ void afs_put_cell(struct afs_net *net, struct afs_cell *cell)if (cell->vl_servers->nr_servers) expire_delay = afs_cell_gc_delay; -if (atomic_dec_return (&cell->usage) >1 ) -return ; + a =atomic_dec_return (&cell->active); +WARN_ON (a ==0 ); +if (a ==1 ) +/* 'cell' may now be garbage collected. */ +afs_set_cell_timer (net, expire_delay); +} -/* 'cell' may now be garbage collected. */ -afs_set_cell_timer (net, expire_delay); +/* +* Queue a cell for management, giving the workqueue a ref to hold. +*/ +void afs_queue_cell (struct afs_cell *cell) +{ +afs_get_cell (cell); +if (!queue_work (afs_wq, &cell->manager)) +afs_put_cell (cell); }/*
@@ -645,12 +694,11 @@ static void afs_deactivate_cell(struct afs_net *net, struct afs_cell *cell)* Manage a cell record, initialising and destroying it, maintaining its DNS * records. */ -static void afs_manage_cell (struct work_struct *work) +static void afs_manage_cell (struct afs_cell *cell) { - struct afs_cell *cell = container_of(work, struct afs_cell, manager);struct afs_net *net = cell->net;bool deleted; -int ret, usage; +int ret, active;_enter ("%s" , cell->name);
@@ -660,10 +708,11 @@ static void afs_manage_cell(struct work_struct *work)case AFS_CELL_INACTIVE :case AFS_CELL_FAILED :down_write (&net->cells_lock); - usage =1 ; - deleted =atomic_try_cmpxchg_relaxed (&cell->usage, &usage,0 ); -if (deleted) + active =1 ; + deleted =atomic_try_cmpxchg_relaxed (&cell->active, &active,0 ); +if (deleted) {rb_erase (&cell->net_node, &net->cells); + }up_write (&net->cells_lock);if (deleted) goto final_destruction;
@@ -688,7 +737,7 @@ static void afs_manage_cell(struct work_struct *work) goto again;case AFS_CELL_ACTIVE : -if (atomic_read (&cell->usage) >1 ) { +if (atomic_read (&cell->active) >1 ) {if (test_and_clear_bit (AFS_CELL_FL_DO_LOOKUP , &cell->flags)) { ret =afs_update_cell (cell);if (ret <0 )
@@ -701,7 +750,7 @@ static void afs_manage_cell(struct work_struct *work) goto again;case AFS_CELL_DEACTIVATING : -if (atomic_read (&cell->usage) >1 ) +if (atomic_read (&cell->active) >1 ) goto reverse_deactivation;afs_deactivate_cell (net, cell);smp_store_release (&cell->state,AFS_CELL_INACTIVE );
@@ -733,9 +782,18 @@ static void afs_manage_cell(struct work_struct *work)return ; final_destruction: -call_rcu (&cell->rcu, afs_cell_destroy); -afs_dec_cells_outstanding (net); -_leave (" [destruct %d]" ,atomic_read (&net->cells_outstanding)); +/* The root volume is pinning the cell */ +afs_put_volume (cell->net, cell->root_volume, afs_volume_trace_put_cell_root); + cell->root_volume =NULL ; +afs_put_cell (cell); +} + +static void afs_manage_cell_work (struct work_struct *work) +{ + struct afs_cell *cell = container_of(work, struct afs_cell, manager); + +afs_manage_cell (cell); +afs_put_cell (cell); }/*
@@ -769,21 +827,20 @@ void afs_manage_cells(struct work_struct *work)for (cursor =rb_first (&net->cells); cursor; cursor =rb_next (cursor)) {struct afs_cell *cell = rb_entry(cursor, struct afs_cell, net_node); -unsigned usage; +unsigned active;bool sched_cell = false; - usage =atomic_read (&cell->usage); -_debug ("manage %s %u" , cell->name, usage); + active =atomic_read (&cell->active); +_debug ("manage %s %u %u" , cell->name,atomic_read (&cell->ref), active); - ASSERTCMP(usage, >=, 1); + ASSERTCMP(active, >=, 1);if (purging) {if (test_and_clear_bit (AFS_CELL_FL_NO_GC , &cell->flags)) - usage =atomic_dec_return (&cell->usage); - ASSERTCMP(usage, ==, 1); +atomic_dec (&cell->active); } -if (usage ==1 ) { +if (active ==1 ) {struct afs_vlserver_list *vllist;time64_t expire_at = cell->last_inactive;
@@ -806,7 +863,7 @@ void afs_manage_cells(struct work_struct *work) }if (sched_cell) -queue_work (afs_wq, &cell->manager); +afs_queue_cell (cell); }up_read (&net->cells_lock);
@@ -843,7 +900,7 @@ void afs_cell_purge(struct afs_net *net) ws = net->ws_cell; net->ws_cell =NULL ;up_write (&net->cells_lock); -afs_put_cell (net, ws); +afs_unuse_cell (net, ws);_debug ("del timer" );if (del_timer_sync (&net->cells_timer))
fs/afs/dynroot.c +1 -1
@@ -125,7 +125,7 @@ static int afs_probe_cell_name(struct dentry *dentry) cell =afs_find_cell (net, name, len);if (!IS_ERR (cell)) { -afs_put_cell (net, cell); +afs_unuse_cell (net, cell);return 0 ; }
fs/afs/internal.h +6 -2
@@ -363,7 +363,8 @@ struct afs_cell {#endif time64_t dns_expiry;/* Time AFSDB/SRV record expires */ time64_t last_inactive;/* Time of last drop of usage count */ -atomic_t usage; +atomic_t ref;/* Struct refcount */ +atomic_t active;/* Active usage counter */ unsigned long flags;#define AFS_CELL_FL_NO_GC 0/* The cell was added manually, don't auto-gc */ #define AFS_CELL_FL_DO_LOOKUP 1/* DNS lookup requested */
@@ -918,8 +919,11 @@ extern int afs_cell_init(struct afs_net *, const char *);extern struct afs_cell *afs_find_cell (struct afs_net *,const char *,unsigned );extern struct afs_cell *afs_lookup_cell (struct afs_net *,const char *,unsigned ,const char *,bool ); +extern struct afs_cell *afs_use_cell (struct afs_cell *); +extern void afs_unuse_cell (struct afs_net *,struct afs_cell *);extern struct afs_cell *afs_get_cell (struct afs_cell *); -extern void afs_put_cell (struct afs_net *,struct afs_cell *); +extern void afs_put_cell (struct afs_cell *); +extern void afs_queue_cell (struct afs_cell *);extern void afs_manage_cells (struct work_struct *);extern void afs_cells_timer (struct timer_list *); extern void __net_exit afs_cell_purge(struct afs_net *);
fs/afs/mntpt.c +2 -2
@@ -88,7 +88,7 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt) ctx->force = true; }if (ctx->cell) { -afs_put_cell (ctx->net, ctx->cell); +afs_unuse_cell (ctx->net, ctx->cell); ctx->cell =NULL ; }if (test_bit (AFS_VNODE_PSEUDODIR , &vnode->flags)) {
@@ -124,7 +124,7 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt)char *buf;if (src_as->cell) - ctx->cell =afs_get_cell (src_as->cell); + ctx->cell =afs_use_cell (src_as->cell);if (size <2 || size >PAGE_SIZE -1 )return -EINVAL ;
fs/afs/proc.c +11 -12
@@ -38,7 +38,7 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)if (v ==SEQ_START_TOKEN ) {/* display header on line 1 */ -seq_puts (m,"USE TTL SV ST NAME\n" ); +seq_puts (m,"USE ACT TTL SV ST NAME\n" );return 0 ; }
@@ -46,10 +46,11 @@ static int afs_proc_cells_show(struct seq_file *m, void *v) vllist =rcu_dereference (cell->vl_servers);/* display one cell per line on subsequent lines */ -seq_printf (m,"%3u %6lld %2u %2u %s\n" , -atomic_read (&cell->usage), +seq_printf (m,"%3u %3u %6lld %2u %2u %s\n" , +atomic_read (&cell->ref), +atomic_read (&cell->active), cell->dns_expiry -ktime_get_real_seconds (), - vllist->nr_servers, + vllist ? vllist->nr_servers :0 , cell->state, cell->name);return 0 ;
@@ -128,7 +129,7 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size) }if (test_and_set_bit (AFS_CELL_FL_NO_GC , &cell->flags)) -afs_put_cell (net, cell); +afs_unuse_cell (net, cell); }else { goto inval; }
@@ -154,13 +155,11 @@ static int afs_proc_rootcell_show(struct seq_file *m, void *v)struct afs_net *net; net =afs_seq2net_single (m); -if (rcu_access_pointer (net->ws_cell)) { -rcu_read_lock (); - cell =rcu_dereference (net->ws_cell); -if (cell) -seq_printf (m,"%s\n" , cell->name); -rcu_read_unlock (); - } +down_read (&net->cells_lock); + cell = net->ws_cell; +if (cell) +seq_printf (m,"%s\n" , cell->name); +up_read (&net->cells_lock);return 0 ; }
fs/afs/super.c +6 -6
@@ -294,7 +294,7 @@ static int afs_parse_source(struct fs_context *fc, struct fs_parameter *param) cellnamesz, cellnamesz, cellname ?: "");return PTR_ERR (cell); } -afs_put_cell (ctx->net, ctx->cell); +afs_unuse_cell (ctx->net, ctx->cell); ctx->cell = cell; }
@@ -389,8 +389,8 @@ static int afs_validate_fc(struct fs_context *fc)_debug ("switch to alias" );key_put (ctx->key); ctx->key =NULL ; - cell =afs_get_cell (ctx->cell->alias_of); -afs_put_cell (ctx->net, ctx->cell); + cell =afs_use_cell (ctx->cell->alias_of); +afs_unuse_cell (ctx->net, ctx->cell); ctx->cell = cell; goto reget_key; }
@@ -508,7 +508,7 @@ static struct afs_super_info *afs_alloc_sbi(struct fs_context *fc)if (ctx->dyn_root) { as->dyn_root = true; }else { - as->cell =afs_get_cell (ctx->cell); + as->cell =afs_use_cell (ctx->cell); as->volume =afs_get_volume (ctx->volume, afs_volume_trace_get_alloc_sbi); }
@@ -521,7 +521,7 @@ static void afs_destroy_sbi(struct afs_super_info *as)if (as) {struct afs_net *net =afs_net (as->net_ns);afs_put_volume (net, as->volume, afs_volume_trace_put_destroy_sbi); -afs_put_cell (net, as->cell); +afs_unuse_cell (net, as->cell);put_net (as->net_ns);kfree (as); }
@@ -607,7 +607,7 @@ static void afs_free_fc(struct fs_context *fc)afs_destroy_sbi (fc->s_fs_info);afs_put_volume (ctx->net, ctx->volume, afs_volume_trace_put_free_fc); -afs_put_cell (ctx->net, ctx->cell); +afs_unuse_cell (ctx->net, ctx->cell);key_put (ctx->key);kfree (ctx); }
fs/afs/vl_alias.c +4 -4
@@ -177,7 +177,7 @@ static int afs_compare_cell_roots(struct afs_cell *cell) is_alias:rcu_read_unlock (); - cell->alias_of =afs_get_cell (p); + cell->alias_of =afs_use_cell (p);return 1 ; }
@@ -247,18 +247,18 @@ static int afs_query_for_alias(struct afs_cell *cell, struct key *key)continue ;if (p->root_volume)continue ;/* Ignore cells that have a root.cell volume. */ -afs_get_cell (p); +afs_use_cell (p);mutex_unlock (&cell->net->proc_cells_lock);if (afs_query_for_alias_one (cell, key, p) !=0 ) goto is_alias;if (mutex_lock_interruptible (&cell->net->proc_cells_lock) <0 ) { -afs_put_cell (cell->net, p); +afs_unuse_cell (cell->net, p);return -ERESTARTSYS ; } -afs_put_cell (cell->net, p); +afs_unuse_cell (cell->net, p); }mutex_unlock (&cell->net->proc_cells_lock);
fs/afs/vl_rotate.c +1 -1
@@ -45,7 +45,7 @@ static bool afs_start_vl_iteration(struct afs_vl_cursor *vc) cell->dns_expiry <= ktime_get_real_seconds()) { dns_lookup_count =smp_load_acquire (&cell->dns_lookup_count);set_bit (AFS_CELL_FL_DO_LOOKUP , &cell->flags); -queue_work (afs_wq, &cell->manager); +afs_queue_cell (cell);if (cell->dns_source ==DNS_RECORD_UNAVAILABLE ) { if (wait_var_event_interruptible(
fs/afs/volume.c +2 -2
@@ -106,7 +106,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params,return volume; error_1: -afs_put_cell (params->net, volume->cell); +afs_put_cell (volume->cell);kfree (volume); error_0:return ERR_PTR (ret);
@@ -228,7 +228,7 @@ static void afs_destroy_volume(struct afs_net *net, struct afs_volume *volume)afs_remove_volume_from_cell (volume);afs_put_serverlist (net,rcu_access_pointer (volume->servers)); -afs_put_cell (net, volume->cell); +afs_put_cell (volume->cell);trace_afs_volume (volume->vid,atomic_read (&volume->usage), afs_volume_trace_free);kfree_rcu (volume, rcu);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 414/633 afs: Fix rapid cell addition/removal by not using RCU on cells tree
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 92e3cc91d8f51ce64a8b7c696377180953dd316e ]
There are a number of problems that are being seen by the rapidly mounting and unmounting an afs dynamic root with an explicit cell and volume specified (which should probably be rejected, but that's a separate issue):
What the tests are doing is to look up/create a cell record for the name given and then tear it down again without actually using it to try to talk to a server. This is repeated endlessly, very fast, and the new cell collides with the old one if it's not quick enough to reuse it.
It appears (as suggested by Hillf Danton) that the search through the RB tree under a read_seqbegin_or_lock() under RCU conditions isn't safe and that it's not blocking the write_seqlock(), despite taking two passes at it. He suggested that the code should take a ref on the cell it's attempting to look at - but this shouldn't be necessary until we've compared the cell names. It's possible that I'm missing a barrier somewhere.
However, using an RCU search for this is overkill, really - we only need to access the cell name in a few places, and they're places where we're may end up sleeping anyway.
Fix this by switching to an R/W semaphore instead.
Additionally, draw the down_read() call inside the function (renamed to afs_find_cell()) since all the callers were taking the RCU read lock (or should've been[*]).
[*] afs_probe_cell_name() should have been, but that doesn't appear to be involved in the bug reports.
The symptoms of this look like:
general protection fault, probably for non-canonical address 0xf27d208691691fdb: 0000 [#1] PREEMPT SMP KASAN KASAN: maybe wild-memory-access in range [0x93e924348b48fed8-0x93e924348b48fedf] ... RIP: 0010:strncasecmp lib/string.c:52 [inline] RIP: 0010:strncasecmp+0x5f/0x240 lib/string.c:43 afs_lookup_cell_rcu+0x313/0x720 fs/afs/cell.c:88 afs_lookup_cell+0x2ee/0x1440 fs/afs/cell.c:249 afs_parse_source fs/afs/super.c:290 [inline] ...
--- fs/afs/cell.c | 131 ++++++++++++++++++++-------------------------- fs/afs/dynroot.c | 21 +++----- fs/afs/internal.h | 6 +-- fs/afs/main.c | 2 +- fs/afs/super.c | 4 +- 5 files changed, 71 insertions(+), 93 deletions(-)
fs/afs/cell.c +58 -73
@@ -41,15 +41,15 @@ static void afs_set_cell_timer(struct afs_net *net, time64_t delay) }/* -* Look up and get an activation reference on a cell record under RCU -* conditions. The caller must hold the RCU read lock. +* Look up and get an activation reference on a cell record. The caller must +* hold net->cells_lock at least read-locked. */ -struct afs_cell *afs_lookup_cell_rcu (struct afs_net *net, -const char *name,unsigned int namesz) +static struct afs_cell *afs_find_cell_locked (struct afs_net *net, +const char *name,unsigned int namesz) {struct afs_cell *cell =NULL ;struct rb_node *p; -int n, seq =0 , ret =0 ; +int n;_enter ("%*.*s" , namesz, namesz, name);
@@ -58,61 +58,48 @@ struct afs_cell *afs_lookup_cell_rcu(struct afs_net *net,if (namesz >AFS_MAXCELLNAME )return ERR_PTR (-ENAMETOOLONG ); -do { -/* Unfortunately, rbtree walking doesn't give reliable results -* under just the RCU read lock, so we have to check for -* changes. -*/ -if (cell) -afs_put_cell (net, cell); - cell =NULL ; - ret = -ENOENT ; - -read_seqbegin_or_lock (&net->cells_lock, &seq); - -if (!name) { - cell =rcu_dereference_raw (net->ws_cell); -if (cell) { -afs_get_cell (cell); - ret =0 ; -break ; - } - ret = -EDESTADDRREQ ; -continue ; - } +if (!name) { + cell = net->ws_cell; +if (!cell) +return ERR_PTR (-EDESTADDRREQ ); +afs_get_cell (cell); +return cell; + } - p =rcu_dereference_raw (net->cells.rb_node); -while (p) { - cell = rb_entry(p, struct afs_cell, net_node); - - n =strncasecmp (cell->name, name, -min_t (size_t, cell->name_len, namesz)); -if (n ==0 ) - n = cell->name_len - namesz; -if (n <0 ) { - p =rcu_dereference_raw (p->rb_left); - }else if (n >0 ) { - p =rcu_dereference_raw (p->rb_right); - }else { -if (atomic_inc_not_zero (&cell->usage)) { - ret =0 ; -break ; - } -/* We want to repeat the search, this time with -* the lock properly locked. -*/ - } - cell =NULL ; - } + p = net->cells.rb_node; +while (p) { + cell = rb_entry(p, struct afs_cell, net_node); - }while (need_seqretry (&net->cells_lock, seq)); + n =strncasecmp (cell->name, name, +min_t (size_t, cell->name_len, namesz)); +if (n ==0 ) + n = cell->name_len - namesz; +if (n <0 ) + p = p->rb_left; +else if (n >0 ) + p = p->rb_right; +else + goto found; + } + +return ERR_PTR (-ENOENT ); -done_seqretry (&net->cells_lock, seq); +found: +if (!atomic_inc_not_zero (&cell->usage)) +return ERR_PTR (-ENOENT ); -if (ret !=0 && cell) -afs_put_cell (net, cell); +return cell; +} -return ret ==0 ? cell :ERR_PTR (ret); +struct afs_cell *afs_find_cell (struct afs_net *net, +const char *name,unsigned int namesz) +{ +struct afs_cell *cell; + +down_read (&net->cells_lock); + cell =afs_find_cell_locked (net, name, namesz); +up_read (&net->cells_lock); +return cell; }/*
@@ -245,9 +232,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,_enter ("%s,%s" , name, vllist);if (!excl) { -rcu_read_lock (); - cell =afs_lookup_cell_rcu (net, name, namesz); -rcu_read_unlock (); + cell =afs_find_cell (net, name, namesz);if (!IS_ERR (cell)) goto wait_for_cell; }
@@ -268,7 +253,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,/* Find the insertion point and check to see if someone else added a * cell whilst we were allocating. */ -write_seqlock (&net->cells_lock); +down_write (&net->cells_lock); pp = &net->cells.rb_node; parent =NULL ;
@@ -293,7 +278,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,rb_link_node_rcu (&cell->net_node, parent, pp);rb_insert_color (&cell->net_node, &net->cells);atomic_inc (&net->cells_outstanding); -write_sequnlock (&net->cells_lock); +up_write (&net->cells_lock);queue_work (afs_wq, &cell->manager);
@@ -323,7 +308,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,afs_get_cell (cursor); ret =0 ; } -write_sequnlock (&net->cells_lock); +up_write (&net->cells_lock);kfree (candidate);if (ret ==0 ) goto wait_for_cell;
@@ -377,10 +362,10 @@ int afs_cell_init(struct afs_net *net, const char *rootcell)afs_get_cell (new_root);/* install the new cell */ -write_seqlock (&net->cells_lock); - old_root =rcu_access_pointer (net->ws_cell); -rcu_assign_pointer (net->ws_cell, new_root); -write_sequnlock (&net->cells_lock); +down_write (&net->cells_lock); + old_root = net->ws_cell; + net->ws_cell = new_root; +up_write (&net->cells_lock);afs_put_cell (net, old_root);_leave (" = 0" );
@@ -674,12 +659,12 @@ static void afs_manage_cell(struct work_struct *work)switch (cell->state) {case AFS_CELL_INACTIVE :case AFS_CELL_FAILED : -write_seqlock (&net->cells_lock); +down_write (&net->cells_lock); usage =1 ; deleted =atomic_try_cmpxchg_relaxed (&cell->usage, &usage,0 );if (deleted)rb_erase (&cell->net_node, &net->cells); -write_sequnlock (&net->cells_lock); +up_write (&net->cells_lock);if (deleted) goto final_destruction;if (cell->state ==AFS_CELL_FAILED )
@@ -779,7 +764,7 @@ void afs_manage_cells(struct work_struct *work)* lack of use and cells whose DNS results have expired and dispatch * their managers. */ -read_seqlock_excl (&net->cells_lock); +down_read (&net->cells_lock);for (cursor =rb_first (&net->cells); cursor; cursor =rb_next (cursor)) { struct afs_cell *cell =
@@ -824,7 +809,7 @@ void afs_manage_cells(struct work_struct *work)queue_work (afs_wq, &cell->manager); } -read_sequnlock_excl (&net->cells_lock); +up_read (&net->cells_lock);/* Update the timer on the way out. We have to pass an increment on * cells_outstanding in the namespace that we are in to the timer or
@@ -854,10 +839,10 @@ void afs_cell_purge(struct afs_net *net)_enter ("" ); -write_seqlock (&net->cells_lock); - ws =rcu_access_pointer (net->ws_cell); -RCU_INIT_POINTER (net->ws_cell,NULL ); -write_sequnlock (&net->cells_lock); +down_write (&net->cells_lock); + ws = net->ws_cell; + net->ws_cell =NULL ; +up_write (&net->cells_lock);afs_put_cell (net, ws);_debug ("del timer" );
fs/afs/dynroot.c +8 -13
@@ -123,7 +123,7 @@ static int afs_probe_cell_name(struct dentry *dentry) len--; } - cell =afs_lookup_cell_rcu (net, name, len); + cell =afs_find_cell (net, name, len);if (!IS_ERR (cell)) {afs_put_cell (net, cell);return 0 ;
@@ -179,7 +179,6 @@ static struct dentry *afs_lookup_atcell(struct dentry *dentry)struct afs_cell *cell;struct afs_net *net =afs_d2net (dentry);struct dentry *ret; -unsigned int seq =0 ;char *name;int len;
@@ -191,17 +190,13 @@ static struct dentry *afs_lookup_atcell(struct dentry *dentry)if (!name) goto out_p; -rcu_read_lock (); -do { -read_seqbegin_or_lock (&net->cells_lock, &seq); - cell =rcu_dereference_raw (net->ws_cell); -if (cell) { - len = cell->name_len; -memcpy (name, cell->name, len +1 ); - } - }while (need_seqretry (&net->cells_lock, seq)); -done_seqretry (&net->cells_lock, seq); -rcu_read_unlock (); +down_read (&net->cells_lock); + cell = net->ws_cell; +if (cell) { + len = cell->name_len; +memcpy (name, cell->name, len +1 ); + } +up_read (&net->cells_lock); ret =ERR_PTR (-ENOENT );if (!cell)
fs/afs/internal.h +3 -3
@@ -263,11 +263,11 @@ struct afs_net {/* Cell database */ struct rb_root cells; -struct afs_cell __rcu *ws_cell; +struct afs_cell *ws_cell;struct work_struct cells_manager;struct timer_list cells_timer;atomic_t cells_outstanding; -seqlock_t cells_lock; +struct rw_semaphore cells_lock;struct mutex cells_alias_lock;struct mutex proc_cells_lock;
@@ -915,7 +915,7 @@ static inline bool afs_cb_is_broken(unsigned int cb_break,* cell.c */ extern int afs_cell_init (struct afs_net *,const char *); -extern struct afs_cell *afs_lookup_cell_rcu (struct afs_net *,const char *,unsigned ); +extern struct afs_cell *afs_find_cell (struct afs_net *,const char *,unsigned );extern struct afs_cell *afs_lookup_cell (struct afs_net *,const char *,unsigned ,const char *,bool );extern struct afs_cell *afs_get_cell (struct afs_cell *);
fs/afs/main.c +1 -1
@@ -78,7 +78,7 @@ static int __net_init afs_net_init(struct net *net_ns)mutex_init (&net->socket_mutex); net->cells =RB_ROOT ; -seqlock_init (&net->cells_lock); +init_rwsem (&net->cells_lock);INIT_WORK (&net->cells_manager, afs_manage_cells);timer_setup (&net->cells_timer, afs_cells_timer,0 );
fs/afs/super.c +1 -3
@@ -634,9 +634,7 @@ static int afs_init_fs_context(struct fs_context *fc) ctx->net =afs_net (fc->net_ns);/* Default to the workstation cell. */ -rcu_read_lock (); - cell =afs_lookup_cell_rcu (ctx->net,NULL ,0 ); -rcu_read_unlock (); + cell =afs_find_cell (ctx->net,NULL ,0 );if (IS_ERR (cell)) cell =NULL ; ctx->cell = cell;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 440/633 vfio/type1: fix dirty bitmap calculation in vfio_dma_rw
In reply to Greg Kroah-HartmanFrom: Yan Zhao <[email protected]>
[ Upstream commit 2c5af98592f65517170c7bcc714566590d3f7397 ]
The count of dirtied pages is not only determined by count of copied pages, but also by the start offset.
e.g. if offset = PAGE_SIZE - 1, and *copied=2, the dirty pages count is 2, instead of 1 or 0.
--- drivers/vfio/vfio_iommu_type1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vfio/vfio_iommu_type1.c +2 -1
@@ -2899,7 +2899,8 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,* size */ bitmap_set (dma->bitmap, offset >> pgshift, - *copied >> pgshift); + ((offset + *copied -1 ) >> pgshift) - + (offset >> pgshift) +1 ); } }else *copied = copy_from_user(data, (void __user *)vaddr,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 438/633 vfio/pci: Decouple PCI_COMMAND_MEMORY bit checks from is_virtfn
In reply to Greg Kroah-HartmanFrom: Matthew Rosato <[email protected]>
[ Upstream commit 515ecd5368f1510152fa4f9b9ce55b66ac56c334 ]
While it is true that devices with is_virtfn=1 will have a Memory Space Enable bit that is hard-wired to 0, this is not the only case where we see this behavior -- For example some bare-metal hypervisors lack Memory Space Enable bit emulation for devices not setting is_virtfn (s390). Fix this by instead checking for the newly-added no_command_memory bit which directly denotes the need for PCI_COMMAND_MEMORY emulation in vfio.
--- drivers/vfio/pci/vfio_pci_config.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/vfio/pci/vfio_pci_config.c +14 -10
@@ -406,7 +406,7 @@ bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev)* PF SR-IOV capability, there's therefore no need to trigger * faults based on the virtual value. */ -return pdev->is_virtfn || (cmd &PCI_COMMAND_MEMORY ); +return pdev->no_command_memory || (cmd &PCI_COMMAND_MEMORY ); }/*
@@ -520,8 +520,8 @@ static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos, count =vfio_default_config_read (vdev, pos, count, perm, offset, val); -/* Mask in virtual memory enable for SR-IOV devices */ -if (offset ==PCI_COMMAND && vdev->pdev->is_virtfn) { +/* Mask in virtual memory enable */ +if (offset ==PCI_COMMAND && vdev->pdev->no_command_memory) {u16 cmd =le16_to_cpu (*(__le16 *)&vdev->vconfig[PCI_COMMAND ]);u32 tmp_val =le32_to_cpu (*val);
@@ -589,9 +589,11 @@ static int vfio_basic_config_write(struct vfio_pci_device *vdev, int pos,* shows it disabled (phys_mem/io, then the device has * undergone some kind of backdoor reset and needs to be * restored before we allow it to enable the bars. -* SR-IOV devices will trigger this, but we catch them later +* SR-IOV devices will trigger this - for mem enable let's +* catch this now and for io enable it will be caught later */ -if ((new_mem && virt_mem && !phys_mem) || +if ((new_mem && virt_mem && !phys_mem && + !pdev->no_command_memory) || (new_io && virt_io && !phys_io) ||vfio_need_bar_restore (vdev))vfio_bar_restore (vdev);
@@ -1734,12 +1736,14 @@ int vfio_config_init(struct vfio_pci_device *vdev) vconfig[PCI_INTERRUPT_PIN]); vconfig[PCI_INTERRUPT_PIN ] =0 ;/* Gratuitous for good VFs */ - + } +if (pdev->no_command_memory) {/* -* VFs do no implement the memory enable bit of the COMMAND -* register therefore we'll not have it set in our initial -* copy of config space after pci_enable_device(). For -* consistency with PFs, set the virtual enable bit here. +* VFs and devices that set pdev->no_command_memory do not +* implement the memory enable bit of the COMMAND register +* therefore we'll not have it set in our initial copy of +* config space after pci_enable_device(). For consistency +* with PFs, set the virtual enable bit here. */ *(__le16 *)&vconfig[PCI_COMMAND ] |=cpu_to_le16 (PCI_COMMAND_MEMORY );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 437/633 s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY
In reply to Greg Kroah-HartmanFrom: Matthew Rosato <[email protected]>
[ Upstream commit 08b6e22b850c28b6032da1e4d767a33116e23dfb ]
For s390 we can have VFs that are passed-through without the associated PF. Firmware provides an emulation layer to allow these devices to operate independently, but is missing emulation of the Memory Space Enable bit. For these as well as linked VFs, set no_command_memory which specifies these devices do not implement PCI_COMMAND_MEMORY.
--- arch/s390/pci/pci_bus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/s390/pci/pci_bus.c +3 -2
@@ -197,9 +197,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev)* With pdev->no_vf_scan the common PCI probing code does not * perform PF/VF linking. */ -if (zdev->vfn) +if (zdev->vfn) {zpci_bus_setup_virtfn (zdev->zbus, pdev, zdev->vfn); - + pdev->no_command_memory =1 ; + } }static int zpci_bus_add_device (struct zpci_bus *zbus,struct zpci_dev *zdev)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 436/633 vfio: add a singleton check for vfio_group_pin_pages
In reply to Greg Kroah-HartmanFrom: Yan Zhao <[email protected]>
[ Upstream commit 7ef32e52368f62a4e041a4f0abefb4fb64e7fd4a ]
Page pinning is used both to translate and pin device mappings for DMA purpose, as well as to indicate to the IOMMU backend to limit the dirty page scope to those pages that have been pinned, in the case of an IOMMU backed device.
To support this, the vfio_pin_pages() interface limits itself to only singleton groups such that the IOMMU backend can consider dirty page scope only at the group level. Implement the same requirement for the vfio_group_pin_pages() interface.
--- drivers/vfio/vfio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/vfio/vfio.c +3 -0
@@ -2050,6 +2050,9 @@ int vfio_group_pin_pages(struct vfio_group *group,if (!group || !user_iova_pfn || !phys_pfn || !npage)return -EINVAL ; +if (group->dev_counter >1 ) +return -EINVAL ; +if (npage >VFIO_PIN_PAGES_MAX_ENTRIES )return -E2BIG ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 433/633 rpmsg: smd: Fix a kobj leak in in qcom_smd_parse_edge()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e69ee0cf655e8e0c4a80f4319e36019b74f17639 ]
We need to call of_node_put(node) on the error paths for this function.
--- drivers/rpmsg/qcom_smd.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/rpmsg/qcom_smd.c +22 -10
@@ -1338,7 +1338,7 @@ static int qcom_smd_parse_edge(struct device *dev, ret =of_property_read_u32 (node, key, &edge->edge_id);if (ret) {dev_err (dev,"edge missing %s property\n" , key); -return -EINVAL ; + goto put_node; } edge->remote_pid =QCOM_SMEM_HOST_ANY ;
@@ -1349,32 +1349,37 @@ static int qcom_smd_parse_edge(struct device *dev, edge->mbox_client.knows_txdone = true; edge->mbox_chan =mbox_request_channel (&edge->mbox_client,0 );if (IS_ERR (edge->mbox_chan)) { -if (PTR_ERR (edge->mbox_chan) != -ENODEV ) -return PTR_ERR (edge->mbox_chan); +if (PTR_ERR (edge->mbox_chan) != -ENODEV ) { + ret =PTR_ERR (edge->mbox_chan); + goto put_node; + } edge->mbox_chan =NULL ; syscon_np =of_parse_phandle (node,"qcom,ipc" ,0 );if (!syscon_np) {dev_err (dev,"no qcom,ipc node\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto put_node; } edge->ipc_regmap =syscon_node_to_regmap (syscon_np); -if (IS_ERR (edge->ipc_regmap)) -return PTR_ERR (edge->ipc_regmap); +if (IS_ERR (edge->ipc_regmap)) { + ret =PTR_ERR (edge->ipc_regmap); + goto put_node; + } key ="qcom,ipc" ; ret =of_property_read_u32_index (node, key,1 , &edge->ipc_offset);if (ret <0 ) {dev_err (dev,"no offset in %s\n" , key); -return -EINVAL ; + goto put_node; } ret =of_property_read_u32_index (node, key,2 , &edge->ipc_bit);if (ret <0 ) {dev_err (dev,"no bit in %s\n" , key); -return -EINVAL ; + goto put_node; } }
@@ -1385,7 +1390,8 @@ static int qcom_smd_parse_edge(struct device *dev, irq =irq_of_parse_and_map (node,0 );if (irq <0 ) {dev_err (dev,"required smd interrupt missing\n" ); -return -EINVAL ; + ret = irq; + goto put_node; } ret = devm_request_irq(dev, irq,
@@ -1393,12 +1399,18 @@ static int qcom_smd_parse_edge(struct device *dev, node->name, edge);if (ret) {dev_err (dev,"failed to request smd irq\n" ); -return ret; + goto put_node; } edge->irq = irq;return 0 ; + +put_node: +of_node_put (node); + edge->of_node =NULL ; + +return ret; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 413/633 f2fs: wait for sysfs kobject removal before freeing f2fs_sb_info
In reply to Greg Kroah-HartmanFrom: Jamie Iles <[email protected]>
[ Upstream commit ae284d87abade58c8db7760c808f311ef1ce693c ]
syzkaller found that with CONFIG_DEBUG_KOBJECT_RELEASE=y, unmounting an f2fs filesystem could result in the following splat:
kobject: 'loop5' ((____ptrval____)): kobject_release, parent 0000000000000000 (delayed 250)
kobject: 'f2fs_xattr_entry-7:5' ((____ptrval____)): kobject_release, parent 0000000000000000 (delayed 750)
------------[ cut here ]------------ ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x98 WARNING: CPU: 0 PID: 699 at lib/debugobjects.c:485 debug_print_object+0x180/0x240 Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 699 Comm: syz-executor.5 Tainted: G S 5.9.0-rc8+ #101 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x4d8 show_stack+0x34/0x48 dump_stack+0x174/0x1f8 panic+0x360/0x7a0 __warn+0x244/0x2ec report_bug+0x240/0x398 bug_handler+0x50/0xc0 call_break_hook+0x160/0x1d8 brk_handler+0x30/0xc0 do_debug_exception+0x184/0x340 el1_dbg+0x48/0xb0 el1_sync_handler+0x170/0x1c8 el1_sync+0x80/0x100 debug_print_object+0x180/0x240 debug_check_no_obj_freed+0x200/0x430 slab_free_freelist_hook+0x190/0x210 kfree+0x13c/0x460 f2fs_put_super+0x624/0xa58 generic_shutdown_super+0x120/0x300 kill_block_super+0x94/0xf8 kill_f2fs_super+0x244/0x308 deactivate_locked_super+0x104/0x150 deactivate_super+0x118/0x148 cleanup_mnt+0x27c/0x3c0 __cleanup_mnt+0x28/0x38 task_work_run+0x10c/0x248 do_notify_resume+0x9d4/0x1188 work_pending+0x8/0x34c
Like the error handling for f2fs_register_sysfs(), we need to wait for the kobject to be destroyed before returning to prevent a potential use-after-free.
--- fs/f2fs/sysfs.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/sysfs.c +1 -0
@@ -964,4 +964,5 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) }kobject_del (&sbi->s_kobj);kobject_put (&sbi->s_kobj); +wait_for_completion (&sbi->s_kobj_unregister); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 430/633 PCI: aardvark: Fix compilation on s390
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit b32c012e4b98f0126aa327be2d1f409963057643 ]
Include linux/gpio/consumer.h instead of linux/gpio.h, as is said in the latter file.
This was reported by kernel test bot when compiling for s390.
drivers/pci/controller/pci-aardvark.c:350:2: error: implicit declaration of function 'gpiod_set_value_cansleep' [-Werror,-Wimplicit-function-declaration] drivers/pci/controller/pci-aardvark.c:1074:21: error: implicit declaration of function 'devm_gpiod_get_from_of_node' [-Werror,-Wimplicit-function-declaration] drivers/pci/controller/pci-aardvark.c:1076:14: error: use of undeclared identifier 'GPIOD_OUT_LOW'
--- drivers/pci/controller/pci-aardvark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +1 -1
@@ -9,7 +9,7 @@*/ #include <linux/delay.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/irqdomain.h>
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 429/633 PCI: designware-ep: Fix the Header Type check
In reply to Greg Kroah-HartmanFrom: Hou Zhiqiang <[email protected]>
[ Upstream commit 16270a92355722e387e9ca19627c5a4d7bae1354 ]
The current check will result in the multiple function device fails to initialize. So fix the check by masking out the multiple function bit.
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++- include/uapi/linux/pci_regs.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +2 -1
@@ -505,7 +505,8 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)u32 reg;int i; - hdr_type =dw_pcie_readb_dbi (pci,PCI_HEADER_TYPE ); + hdr_type =dw_pcie_readb_dbi (pci,PCI_HEADER_TYPE ) & +PCI_HEADER_TYPE_MASK ;if (hdr_type !=PCI_HEADER_TYPE_NORMAL ) { dev_err(pci->dev, "PCIe controller is not set to EP mode (hdr_type:0x%x)!\n",
include/uapi/linux/pci_regs.h +1 -0
@@ -76,6 +76,7 @@#define PCI_CACHE_LINE_SIZE 0x0c/* 8 bits */ #define PCI_LATENCY_TIMER 0x0d/* 8 bits */ #define PCI_HEADER_TYPE 0x0e/* 8 bits */ +#define PCI_HEADER_TYPE_MASK 0x7f#define PCI_HEADER_TYPE_NORMAL 0#define PCI_HEADER_TYPE_BRIDGE 1#define PCI_HEADER_TYPE_CARDBUS 2
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 428/633 clk: meson: g12a: mark fclk_div2 as critical
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 2c4e80e06790cb49ad2603855d30c5aac2209c47 ]
On Amlogic Meson G12b platform, similar to fclk_div3, the fclk_div2 seems to be necessary for the system to operate correctly as well.
Typically, the clock also gets chosen by the eMMC peripheral. This probably masked the problem so far. However, when booting from a SD card the clock seems to get disabled which leads to a system freeze.
Let's mark this clock as critical, fixing boot from SD card on G12b platforms.
--- drivers/clk/meson/g12a.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/clk/meson/g12a.c +11 -0
@@ -298,6 +298,17 @@ static struct clk_regmap g12a_fclk_div2 = { &g12a_fclk_div2_div.hw }, .num_parents = 1, +/* +* Similar to fclk_div3, it seems that this clock is used by +* the resident firmware and is required by the platform to +* operate correctly. +* Until the following condition are met, we need this clock to +* be marked as critical: +* a) Mark the clock used by a firmware resource, if possible +* b) CCF has a clock hand-off mechanism to make the sure the +* clock stays on until the proper driver comes along +*/ + .flags = CLK_IS_CRITICAL, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 427/633 i2c: rcar: Auto select RESET_CONTROLLER
In reply to Greg Kroah-HartmanFrom: Dirk Behme <[email protected]>
[ Upstream commit 5b9bacf28a973a6b16510493416baeefa2c06289 ]
The i2c-rcar driver utilizes the Generic Reset Controller kernel feature, so select the RESET_CONTROLLER option when the I2C_RCAR option is selected with a Gen3 SoC.
--- drivers/i2c/busses/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/Kconfig +1 -0
@@ -1191,6 +1191,7 @@ config I2C_RCAR tristate "Renesas R-Car I2C Controller" depends on ARCH_RENESAS || COMPILE_TEST select I2C_SLAVE + select RESET_CONTROLLER if ARCH_RCAR_GEN3 help If you say yes to this option, support will be included for the R-Car I2C controller.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 426/633 rtc: ds1307: Clear OSF flag on DS1388 when setting time
In reply to Greg Kroah-HartmanFrom: Chris Packham <[email protected]>
[ Upstream commit f471b05f76e4b1b6ba07ebc7681920a5c5b97c5d ]
Ensure the OSF flag is cleared on the DS1388 when the clock is set.
--- drivers/rtc/rtc-ds1307.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rtc/rtc-ds1307.c +4 -0
@@ -352,6 +352,10 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)regmap_update_bits (ds1307->regmap,DS1340_REG_FLAG ,DS1340_BIT_OSF ,0 );break ; +case ds_1388: +regmap_update_bits (ds1307->regmap,DS1388_REG_FLAG , +DS1388_BIT_OSF ,0 ); +break ;case mcp794xx:/* * these bits were cleared when preparing the date/time
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 425/633 clk: meson: axg-audio: separate axg and g12a regmap tables
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit cdabb1ffc7c2349b8930f752df1edcafc1d37cc1 ]
There are more differences than what we initially thought. Let's keeps things clear and separate the axg and g12a regmap tables of the audio clock controller.
--- drivers/clk/meson/axg-audio.c | 135 ++++++++++++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 8 deletions(-)
drivers/clk/meson/axg-audio.c +127 -8
@@ -1209,13 +1209,132 @@ static struct clk_hw_onecell_data sm1_audio_hw_onecell_data = { }; -/* Convenience table to populate regmap in .probe() -* Note that this table is shared between both AXG and G12A, -* with spdifout_b clocks being exclusive to G12A. Since those -* clocks are not declared within the AXG onecell table, we do not -* feel the need to have separate AXG/G12A regmap tables. -*/ +/* Convenience table to populate regmap in .probe(). */ static struct clk_regmap *const axg_clk_regmaps[] = { + &ddr_arb, + &pdm, + &tdmin_a, + &tdmin_b, + &tdmin_c, + &tdmin_lb, + &tdmout_a, + &tdmout_b, + &tdmout_c, + &frddr_a, + &frddr_b, + &frddr_c, + &toddr_a, + &toddr_b, + &toddr_c, + &loopback, + &spdifin, + &spdifout, + &resample, + &power_detect, + &mst_a_mclk_sel, + &mst_b_mclk_sel, + &mst_c_mclk_sel, + &mst_d_mclk_sel, + &mst_e_mclk_sel, + &mst_f_mclk_sel, + &mst_a_mclk_div, + &mst_b_mclk_div, + &mst_c_mclk_div, + &mst_d_mclk_div, + &mst_e_mclk_div, + &mst_f_mclk_div, + &mst_a_mclk, + &mst_b_mclk, + &mst_c_mclk, + &mst_d_mclk, + &mst_e_mclk, + &mst_f_mclk, + &spdifout_clk_sel, + &spdifout_clk_div, + &spdifout_clk, + &spdifin_clk_sel, + &spdifin_clk_div, + &spdifin_clk, + &pdm_dclk_sel, + &pdm_dclk_div, + &pdm_dclk, + &pdm_sysclk_sel, + &pdm_sysclk_div, + &pdm_sysclk, + &mst_a_sclk_pre_en, + &mst_b_sclk_pre_en, + &mst_c_sclk_pre_en, + &mst_d_sclk_pre_en, + &mst_e_sclk_pre_en, + &mst_f_sclk_pre_en, + &mst_a_sclk_div, + &mst_b_sclk_div, + &mst_c_sclk_div, + &mst_d_sclk_div, + &mst_e_sclk_div, + &mst_f_sclk_div, + &mst_a_sclk_post_en, + &mst_b_sclk_post_en, + &mst_c_sclk_post_en, + &mst_d_sclk_post_en, + &mst_e_sclk_post_en, + &mst_f_sclk_post_en, + &mst_a_sclk, + &mst_b_sclk, + &mst_c_sclk, + &mst_d_sclk, + &mst_e_sclk, + &mst_f_sclk, + &mst_a_lrclk_div, + &mst_b_lrclk_div, + &mst_c_lrclk_div, + &mst_d_lrclk_div, + &mst_e_lrclk_div, + &mst_f_lrclk_div, + &mst_a_lrclk, + &mst_b_lrclk, + &mst_c_lrclk, + &mst_d_lrclk, + &mst_e_lrclk, + &mst_f_lrclk, + &tdmin_a_sclk_sel, + &tdmin_b_sclk_sel, + &tdmin_c_sclk_sel, + &tdmin_lb_sclk_sel, + &tdmout_a_sclk_sel, + &tdmout_b_sclk_sel, + &tdmout_c_sclk_sel, + &tdmin_a_sclk_pre_en, + &tdmin_b_sclk_pre_en, + &tdmin_c_sclk_pre_en, + &tdmin_lb_sclk_pre_en, + &tdmout_a_sclk_pre_en, + &tdmout_b_sclk_pre_en, + &tdmout_c_sclk_pre_en, + &tdmin_a_sclk_post_en, + &tdmin_b_sclk_post_en, + &tdmin_c_sclk_post_en, + &tdmin_lb_sclk_post_en, + &tdmout_a_sclk_post_en, + &tdmout_b_sclk_post_en, + &tdmout_c_sclk_post_en, + &tdmin_a_sclk, + &tdmin_b_sclk, + &tdmin_c_sclk, + &tdmin_lb_sclk, + &tdmout_a_sclk, + &tdmout_b_sclk, + &tdmout_c_sclk, + &tdmin_a_lrclk, + &tdmin_b_lrclk, + &tdmin_c_lrclk, + &tdmin_lb_lrclk, + &tdmout_a_lrclk, + &tdmout_b_lrclk, + &tdmout_c_lrclk, +}; + +static struct clk_regmap *const g12a_clk_regmaps[] = { &ddr_arb, &pdm, &tdmin_a,
@@ -1713,8 +1832,8 @@ static const struct audioclk_data axg_audioclk_data = { };static const struct audioclk_data g12a_audioclk_data = { - .regmap_clks = axg_clk_regmaps, - .regmap_clk_num =ARRAY_SIZE (axg_clk_regmaps), + .regmap_clks = g12a_clk_regmaps, + .regmap_clk_num =ARRAY_SIZE (g12a_clk_regmaps), .hw_onecell_data = &g12a_audio_hw_onecell_data, .reset_offset =AUDIO_SW_RESET , .reset_num =26 ,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 424/633 mailbox: avoid timer start from callback
In reply to Greg Kroah-HartmanFrom: Jassi Brar <[email protected]>
[ Upstream commit c7dacf5b0f32957b24ef29df1207dc2cd8307743 ]
If the txdone is done by polling, it is possible for msg_submit() to start the timer while txdone_hrtimer() callback is running. If the timer needs recheduling, it could already be enqueued by the time hrtimer_forward_now() is called, leading hrtimer to loudly complain.
WARNING: CPU: 3 PID: 74 at kernel/time/hrtimer.c:932 hrtimer_forward+0xc4/0x110 CPU: 3 PID: 74 Comm: kworker/u8:1 Not tainted 5.9.0-rc2-00236-gd3520067d01c-dirty #5 Hardware name: Libre Computer AML-S805X-AC (DT) Workqueue: events_freezable_power_ thermal_zone_device_check pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--) pc : hrtimer_forward+0xc4/0x110 lr : txdone_hrtimer+0xf8/0x118
[...]
This can be fixed by not starting the timer from the callback path. Which requires the timer reloading as long as any message is queued on the channel, and not just when current tx is not done yet.
--- drivers/mailbox/mailbox.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/mailbox/mailbox.c +7 -5
@@ -82,9 +82,12 @@ static void msg_submit(struct mbox_chan *chan) exit:spin_unlock_irqrestore (&chan->lock, flags); -if (!err && (chan->txdone_method &TXDONE_BY_POLL )) -/* kick start the timer immediately to avoid delays */ -hrtimer_start (&chan->mbox->poll_hrt,0 ,HRTIMER_MODE_REL ); +/* kick start the timer immediately to avoid delays */ +if (!err && (chan->txdone_method &TXDONE_BY_POLL )) { +/* but only if not already active */ +if (!hrtimer_active (&chan->mbox->poll_hrt)) +hrtimer_start (&chan->mbox->poll_hrt,0 ,HRTIMER_MODE_REL ); + } }static void tx_tick (struct mbox_chan *chan,int r)
@@ -122,11 +125,10 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)struct mbox_chan *chan = &mbox->chans[i];if (chan->active_req && chan->cl) { + resched = true; txdone = chan->mbox->ops->last_tx_done (chan);if (txdone)tx_tick (chan,0 ); -else - resched = true; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 423/633 rapidio: fix the missed put_device() for rio_mport_add_riodev
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit 85094c05eeb47d195a74a25366a2db066f1c9d47 ]
rio_mport_add_riodev() misses to call put_device() when the device already exists. Add the missed function call to fix it.
--- drivers/rapidio/devices/rio_mport_cdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rapidio/devices/rio_mport_cdev.c +4 -1
@@ -1680,6 +1680,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,struct rio_dev *rdev;struct rio_switch *rswitch =NULL ;struct rio_mport *mport; +struct device *dev;size_t size;u32 rval;u32 swpinfo =0 ;
@@ -1694,8 +1695,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,rmcd_debug (RDEV ,"name:%s ct:0x%x did:0x%x hc:0x%x" , dev_info.name, dev_info.comptag, dev_info.destid, dev_info.hopcount); -if (bus_find_device_by_name (&rio_bus_type,NULL , dev_info.name)) { + dev =bus_find_device_by_name (&rio_bus_type,NULL , dev_info.name); +if (dev) {rmcd_debug (RDEV ,"device %s already exists" , dev_info.name); +put_device (dev);return -EEXIST ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 385/633 RDMA/hns: Fix the wrong value of rnr_retry when querying qp
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit 99fcf82521d91468ee6115a3c253aa032dc63cbc ]
The rnr_retry returned to the user is not correct, it should be got from another fields in QPC.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -1
@@ -4795,7 +4795,9 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, qp_attr->retry_cnt =roce_get_field (context.byte_212_lsn,V2_QPC_BYTE_212_RETRY_CNT_M ,V2_QPC_BYTE_212_RETRY_CNT_S ); - qp_attr->rnr_retry =le32_to_cpu (context.rq_rnr_timer); + qp_attr->rnr_retry =roce_get_field (context.byte_244_rnr_rxack, +V2_QPC_BYTE_244_RNR_CNT_M , +V2_QPC_BYTE_244_RNR_CNT_S ); done: qp_attr->cur_qp_state = qp_attr->qp_state;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 386/633 RDMA/hns: Fix configuration of ack_req_freq in QPC
In reply to Greg Kroah-HartmanFrom: Weihang Li <[email protected]>
[ Upstream commit fbed9d2be292504e04caa2057e3a9477a1e1d040 ]
The hardware will add AckReq flag in BTH header according to the value of ack_req_freq to request ACK from responder for the packets with this flag. It should be greater than or equal to lp_pktn_ini instead of using a fixed value.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +12 -6
@@ -3640,9 +3640,6 @@ static void modify_qp_reset_to_init(struct ib_qp *ibqp, V2_QPC_BYTE_76_SRQ_EN_S, 1); } -roce_set_field (context->byte_172_sq_psn,V2_QPC_BYTE_172_ACK_REQ_FREQ_M , -V2_QPC_BYTE_172_ACK_REQ_FREQ_S ,4 ); -roce_set_bit (context->byte_172_sq_psn,V2_QPC_BYTE_172_FRE_S ,1 ); hr_qp->access_flags = attr->qp_access_flags;
@@ -3983,6 +3980,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,dma_addr_t trrl_ba;dma_addr_t irrl_ba;enum ib_mtu mtu; +u8 lp_pktn_ini;u8 port_num;u64 *mtts;u8 *dmac;
@@ -4090,13 +4088,21 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp, }#define MAX_LP_MSG_LEN 65536 -/* MTU*(2^LP_PKTN_INI) shouldn't be bigger than 64kb */ +/* MTU * (2 ^ LP_PKTN_INI) shouldn't be bigger than 64KB */ + lp_pktn_ini =ilog2 (MAX_LP_MSG_LEN /ib_mtu_enum_to_int (mtu)); +roce_set_field (context->byte_56_dqpn_err,V2_QPC_BYTE_56_LP_PKTN_INI_M , -V2_QPC_BYTE_56_LP_PKTN_INI_S , -ilog2 (MAX_LP_MSG_LEN /ib_mtu_enum_to_int (mtu))); +V2_QPC_BYTE_56_LP_PKTN_INI_S , lp_pktn_ini);roce_set_field (qpc_mask->byte_56_dqpn_err,V2_QPC_BYTE_56_LP_PKTN_INI_M ,V2_QPC_BYTE_56_LP_PKTN_INI_S ,0 ); +/* ACK_REQ_FREQ should be larger than or equal to LP_PKTN_INI */ +roce_set_field (context->byte_172_sq_psn,V2_QPC_BYTE_172_ACK_REQ_FREQ_M , +V2_QPC_BYTE_172_ACK_REQ_FREQ_S , lp_pktn_ini); +roce_set_field (qpc_mask->byte_172_sq_psn, +V2_QPC_BYTE_172_ACK_REQ_FREQ_M , +V2_QPC_BYTE_172_ACK_REQ_FREQ_S ,0 ); +roce_set_bit (qpc_mask->byte_108_rx_reqepsn,V2_QPC_BYTE_108_RX_REQ_PSN_ERR_S ,0 ); roce_set_field(qpc_mask->byte_96_rx_reqmsn, V2_QPC_BYTE_96_RX_REQ_MSN_M,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 422/633 rapidio: fix error handling path
In reply to Greg Kroah-HartmanFrom: Souptick Joarder <[email protected]>
[ Upstream commit fa63f083b3492b5ed5332b8d7c90b03b5ef24a1d ]
rio_dma_transfer() attempts to clamp the return value of pin_user_pages_fast() to be >= 0. However, the attempt fails because nr_pages is overridden a few lines later, and restored to the undesirable -ERRNO value.
The return value is ultimately stored in nr_pages, which in turn is passed to unpin_user_pages(), which expects nr_pages >= 0, else, disaster.
Fix this by fixing the nesting of the assignment to nr_pages: nr_pages should be clamped to zero if pin_user_pages_fast() returns -ERRNO, or set to the return value of pin_user_pages_fast(), otherwise.
[[email protected]: new changelog]
--- drivers/rapidio/devices/rio_mport_cdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +7 -6
@@ -871,15 +871,16 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,rmcd_error ("pin_user_pages_fast err=%ld" , pinned); nr_pages =0 ; - }else + }else {rmcd_error ("pinned %ld out of %ld pages" , pinned, nr_pages); +/* +* Set nr_pages up to mean "how many pages to unpin, in +* the error handler: +*/ + nr_pages = pinned; + } ret = -EFAULT ; -/* -* Set nr_pages up to mean "how many pages to unpin, in -* the error handler: -*/ - nr_pages = pinned; goto err_pg; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 384/633 RDMA/hns: Solve the overflow of the calc_pg_sz()
In reply to Greg Kroah-HartmanFrom: Jiaran Zhang <[email protected]>
[ Upstream commit 768202a0825d447de785e87ff1ea1d3c86a71727 ]
calc_pg_sz() may gets a data calculation overflow if the PAGE_SIZE is 64 KB and hop_num is 2. It is because that all variables involved in calculation are defined in type of int. So change the type of bt_chunk_size, buf_chunk_size and obj_per_chunk_default to u64.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -3
@@ -1770,9 +1770,9 @@ static void calc_pg_sz(int obj_num, int obj_size, int hop_num, int ctx_bt_num, int *buf_page_size, int *bt_page_size, u32 hem_type) { u64 obj_per_chunk; -int bt_chunk_size =1 <<PAGE_SHIFT ; -int buf_chunk_size =1 <<PAGE_SHIFT ; -int obj_per_chunk_default = buf_chunk_size / obj_size; +u64 bt_chunk_size =PAGE_SIZE ; +u64 buf_chunk_size =PAGE_SIZE ; +u64 obj_per_chunk_default = buf_chunk_size / obj_size; *buf_page_size =0 ; *bt_page_size =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 172/633 selftests/bpf: Fix test_vmlinux test to use bpf_probe_read_user()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 02f47faa25db134f6043fb6b12a68b5d4c980bb6 ]
The test is reading UAPI kernel structure from user-space. So it doesn't need CO-RE relocations and has to use bpf_probe_read_user().
--- tools/testing/selftests/bpf/progs/test_vmlinux.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/progs/test_vmlinux.c +9 -3
@@ -19,12 +19,14 @@ SEC("tp/syscalls/sys_enter_nanosleep")int handle__tp (struct trace_event_raw_sys_enter *args) {struct __kernel_timespec *ts; +long tv_nsec;if (args->id != __NR_nanosleep)return 0 ; ts = (void *)args->args[0 ]; -if (BPF_CORE_READ (ts, tv_nsec) !=MY_TV_NSEC ) +if (bpf_probe_read_user (&tv_nsec,sizeof (ts->tv_nsec), &ts->tv_nsec) || + tv_nsec !=MY_TV_NSEC )return 0 ; tp_called = true;
@@ -35,12 +37,14 @@ SEC("raw_tp/sys_enter")int BPF_PROG (handle__raw_tp ,struct pt_regs *regs,long id) {struct __kernel_timespec *ts; +long tv_nsec;if (id != __NR_nanosleep)return 0 ; ts = (void *)PT_REGS_PARM1_CORE (regs); -if (BPF_CORE_READ (ts, tv_nsec) !=MY_TV_NSEC ) +if (bpf_probe_read_user (&tv_nsec,sizeof (ts->tv_nsec), &ts->tv_nsec) || + tv_nsec !=MY_TV_NSEC )return 0 ; raw_tp_called = true;
@@ -51,12 +55,14 @@ SEC("tp_btf/sys_enter")int BPF_PROG (handle__tp_btf ,struct pt_regs *regs,long id) {struct __kernel_timespec *ts; +long tv_nsec;if (id != __NR_nanosleep)return 0 ; ts = (void *)PT_REGS_PARM1_CORE (regs); -if (BPF_CORE_READ (ts, tv_nsec) !=MY_TV_NSEC ) +if (bpf_probe_read_user (&tv_nsec,sizeof (ts->tv_nsec), &ts->tv_nsec) || + tv_nsec !=MY_TV_NSEC )return 0 ; tp_btf_called = true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 382/633 perf stat: Skip duration_time in setup_system_wide
In reply to Greg Kroah-HartmanFrom: Jin Yao <[email protected]>
[ Upstream commit 002a3d690f95804bdef6b70b26154103518e13d9 ]
Some metrics (such as DRAM_BW_Use) consists of uncore events and duration_time. For uncore events, counter->core.system_wide is true. But for duration_time, counter->core.system_wide is false so target.system_wide is set to false.
Then 'enable_on_exec' is set in perf_event_attr of uncore event. Kernel will return error when trying to open the uncore event.
This patch skips the duration_time in setup_system_wide then target.system_wide will be set to true for the evlist of uncore events + duration_time.
Before (tested on skylake desktop):
# perf stat -M DRAM_BW_Use -- sleep 1 Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (arb/event=0x84,umask=0x1/). /bin/dmesg | grep -i perf may provide additional information.
After:
# perf stat -M DRAM_BW_Use -- sleep 1
Performance counter stats for 'system wide':
169 arb/event=0x84,umask=0x1/ # 0.00 DRAM_BW_Use
40,427 arb/event=0x81,umask=0x1/
1,000,902,197 ns duration_time1.000902197 seconds time elapsed
--- tools/perf/builtin-stat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-stat.c +3 -1
@@ -1963,8 +1963,10 @@ static void setup_system_wide(int forks)struct evsel *counter;evlist__for_each_entry (evsel_list, counter) { -if (!counter->core.system_wide) +if (!counter->core.system_wide && +strcmp (counter->name,"duration_time" )) {return ; + } }if (evsel_list->core.nr_entries)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 407/633 f2fs: reject CASEFOLD inode flag without casefold feature
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit f6322f3f1212e005e7e6aa82ceb62be53030a64b ]
syzbot reported:
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 0 PID: 6860 Comm: syz-executor835 Not tainted 5.9.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:utf8_casefold+0x43/0x1b0 fs/unicode/utf8-core.c:107
[...]
Call Trace:
f2fs_init_casefolded_name fs/f2fs/dir.c:85 [inline]
__f2fs_setup_filename fs/f2fs/dir.c:118 [inline]
f2fs_prepare_lookup+0x3bf/0x640 fs/f2fs/dir.c:163
f2fs_lookup+0x10d/0x920 fs/f2fs/namei.c:494
__lookup_hash+0x115/0x240 fs/namei.c:1445
filename_create+0x14b/0x630 fs/namei.c:3467
user_path_create fs/namei.c:3524 [inline]
do_mkdirat+0x56/0x310 fs/namei.c:3664
do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
[...]The problem is that an inode has F2FS_CASEFOLD_FL set, but the filesystem doesn't have the casefold feature flag set, and therefore super_block::s_encoding is NULL.
Fix this by making sanity_check_inode() reject inodes that have F2FS_CASEFOLD_FL when the filesystem doesn't have the casefold feature.
--- fs/f2fs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/f2fs/inode.c +7 -0
@@ -287,6 +287,13 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)return false; } +if ((fi->i_flags &F2FS_CASEFOLD_FL ) && !f2fs_sb_has_casefold (sbi)) { +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_warn (sbi,"%s: inode (ino=%lx) has casefold flag, but casefold feature is off" , + __func__, inode->i_ino); +return false; + } +if (f2fs_has_extra_attr (inode) &&f2fs_sb_has_compression (sbi) && fi->i_flags &F2FS_COMPR_FL && F2FS_FITS_IN_INODE(ri, fi->i_extra_isize,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 410/633 maiblox: mediatek: Fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 558e4c36ec9f2722af4fe8ef84dc812bcdb5c43a ]
platform_get_irq() returns -ERRNO on error. In such case casting to u32 and comparing to 0 would pass the check.
--- drivers/mailbox/mtk-cmdq-mailbox.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +3 -5
@@ -69,7 +69,7 @@ struct cmdq_task {struct cmdq {struct mbox_controller mbox;void __iomem *base; -u32 irq; +int irq;u32 thread_nr;u32 irq_mask;struct cmdq_thread *thread;
@@ -466,10 +466,8 @@ static int cmdq_probe(struct platform_device *pdev) } cmdq->irq =platform_get_irq (pdev,0 ); -if (!cmdq->irq) { -dev_err (dev,"failed to get irq\n" ); -return -EINVAL ; - } +if (cmdq->irq <0 ) +return cmdq->irq; cmdq->thread_nr = (u32 )(unsigned long )of_device_get_match_data (dev); cmdq->irq_mask =GENMASK (cmdq->thread_nr -1 ,0 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 380/633 RDMA/mlx5: Disable IB_DEVICE_MEM_MGT_EXTENSIONS if IB_WR_REG_MR cant work
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 0ec52f0194638e2d284ad55eba5a7aff753de1b9 ]
set_reg_wr() always fails if !umr_modify_entity_size_disabled because mlx5_ib_can_use_umr() always fails. Without set_reg_wr() IB_WR_REG_MR doesn't work and that means the device should not advertise IB_DEVICE_MEM_MGT_EXTENSIONS.
--- drivers/infiniband/hw/mlx5/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +3 -1
@@ -867,7 +867,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,/* We support 'Gappy' memory registration too */ props->device_cap_flags |=IB_DEVICE_SG_GAPS_REG ; } - props->device_cap_flags |=IB_DEVICE_MEM_MGT_EXTENSIONS ; +/* IB_WR_REG_MR always requires changing the entity size with UMR */ +if (!MLX5_CAP_GEN (dev->mdev, umr_modify_entity_size_disabled)) + props->device_cap_flags |=IB_DEVICE_MEM_MGT_EXTENSIONS ;if (MLX5_CAP_GEN (mdev, sho)) { props->device_cap_flags |=IB_DEVICE_INTEGRITY_HANDOVER ;/* At this stage no support for signature handover */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 272/633 slimbus: qcom-ngd-ctrl: disable ngd in qmi server down callback
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 709ec3f7fc5773ac4aa6fb22c3f0ac8103c674db ]
In QMI new server notification we enable the NGD however during delete server notification we do not disable the NGD.
This can lead to multiple instances of NGD being enabled, so make sure that we disable NGD in delete server callback to fix this issue!
--- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +4 -0
@@ -1277,9 +1277,13 @@ static void qcom_slim_ngd_qmi_del_server(struct qmi_handle *hdl, {struct qcom_slim_ngd_qmi *qmi = container_of(hdl, struct qcom_slim_ngd_qmi, svc_event_hdl); +struct qcom_slim_ngd_ctrl *ctrl = + container_of(qmi, struct qcom_slim_ngd_ctrl, qmi); qmi->svc_info.sq_node =0 ; qmi->svc_info.sq_port =0 ; + +qcom_slim_ngd_enable (ctrl, false); }static struct qmi_ops qcom_slim_ngd_qmi_svc_event_ops = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 404/633 cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier
In reply to Greg Kroah-HartmanFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit a2d0230b91f7e23ceb5d8fb6a9799f30517ec33a ]
The patch avoids allocating cpufreq_policy on stack hence fixing frame size overflow in 'powernv_cpufreq_reboot_notifier':
drivers/cpufreq/powernv-cpufreq.c: In function powernv_cpufreq_reboot_notifier:
drivers/cpufreq/powernv-cpufreq.c:906:1: error: the frame size of 2064 bytes is larger than 2048 bytes
--- drivers/cpufreq/powernv-cpufreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/cpufreq/powernv-cpufreq.c +6 -3
@@ -884,12 +884,15 @@ static int powernv_cpufreq_reboot_notifier(struct notifier_block *nb, unsigned long action, void *unused) { int cpu; -struct cpufreq_policy cpu_policy; +struct cpufreq_policy *cpu_policy; rebooting = true;for_each_online_cpu (cpu) { -cpufreq_get_policy (&cpu_policy, cpu); -powernv_cpufreq_target_index (&cpu_policy,get_nominal_index ()); + cpu_policy =cpufreq_cpu_get (cpu); +if (!cpu_policy) +continue ; +powernv_cpufreq_target_index (cpu_policy,get_nominal_index ()); +cpufreq_cpu_put (cpu_policy); }return NOTIFY_DONE ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 406/633 RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt()
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit e7ec96fc7932f48a6d6cdd05bf82004a1a04285b ]
The changes referenced below replaced sbk_clone)_ by taking additional references, passing the skb along and then freeing the skb. This deleted the packets before they could be processed and additionally passed bad data in each packet. Since pkt is stored in skb->cb changing pkt->qp changed it for all the packets.
Replace skb_get() by sbk_clone() in rxe_rcv_mcast_pkt() for cases where multiple QPs are receiving multicast packets on the same address.
Delete kfree_skb() because the packets need to live until they have been processed by each QP. They are freed later.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +12 -5
@@ -281,6 +281,8 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)struct rxe_mc_elem *mce;struct rxe_qp *qp;union ib_gid dgid; +struct sk_buff *per_qp_skb; +struct rxe_pkt_info *per_qp_pkt;int err;if (skb->protocol ==htons (ETH_P_IP ))
@@ -309,21 +311,26 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)if (err)continue ; -/* if *not* the last qp in the list -* increase the users of the skb then post to the next qp +/* for all but the last qp create a new clone of the +* skb and pass to the qp. */ if (mce->qp_list.next != &mcg->qp_list) -skb_get (skb); + per_qp_skb =skb_clone (skb,GFP_ATOMIC ); +else + per_qp_skb = skb; - pkt->qp = qp; + per_qp_pkt =SKB_TO_PKT (per_qp_skb); + per_qp_pkt->qp = qp;rxe_add_ref (qp); -rxe_rcv_pkt (pkt, skb); +rxe_rcv_pkt (per_qp_pkt, per_qp_skb); }spin_unlock_bh (&mcg->mcg_lock);rxe_drop_ref (mcg);/* drop ref from rxe_pool_get_key. */ +return ; + err1:kfree_skb (skb); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 268/633 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_beacon
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 071c8ce8e92a86b8bf78678e78eb4b79fdc16768 ]
Release mcu message memory in case of failure in mt7915_mcu_add_beacon routine
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +10 -8
@@ -2267,14 +2267,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw,struct bss_info_bcn *bcn;int len =MT7915_BEACON_UPDATE_SIZE +MAX_BEACON_SIZE ; - rskb =mt7915_mcu_alloc_sta_req (dev, mvif,NULL , len); -if (IS_ERR (rskb)) -return PTR_ERR (rskb); - - tlv =mt7915_mcu_add_tlv (rskb,BSS_INFO_OFFLOAD ,sizeof (*bcn)); - bcn = (struct bss_info_bcn *)tlv; - bcn->enable = en; - skb =ieee80211_beacon_get_template (hw, vif, &offs);if (!skb)return -EINVAL ;
@@ -2285,6 +2277,16 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw,return -EINVAL ; } + rskb =mt7915_mcu_alloc_sta_req (dev, mvif,NULL , len); +if (IS_ERR (rskb)) { +dev_kfree_skb (skb); +return PTR_ERR (rskb); + } + + tlv =mt7915_mcu_add_tlv (rskb,BSS_INFO_OFFLOAD ,sizeof (*bcn)); + bcn = (struct bss_info_bcn *)tlv; + bcn->enable = en; +if (mvif->band_idx) { info =IEEE80211_SKB_CB (skb); info->hw_queue |=MT_TX_HW_QUEUE_EXT_PHY ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 377/633 RDMA/hns: Set the unsupported wr opcode
In reply to Greg Kroah-HartmanFrom: Lijun Ou <[email protected]>
[ Upstream commit 22d3e1ed2cc837af87f76c3c8a4ccf4455e225c5 ]
hip06 does not support IB_WR_LOCAL_INV, so the ps_opcode should be set to an invalid value instead of being left uninitialized.
--- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +0 -1
@@ -271,7 +271,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp, ps_opcode =HNS_ROCE_WQE_OPCODE_SEND ;break ;case IB_WR_LOCAL_INV : -break ;case IB_WR_ATOMIC_CMP_AND_SWP :case IB_WR_ATOMIC_FETCH_AND_ADD :case IB_WR_LSO :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 383/633 RDMA/hns: Add check for the validity of sl configuration
In reply to Greg Kroah-HartmanFrom: Jiaran Zhang <[email protected]>
[ Upstream commit 172505cfa3a8ee98acaa569fd3be97697b333958 ]
According to the RoCE v1 specification, the sl (service level) 0-7 are mapped directly to priorities 0-7 respectively, sl 8-15 are reserved. The driver should verify whether the the value of sl is larger than 7, if so, an exception should be returned.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 12 ++++++++++-- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +10 -2
@@ -4287,11 +4287,19 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp, V2_QPC_BYTE_28_FL_S, 0);memcpy (context->dgid, grh->dgid.raw,sizeof (grh->dgid.raw));memset (qpc_mask->dgid,0 ,sizeof (grh->dgid.raw)); + + hr_qp->sl =rdma_ah_get_sl (&attr->ah_attr); +if (unlikely (hr_qp->sl >MAX_SERVICE_LEVEL )) { +ibdev_err (ibdev, +"failed to fill QPC, sl (%d) shouldn't be larger than %d.\n" , + hr_qp->sl,MAX_SERVICE_LEVEL ); +return -EINVAL ; + } +roce_set_field (context->byte_28_at_fl,V2_QPC_BYTE_28_SL_M , -V2_QPC_BYTE_28_SL_S ,rdma_ah_get_sl (&attr->ah_attr)); +V2_QPC_BYTE_28_SL_S , hr_qp->sl);roce_set_field (qpc_mask->byte_28_at_fl,V2_QPC_BYTE_28_SL_M ,V2_QPC_BYTE_28_SL_S ,0 ); - hr_qp->sl =rdma_ah_get_sl (&attr->ah_attr);return 0 ; }
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +2 -0
@@ -1957,6 +1957,8 @@ struct hns_roce_eq_context {#define HNS_ROCE_V2_AEQE_EVENT_QUEUE_NUM_S 0#define HNS_ROCE_V2_AEQE_EVENT_QUEUE_NUM_M GENMASK(23, 0) +#define MAX_SERVICE_LEVEL 0x7 +struct hns_roce_wqe_atomic_seg {__le64 fetchadd_swap_data;__le64 cmp_data;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 409/633 um: time-travel: Fix IRQ handling in time_travel_handle_message()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit ebef8ea2ba967026192a26f4529890893919bc57 ]
As the comment here indicates, we need to do the polling in the idle loop without blocking interrupts, since interrupts can be vhost-user messages that we must process even while in our idle loop.
I don't know why I explained one thing and implemented another, but we have indeed observed random hangs due to this, depending on the timing of the messages.
--- arch/um/kernel/time.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/um/kernel/time.c +9 -5
@@ -70,13 +70,17 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,* read of the message and write of the ACK. */ if (mode !=TTMH_READ ) { +bool disabled =irqs_disabled (); + +BUG_ON (mode ==TTMH_IDLE && !disabled); + +if (disabled) +local_irq_enable ();while (os_poll (1 , &time_travel_ext_fd) !=0 ) { -if (mode ==TTMH_IDLE ) { -BUG_ON (!irqs_disabled ()); -local_irq_enable (); -local_irq_disable (); - } +/* nothing */ } +if (disabled) +local_irq_disable (); } ret =os_read_file (time_travel_ext_fd, msg,sizeof (*msg));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 405/633 IB/rdmavt: Fix sizeof mismatch
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 8e71f694e0c819db39af2336f16eb9689f1ae53f ]
An incorrect sizeof is being used, struct rvt_ibport ** is not correct, it should be struct rvt_ibport *. Note that since ** is the same size as
* this is not causing any issues. Improve this fix by using sizeof(*rdi->ports) as this allows us to not even reference the type of the pointer. Also remove line breaks as the entire statement can fit on one line.
Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")
--- drivers/infiniband/sw/rdmavt/vt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/sw/rdmavt/vt.c +1 -3
@@ -95,9 +95,7 @@ struct rvt_dev_info *rvt_alloc_device(size_t size, int nports)if (!rdi)return rdi; - rdi->ports =kcalloc (nports, -sizeof (struct rvt_ibport **), -GFP_KERNEL ); + rdi->ports =kcalloc (nports,sizeof (*rdi->ports),GFP_KERNEL );if (!rdi->ports)ib_dealloc_device (&rdi->ibdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 270/633 slimbus: core: check get_addr before removing laddr ida
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit f97769fde678e111a1b7b165b380d8a3dfe54f4e ]
logical address can be either assigned by the SLIMBus controller or the core. Core uses IDA in cases where get_addr callback is not provided by the controller.
Core already has this check while allocating IDR, however during absence reporting this is not checked. This patch fixes this issue.
--- drivers/slimbus/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/slimbus/core.c +2 -2
@@ -326,8 +326,8 @@ void slim_report_absent(struct slim_device *sbdev)mutex_lock (&ctrl->lock); sbdev->is_laddr_valid = false;mutex_unlock (&ctrl->lock); - -ida_simple_remove (&ctrl->laddr_ida, sbdev->laddr); +if (!ctrl->get_laddr) +ida_simple_remove (&ctrl->laddr_ida, sbdev->laddr);slim_device_update_status (sbdev,SLIM_DEVICE_STATUS_DOWN ); }EXPORT_SYMBOL_GPL (slim_report_absent);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 412/633 selftests/powerpc: Fix eeh-basic.sh exit codes
In reply to Greg Kroah-HartmanFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit 996f9e0f93f16211945c8d5f18f296a88cb32f91 ]
The kselftests test running infrastructure expects tests to finish with an exit code of 4 if the test decided it should be skipped. Currently eeh-basic.sh exits with the number of devices that failed to recover, so if four devices didn't recover we'll report a skip instead of a fail.
Fix this by checking if the return code is non-zero and report success and failure by returning 0 or 1 respectively. For the cases where should actually skip return 4.
--- tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/powerpc/eeh/eeh-basic.sh +6 -3
@@ -1,17 +1,19 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only +KSELFTESTS_SKIP=4 + . ./eeh-functions.sh if ! eeh_supported ; then echo "EEH not supported on this system, skipping" - exit 0; + exit $KSELFTESTS_SKIP; fi if [ ! -e "/sys/kernel/debug/powerpc/eeh_dev_check" ] && \ [ ! -e "/sys/kernel/debug/powerpc/eeh_dev_break" ] ; then echo "debugfs EEH testing files are missing. Is debugfs mounted?" - exit 1; + exit $KSELFTESTS_SKIP; fi pre_lspci=`mktemp`
@@ -84,4 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)" lspci | diff -u $pre_lspci - rm -f $pre_lspci -exit $failed +test "$failed" == 0 +exit $?
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 35/633 chelsio/chtls: Fix panic when listen on multiadapter
In reply to Greg Kroah-HartmanFrom: Vinay Kumar Yadav <[email protected]>
[ Upstream commit 9819f22c410b4bf6589d3126e8bc3952db507cbf ]
Add the logic to compare net_device returned by ip_dev_find() with the net_device list in cdev->ports[] array and return net_device if matched else NULL.
--- drivers/crypto/chelsio/chtls/chtls_cm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/crypto/chelsio/chtls/chtls_cm.c +8 -2
@@ -92,11 +92,13 @@ static void chtls_sock_release(struct krstatic struct net_device *chtls_find_netdev (struct chtls_dev *cdev,struct sock *sk) { +struct adapter *adap =pci_get_drvdata (cdev->pdev);struct net_device *ndev = cdev->ports[0 ];#if IS_ENABLED (CONFIG_IPV6 )struct net_device *temp;int addr_type;#endif +int i;switch (sk->sk_family) {case PF_INET :
@@ -127,8 +129,12 @@ static struct net_device *chtls_find_netreturn NULL ;if (is_vlan_dev (ndev)) -return vlan_dev_real_dev (ndev); -return ndev; + ndev =vlan_dev_real_dev (ndev); + +for_each_port (adap, i) +if (cdev->ports[i] == ndev) +return ndev; +return NULL ; }static void assign_rxopt (struct sock *sk,unsigned int opt)
Greg Kroah-Hartman
maintainerPATCH 40/633 mptcp: initialize mptcp_options_receiveds ahmac
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit fe2d9b1a0e7805384770ec0ddd34c9f1e9fe6fa8 ]
Initialize mptcp_options_received's ahmac to zero, otherwise it will be a random number when receiving ADD_ADDR suboption with echo-flag=1.
--- net/mptcp/options.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/options.c +1 -0
@@ -296,6 +296,7 @@ void mptcp_get_options(const struct sk_b mp_opt->mp_capable =0 ; mp_opt->mp_join =0 ; mp_opt->add_addr =0 ; + mp_opt->ahmac =0 ; mp_opt->rm_addr =0 ; mp_opt->dss =0 ;
Greg Kroah-Hartman
maintainerPATCH 266/633 rtw88: Fix probe error handling race with firmware loading
In reply to Greg Kroah-HartmanFrom: Andreas Färber <[email protected]>
[ Upstream commit ecda9cda3338b594a1b82d62018c247132a39e57 ]
In case of rtw8822be, a probe failure after successful rtw_core_init() has been observed to occasionally lead to an oops from rtw_load_firmware_cb():
[ 3.924268] pci 0001:01:00.0: [10ec:b822] type 00 class 0xff0000 [ 3.930531] pci 0001:01:00.0: reg 0x10: [io 0x0000-0x00ff] [ 3.936360] pci 0001:01:00.0: reg 0x18: [mem 0x00000000-0x0000ffff 64bit] [ 3.944042] pci 0001:01:00.0: supports D1 D2 [ 3.948438] pci 0001:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold [ 3.957312] pci 0001:01:00.0: BAR 2: no space for [mem size 0x00010000 64bit] [ 3.964645] pci 0001:01:00.0: BAR 2: failed to assign [mem size 0x00010000 64bit] [ 3.972332] pci 0001:01:00.0: BAR 0: assigned [io 0x10000-0x100ff] [ 3.986240] rtw_8822be 0001:01:00.0: enabling device (0000 -> 0001) [ 3.992735] rtw_8822be 0001:01:00.0: failed to map pci memory [ 3.998638] rtw_8822be 0001:01:00.0: failed to request pci io region [ 4.005166] rtw_8822be 0001:01:00.0: failed to setup pci resources [ 4.011580] rtw_8822be: probe of 0001:01:00.0 failed with error -12 [ 4.018827] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 4.029121] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 4.050828] Unable to handle kernel paging request at virtual address edafeaac9607952c [ 4.058975] Mem abort info: [ 4.058980] ESR = 0x96000004 [ 4.058990] EC = 0x25: DABT (current EL), IL = 32 bits [ 4.070353] SET = 0, FnV = 0 [ 4.073487] EA = 0, S1PTW = 0 [ 4.073501] dw-apb-uart 98007800.serial: forbid DMA for kernel console [ 4.076723] Data abort info: [ 4.086415] ISV = 0, ISS = 0x00000004 [ 4.087731] Freeing unused kernel memory: 1792K [ 4.090391] CM = 0, WnR = 0 [ 4.098091] [edafeaac9607952c] address between user and kernel address ranges [ 4.105418] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 4.111129] Modules linked in: [ 4.114275] CPU: 1 PID: 31 Comm: kworker/1:1 Not tainted 5.9.0-rc5-next-20200915+ #700 [ 4.122386] Hardware name: Realtek Saola EVB (DT) [ 4.127223] Workqueue: events request_firmware_work_func [ 4.132676] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--) [ 4.138393] pc : rtw_load_firmware_cb+0x54/0xbc [ 4.143040] lr : request_firmware_work_func+0x44/0xb4 [ 4.148217] sp : ffff800010133d70 [ 4.151616] x29: ffff800010133d70 x28: 0000000000000000 [ 4.157069] x27: 0000000000000000 x26: 0000000000000000 [ 4.162520] x25: 0000000000000000 x24: 0000000000000000 [ 4.167971] x23: ffff00007ac21908 x22: ffff00007ebb2100 [ 4.173424] x21: ffff00007ad35880 x20: edafeaac96079504 [ 4.178877] x19: ffff00007ad35870 x18: 0000000000000000 [ 4.184328] x17: 00000000000044d8 x16: 0000000000004310 [ 4.189780] x15: 0000000000000800 x14: 00000000ef006305 [ 4.195231] x13: ffffffff00000000 x12: ffffffffffffffff [ 4.200682] x11: 0000000000000020 x10: 0000000000000003 [ 4.206135] x9 : 0000000000000000 x8 : ffff00007e73f680 [ 4.211585] x7 : 0000000000000000 x6 : ffff80001119b588 [ 4.217036] x5 : ffff00007e649c80 x4 : ffff00007e649c80 [ 4.222487] x3 : ffff80001119b588 x2 : ffff8000108d1718 [ 4.227940] x1 : ffff800011bd5000 x0 : ffff00007ac21600 [ 4.233391] Call trace: [ 4.235906] rtw_load_firmware_cb+0x54/0xbc [ 4.240198] request_firmware_work_func+0x44/0xb4 [ 4.245027] process_one_work+0x178/0x1e4 [ 4.249142] worker_thread+0x1d0/0x268 [ 4.252989] kthread+0xe8/0xf8 [ 4.256127] ret_from_fork+0x10/0x18 [ 4.259800] Code: f94013f5 a8c37bfd d65f03c0 f9000260 (f9401681) [ 4.266049] ---[ end trace f822ebae1a8545c2 ]---
To avoid this, wait on the completion callbacks in rtw_core_deinit() before releasing firmware and continuing teardown.
Note that rtw_wait_firmware_completion() was introduced with c8e5695eae9959fc5774c0f490f2450be8bad3de ("rtw88: load wowlan firmware if wowlan is supported"), so backports to earlier branches may need to inline wait_for_completion(&rtwdev->fw.completion) instead.
--- drivers/net/wireless/realtek/rtw88/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +2 -0
@@ -1479,6 +1479,8 @@ void rtw_core_deinit(struct rtw_dev *rtwdev)struct rtw_rsvd_page *rsvd_pkt, *tmp;unsigned long flags; +rtw_wait_firmware_completion (rtwdev); +if (fw->firmware)release_firmware (fw->firmware);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 100/633 perf/x86: Fix n_pair for cancelled txn
In reply to Greg Kroah-Hartman[ Upstream commit 871a93b0aad65a7f44ee25f2d17932ef6d559850 ]
Kan reported that n_metric gets corrupted for cancelled transactions; a similar issue exists for n_pair for AMD's Large Increment thing.
The problem was confirmed and confirmed fixed by Kim using:
sudo perf stat -e "{cycles,cycles,cycles,cycles}:D" -a sleep 10 &
# should succeed:
sudo perf stat -e "{fp_ret_sse_avx_ops.all}:D" -a workload # should fail:
sudo perf stat -e "{fp_ret_sse_avx_ops.all,fp_ret_sse_avx_ops.all,cycles}:D" -a workload # previously failed, now succeeds with this patch:
sudo perf stat -e "{fp_ret_sse_avx_ops.all}:D" -a workload--- arch/x86/events/core.c | 6 +++++- arch/x86/events/perf_event.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
arch/x86/events/core.c +5 -1
@@ -1087,8 +1087,10 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, cpuc->event_list[n] = event; n++; -if (is_counter_pair (&event->hw)) +if (is_counter_pair (&event->hw)) { cpuc->n_pair++; + cpuc->n_txn_pair++; + } }return n; }
@@ -1953,6 +1955,7 @@ static void x86_pmu_start_txn(struct pmu *pmu, unsigned int txn_flags)perf_pmu_disable (pmu);__this_cpu_write (cpu_hw_events.n_txn,0 ); +__this_cpu_write (cpu_hw_events.n_txn_pair,0 ); }/*
@@ -1978,6 +1981,7 @@ static void x86_pmu_cancel_txn(struct pmu *pmu)*/ __this_cpu_sub (cpu_hw_events.n_added,__this_cpu_read (cpu_hw_events.n_txn));__this_cpu_sub (cpu_hw_events.n_events,__this_cpu_read (cpu_hw_events.n_txn)); +__this_cpu_sub (cpu_hw_events.n_pair,__this_cpu_read (cpu_hw_events.n_txn_pair));perf_pmu_enable (pmu); }
arch/x86/events/perf_event.h +1 -0
@@ -198,6 +198,7 @@ struct cpu_hw_events {they've never been enabled yet */ int n_txn;/* the # last events in the below arrays; added in the current transaction */ +int n_txn_pair;int assign[X86_PMC_IDX_MAX ];/* event to counter assignment */ u64 tags[X86_PMC_IDX_MAX ];
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 11/633 net: mptcp: make DACK4/DACK8 usage consistent among all subflows
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit 37198e93ced70733f0b993dff28b7c33857e254f ]
using packetdrill it's possible to observe the same MPTCP DSN being acked by different subflows with DACK4 and DACK8. This is in contrast with what specified in RFC8684 §3.3.2: if an MPTCP endpoint transmits a 64-bit wide DSN, it MUST be acknowledged with a 64-bit wide DACK. Fix 'use_64bit_ack' variable to make it a property of MPTCP sockets, not TCP subflows.
--- net/mptcp/options.c | 2 +- net/mptcp/protocol.h | 2 +- net/mptcp/subflow.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-)
net/mptcp/options.c +1 -1
@@ -517,7 +517,7 @@ static bool mptcp_established_options_dsreturn ret; } -if (subflow->use_64bit_ack) { +if (READ_ONCE (msk->use_64bit_ack)) { ack_size =TCPOLEN_MPTCP_DSS_ACK64 ; opts->ext_copy.data_ack = msk->ack_seq; opts->ext_copy.ack64 =1 ;
net/mptcp/protocol.h +1 -1
@@ -199,6 +199,7 @@ struct mptcp_sock {u32 token;unsigned long flags;bool can_ack; +bool use_64bit_ack;/* Set when we received a 64-bit DSN */ spinlock_t join_list_lock;struct work_struct work;struct list_head conn_list;
@@ -285,7 +286,6 @@ struct mptcp_subflow_context { data_avail : 1, rx_eof : 1, data_fin_tx_enable : 1, - use_64bit_ack : 1, /* Set when we received a 64-bit DSN */ can_ack : 1; /* only after processing the remote a key */u64 data_fin_tx_seq;u32 remote_nonce;
net/mptcp/subflow.c +1 -2
@@ -682,12 +682,11 @@ static enum mapping_status get_mapping_sif (!mpext->dsn64) { map_seq =expand_seq (subflow->map_seq, subflow->map_data_len, mpext->data_seq); - subflow->use_64bit_ack =0 ;pr_debug ("expanded seq=%llu" , subflow->map_seq); }else { map_seq = mpext->data_seq; - subflow->use_64bit_ack =1 ; } +WRITE_ONCE (mptcp_sk (subflow->conn)->use_64bit_ack, !!mpext->dsn64);if (subflow->map_valid) {/* Allow replacing only with an identical map */
Greg Kroah-Hartman
maintainerPATCH 14/633 net/smc: fix valid DMBE buffer sizes
In reply to Greg Kroah-HartmanFrom: Karsten Graul <[email protected]>
[ Upstream commit ef12ad45880b696eb993d86c481ca891836ab593 ]
The SMCD_DMBE_SIZES should include all valid DMBE buffer sizes, so the correct value is 6 which means 1MB. With 7 the registration of an ISM buffer would always fail because of the invalid size requested. Fix that and set the value to 6.
--- net/smc/smc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_core.c +1 -1
@@ -1595,7 +1595,7 @@ out:return rc; } -#define SMCD_DMBE_SIZES 7/* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */ +#define SMCD_DMBE_SIZES 6/* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */ static struct smc_buf_desc *smcd_new_buf_create (struct smc_link_group *lgr,bool is_dmb,int bufsize)
Greg Kroah-Hartman
maintainerPATCH 265/633 usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit e1c08cf23172ed6fb228d75efc9f4c80a6812116 ]
Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled earlier) when usb_add_gadget_udc() has failed. This ensures that the debugfs entries created by dwc2_debugfs_init() as well as the HCD are cleaned up in the error path.
--- drivers/usb/dwc2/platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +5 -1
@@ -584,12 +584,16 @@ static int dwc2_driver_probe(struct platform_device *dev)if (retval) { hsotg->gadget.udc =NULL ;dwc2_hsotg_remove (hsotg); - goto error_init; + goto error_debugfs; } }#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ return 0 ; +error_debugfs: +dwc2_debugfs_exit (hsotg); +if (hsotg->hcd_enabled) +dwc2_hcd_remove (hsotg); error_init:if (hsotg->params.activate_stm_id_vb_detection)regulator_disable (hsotg->usb33d);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 264/633 usb: dwc3: core: Properly default unspecified speed
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit b574ce3ee45937f4a01edc98c59213bfc7effe50 ]
If the maximum_speed is not specified, default the device speed base on its HW capability. Don't prematurely check HW capability before validating the maximum_speed device property. The device property takes precedence in dwc->maximum_speed.
--- drivers/usb/dwc3/core.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/usb/dwc3/core.c +18 -17
@@ -930,13 +930,6 @@ static int dwc3_core_init(struct dwc3 *dwc)*/ dwc3_writel (dwc->regs,DWC3_GUID ,LINUX_VERSION_CODE ); -/* Handle USB2.0-only core configuration */ -if (DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3) == -DWC3_GHWPARAMS3_SSPHY_IFC_DIS ) { -if (dwc->maximum_speed ==USB_SPEED_SUPER ) - dwc->maximum_speed =USB_SPEED_HIGH ; - } - ret =dwc3_phy_setup (dwc);if (ret) goto err0;
@@ -1382,6 +1375,8 @@ bool dwc3_has_imod(struct dwc3 *dwc)static void dwc3_check_params (struct dwc3 *dwc) {struct device *dev = dwc->dev; +unsigned int hwparam_gen = +DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3);/* Check for proper value of imod_interval */ if (dwc->imod_interval && !dwc3_has_imod (dwc)) {
@@ -1413,17 +1408,23 @@ static void dwc3_check_params(struct dwc3 *dwc) dwc->maximum_speed);/* fall through */ case USB_SPEED_UNKNOWN : -/* default to superspeed */ - dwc->maximum_speed =USB_SPEED_SUPER ; - -/* -* default to superspeed plus if we are capable. -*/ -if ((DWC3_IP_IS (DWC31 ) ||DWC3_IP_IS (DWC32 )) && - (DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3) == -DWC3_GHWPARAMS3_SSPHY_IFC_GEN2 )) +switch (hwparam_gen) { +case DWC3_GHWPARAMS3_SSPHY_IFC_GEN2 : dwc->maximum_speed =USB_SPEED_SUPER_PLUS ; - +break ; +case DWC3_GHWPARAMS3_SSPHY_IFC_GEN1 : +if (DWC3_IP_IS (DWC32 )) + dwc->maximum_speed =USB_SPEED_SUPER_PLUS ; +else + dwc->maximum_speed =USB_SPEED_SUPER ; +break ; +case DWC3_GHWPARAMS3_SSPHY_IFC_DIS : + dwc->maximum_speed =USB_SPEED_HIGH ; +break ; +default : + dwc->maximum_speed =USB_SPEED_SUPER ; +break ; + }break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 245/633 net: wilc1000: clean up resource in error path of init mon interface
In reply to Greg Kroah-HartmanFrom: Huang Guobin <[email protected]>
[ Upstream commit 55bd149978679742374c800e56e8f6bc74378bbe ]
The wilc_wfi_init_mon_int() forgets to clean up resource when register_netdevice() failed. Add the missed call to fix it. And the return value of netdev_priv can't be NULL, so remove the unnecessary error handling.
--- drivers/staging/wilc1000/mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/mon.c +1 -2
@@ -236,11 +236,10 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,if (register_netdevice (wl->monitor_dev)) {netdev_err (real_dev,"register_netdevice failed\n" ); +free_netdev (wl->monitor_dev);return NULL ; } priv =netdev_priv (wl->monitor_dev); -if (!priv) -return NULL ; priv->real_ndev = real_dev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 262/633 ALSA: seq: oss: Avoid mutex lock for a long-time ioctl
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2759caad2600d503c3b0ed800e7e03d2cd7a4c05 ]
Recently we applied a fix to cover the whole OSS sequencer ioctls with the mutex for dealing with the possible races. This works fine in general, but in theory, this may lead to unexpectedly long stall if an ioctl like SNDCTL_SEQ_SYNC is issued and an event with the far future timestamp was queued.
For fixing such a potential stall, this patch changes the mutex lock applied conditionally excluding such an ioctl command. Also, change the mutex_lock() with the interruptible version for user to allow escaping from the big-hammer mutex.
--- sound/core/seq/oss/seq_oss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/core/seq/oss/seq_oss.c +5 -2
@@ -174,9 +174,12 @@ odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (snd_BUG_ON (!dp))return -ENXIO ; -mutex_lock (®ister_mutex); +if (cmd !=SNDCTL_SEQ_SYNC && +mutex_lock_interruptible (®ister_mutex)) +return -ERESTARTSYS ; rc =snd_seq_oss_ioctl (dp, cmd, arg); -mutex_unlock (®ister_mutex); +if (cmd !=SNDCTL_SEQ_SYNC ) +mutex_unlock (®ister_mutex);return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 92/633 arm64: perf: Add missing ISB in armv8pmu_enable_counter()
In reply to Greg Kroah-HartmanFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 490d7b7c0845eacf5593db333fd2ae7715416e16 ]
Writes to the PMXEVTYPER_EL0 register are not self-synchronising. In armv8pmu_enable_event(), the PE can reorder configuring the event type after we have enabled the counter and the interrupt. This can lead to an interrupt being asserted because of the previous event type that we were counting using the same counter, not the one that we've just configured.
The same rationale applies to writes to the PMINTENSET_EL1 register. The PE can reorder enabling the interrupt at any point in the future after we have enabled the event.
Prevent both situations from happening by adding an ISB just before we enable the event counter.
--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +5 -0
@@ -510,6 +510,11 @@ static u32 armv8pmu_event_cnten_mask(struct perf_event *event)static inline void armv8pmu_enable_counter (u32 mask) { +/* +* Make sure event configuration register writes are visible before we +* enable the counter. +* */ +isb ();write_sysreg (mask, pmcntenset_el0); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 258/633 phy: rockchip-dphy-rx0: Include linux/delay.h
In reply to Greg Kroah-HartmanFrom: Tomasz Figa <[email protected]>
[ Upstream commit 488e3f52a82775bf9a4826a9eb59f10336c3f012 ]
Fix an implicit declaration of usleep_range():
drivers/phy/rockchip/phy-rockchip-dphy-rx0.c: In function 'rk_dphy_enable':drivers/phy/rockchip/phy-rockchip-dphy-rx0.c:203:2: error: implicit declaration of function 'usleep_range' [-Werror=implicit-function-declaration]
--- .../staging/media/phy-rockchip-dphy-rx0/phy-rockchip-dphy-rx0.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/phy-rockchip-dphy-rx0/phy-rockchip-dphy-rx0.c +1 -0
@@ -16,6 +16,7 @@*/ #include <linux/clk.h> +#include <linux/delay.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/module.h>
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 256/633 ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6a950755cec1a90ddaaff3e4acb5333617441c32 ]
The "tsid" is a user controlled u8 which comes from debugfs. Values more than 15 are invalid because "active_tsids" is a 16 bit variable. If the value of "tsid" is more than 31 then that leads to a shift wrapping bug.
--- drivers/net/wireless/ath/ath6kl/wmi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath6kl/wmi.c +5 -0
@@ -2645,6 +2645,11 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,return -EINVAL ; } +if (tsid >=16 ) { +ath6kl_err ("invalid tsid: %d\n" , tsid); +return -EINVAL ; + } + skb =ath6kl_wmi_get_new_buf (sizeof (*cmd));if (!skb)return -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 254/633 spi: omap2-mcspi: Improve performance waiting for CHSTAT
In reply to Greg Kroah-HartmanFrom: Aswath Govindraju <[email protected]>
[ Upstream commit 7b1d96813317358312440d0d07abbfbeb0ef8d22 ]
This reverts commit 13d515c796 (spi: omap2-mcspi: Switch to readl_poll_timeout()).
The amount of time spent polling for the MCSPI_CHSTAT bits to be set on AM335x-icev2 platform is less than 1us (about 0.6us) in most cases, with or without using DMA. So, in most cases the function need not sleep. Also, setting the sleep_usecs to zero would not be optimal here because ktime_add_us() used in readl_poll_timeout() is slower compared to the direct addition used after the revert. So, it is sub-optimal to use readl_poll_timeout in this case.
When DMA is not enabled, this revert results in an increase of about 27% in throughput and decrease of about 20% in CPU usage. However, the CPU usage and throughput are almost the same when used with DMA.
Therefore, fix this by reverting the commit which switched to using readl_poll_timeout().
--- drivers/spi/spi-omap2-mcspi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/spi/spi-omap2-mcspi.c +13 -4
@@ -24,7 +24,6 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/gcd.h> -#include <linux/iopoll.h> #include <linux/spi/spi.h> #include <linux/gpio.h>
@@ -349,9 +348,19 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi,static int mcspi_wait_for_reg_bit (void __iomem *reg,unsigned long bit) { -u32 val; - -return readl_poll_timeout (reg, val, val & bit,1 ,MSEC_PER_SEC ); +unsigned long timeout; + + timeout = jiffies +msecs_to_jiffies (1000 ); +while (!(readl_relaxed (reg) & bit)) { +if (time_after (jiffies, timeout)) { +if (!(readl_relaxed (reg) & bit)) +return -ETIMEDOUT ; +else +return 0 ; + } +cpu_relax (); + } +return 0 ; } static int mcspi_wait_for_completion(struct omap2_mcspi *mcspi,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 209/633 iomap: Clear page error before beginning a write
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit e6e7ca92623a43156100306861272e04d46385fc ]
If we find a page in write_begin which is !Uptodate, we need to clear any error on the page before starting to read data into it. This matches how filemap_fault(), do_read_cache_page() and generic_file_buffered_read() handle PageError on !Uptodate pages. When calling iomap_set_range_uptodate() in __iomap_write_begin(), blocks were not being marked as uptodate.
This was found with generic/127 and a specially modified kernel which would fail (some) readahead I/Os. The test read some bytes in a prior page which caused readahead to extend into page 0x34. There was a subsequent write to page 0x34, followed by a read to page 0x34. Because the blocks were still marked as !Uptodate, the read caused all blocks to be re-read, overwriting the write. With this change, and the next one, the bytes which were written are marked as being Uptodate, so even though the page is still marked as !Uptodate, the blocks containing the written data are not re-read from storage.
--- fs/iomap/buffered-io.c | 1 + 1 file changed, 1 insertion(+)
fs/iomap/buffered-io.c +1 -0
@@ -578,6 +578,7 @@ __iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, int flags,if (PageUptodate (page))return 0 ; +ClearPageError (page); do { iomap_adjust_read_range(inode, iop, &block_start,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 217/633 net/mlx5: Fix uninitialized variable warning
In reply to Greg Kroah-HartmanFrom: Moshe Tal <[email protected]>
[ Upstream commit 19f5b63bc9932d51292d72c9dc3ec95e5dfa2289 ]
Add variable initialization to eliminate the warning "variable may be used uninitialized".
--- drivers/net/ethernet/mellanox/mlx5/core/en/health.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/health.c +1 -1
@@ -212,8 +212,8 @@ static int mlx5e_health_rsc_fmsg_binary(struct devlink_fmsg *fmsg, {u32 data_size; +int err =0 ;u32 offset; -int err;for (offset =0 ; offset < value_len; offset += data_size) { data_size = value_len - offset;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 216/633 drm/msm/adreno: fix probe without iommu
In reply to Greg Kroah-HartmanFrom: Luca Weiss <[email protected]>
[ Upstream commit 0a48db562c6264da2ae8013491efd6e8dc780520 ]
The function iommu_domain_alloc returns NULL on platforms without IOMMU such as msm8974. This resulted in PTR_ERR(-ENODEV) being assigned to gpu->aspace so the correct code path wasn't taken.
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +8 -2
@@ -189,10 +189,16 @@ struct msm_gem_address_space * adreno_iommu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev) { - struct iommu_domain *iommu = iommu_domain_alloc(&platform_bus_type); -struct msm_mmu *mmu =msm_iommu_new (&pdev->dev, iommu); + struct iommu_domain *iommu; +struct msm_mmu *mmu;struct msm_gem_address_space *aspace; + iommu =iommu_domain_alloc (&platform_bus_type); +if (!iommu) +return NULL ; + + mmu =msm_iommu_new (&pdev->dev, iommu); + aspace =msm_gem_address_space_create (mmu,"gpu" ,SZ_16M ,0xffffffff -SZ_16M );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 214/633 pinctrl: mcp23s08: Fix mcp23x17 precious range
In reply to Greg Kroah-HartmanFrom: Thomas Preston <[email protected]>
[ Upstream commit b9b7fb29433b906635231d0a111224efa009198c ]
On page 23 of the datasheet [0] it says "The register remains unchanged until the interrupt is cleared via a read of INTCAP or GPIO." Include INTCAPA and INTCAPB registers in precious range, so that they aren't accidentally cleared when we read via debugfs.
[0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf
--- drivers/pinctrl/pinctrl-mcp23s08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-mcp23s08.c +1 -1
@@ -109,7 +109,7 @@ static const struct regmap_access_table mcp23x17_volatile_table = { };static const struct regmap_range mcp23x17_precious_range = { - .range_min =MCP_GPIO <<1 , + .range_min =MCP_INTCAP <<1 , .range_max =MCP_GPIO <<1 , };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 213/633 pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser
In reply to Greg Kroah-HartmanFrom: Thomas Preston <[email protected]>
[ Upstream commit b445f6237744df5e8d4f56f8733b2108c611220a ]
The mcp23x17_regmap is initialised with structs named "mcp23x16". However, the mcp23s08 driver doesn't support the MCP23016 device yet, so this appears to be a typo.
--- drivers/pinctrl/pinctrl-mcp23s08.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/pinctrl/pinctrl-mcp23s08.c +11 -11
@@ -87,7 +87,7 @@ const struct regmap_config mcp23x08_regmap = { };EXPORT_SYMBOL_GPL (mcp23x08_regmap); -static const struct reg_default mcp23x16_defaults[] = { +static const struct reg_default mcp23x17_defaults[] = { {.reg =MCP_IODIR <<1 , .def =0xffff }, {.reg =MCP_IPOL <<1 , .def =0x0000 }, {.reg =MCP_GPINTEN <<1 , .def =0x0000 },
@@ -98,23 +98,23 @@ static const struct reg_default mcp23x16_defaults[] = { {.reg = MCP_OLAT << 1, .def = 0x0000}, }; -static const struct regmap_range mcp23x16_volatile_range = { +static const struct regmap_range mcp23x17_volatile_range = { .range_min =MCP_INTF <<1 , .range_max =MCP_GPIO <<1 , }; -static const struct regmap_access_table mcp23x16_volatile_table = { - .yes_ranges = &mcp23x16_volatile_range, +static const struct regmap_access_table mcp23x17_volatile_table = { + .yes_ranges = &mcp23x17_volatile_range, .n_yes_ranges =1 , }; -static const struct regmap_range mcp23x16_precious_range = { +static const struct regmap_range mcp23x17_precious_range = { .range_min =MCP_GPIO <<1 , .range_max =MCP_GPIO <<1 , }; -static const struct regmap_access_table mcp23x16_precious_table = { - .yes_ranges = &mcp23x16_precious_range, +static const struct regmap_access_table mcp23x17_precious_table = { + .yes_ranges = &mcp23x17_precious_range, .n_yes_ranges =1 , };
@@ -124,10 +124,10 @@ const struct regmap_config mcp23x17_regmap = { .reg_stride = 2, .max_register = MCP_OLAT << 1, - .volatile_table = &mcp23x16_volatile_table, - .precious_table = &mcp23x16_precious_table, - .reg_defaults = mcp23x16_defaults, - .num_reg_defaults = ARRAY_SIZE(mcp23x16_defaults), + .volatile_table = &mcp23x17_volatile_table, + .precious_table = &mcp23x17_precious_table, + .reg_defaults = mcp23x17_defaults, + .num_reg_defaults = ARRAY_SIZE(mcp23x17_defaults), .cache_type = REGCACHE_FLAT, .val_format_endian = REGMAP_ENDIAN_LITTLE, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 242/633 net: dsa: rtl8366: Check validity of passed VLANs
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 6641a2c42b0a307b7638d10e5d4b90debc61389d ]
The rtl8366_set_vlan() and rtl8366_set_pvid() get invalid VLANs tossed at it, especially VLAN0, something the hardware and driver cannot handle. Check validity and bail out like we do in the other callbacks.
--- drivers/net/dsa/rtl8366.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/rtl8366.c +6 -0
@@ -43,6 +43,9 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member,int ret;int i; +if (!smi->ops->is_vlan_valid (smi, vid)) +return -EINVAL ; +dev_dbg (smi->dev,"setting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n" , vid, member, untag);
@@ -118,6 +121,9 @@ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port,int ret;int i; +if (!smi->ops->is_vlan_valid (smi, vid)) +return -EINVAL ; +/* Try to find an existing MC entry for this VID */ for (i =0 ; i < smi->num_vlan_mc; i++) { ret = smi->ops->get_vlan_mc (smi, i, &vlanmc);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 239/633 selftests/bpf: Fix endianness issue in sk_assign
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit b6ed6cf4a3acdeab9aed8e0a524850761ec9b152 ]
server_map's value size is 8, but the test tries to put an int there. This sort of works on x86 (unless followed by non-0), but hard fails on s390.
Fix by using __s64 instead of int.
--- tools/testing/selftests/bpf/prog_tests/sk_assign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/sk_assign.c +1 -1
@@ -265,7 +265,7 @@ void test_sk_assign(void)TEST ("ipv6 udp port redir" ,AF_INET6 ,SOCK_DGRAM , false), TEST("ipv6 udp addr redir", AF_INET6, SOCK_DGRAM, true), }; -int server =-1 ; +__s64 server =-1 ;int server_map;int self_net;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 212/633 Bluetooth: Re-order clearing suspend tasks
In reply to Greg Kroah-HartmanFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit 3eec158d5eca7dd455118d9e00568aad2371219f ]
Unregister_pm_notifier is a blocking call so suspend tasks should be cleared beforehand. Otherwise, the notifier will wait for completion before returning (and we encounter a 2s timeout on resume).
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -3618,8 +3618,8 @@ void hci_unregister_dev(struct hci_dev *hdev)cancel_work_sync (&hdev->power_on); -unregister_pm_notifier (&hdev->suspend_notifier);hci_suspend_clear_tasks (hdev); +unregister_pm_notifier (&hdev->suspend_notifier);cancel_work_sync (&hdev->suspend_prepare);hci_dev_do_close (hdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 237/633 nvmem: core: fix missing of_node_put() in of_nvmem_device_get()
In reply to Greg Kroah-HartmanFrom: Vadym Kochan <[email protected]>
[ Upstream commit b1c194dcdb1425fa59eec61ab927cfff33096149 ]
of_parse_phandle() returns device_node with incremented ref count which needs to be decremented by of_node_put() when device_node is not used.
--- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvmem/core.c +4 -1
@@ -823,6 +823,7 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id) {struct device_node *nvmem_np; +struct nvmem_device *nvmem;int index =0 ;if (id)
@@ -832,7 +833,9 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id)if (!nvmem_np)return ERR_PTR (-ENOENT ); - return __nvmem_device_get(nvmem_np, device_match_of_node); + nvmem =__nvmem_device_get (nvmem_np, device_match_of_node); +of_node_put (nvmem_np); + return nvmem; }EXPORT_SYMBOL_GPL (of_nvmem_device_get);#endif
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 67/633 smb3: fix stat when special device file and mounted with modefromsid
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 3c3317daef0afa0cd541fc9c1bfd6ce8bbf1129a upstream.
When mounting with modefromsid mount option, it was possible to get the error on stat of a fifo or char or block device:
"cannot stat <filename>: Operation not supported"
Special devices can be stored as reparse points by some servers (e.g. Windows NFS server and when using the SMB3.1.1 POSIX Extensions) but when the modefromsid mount option is used the client attempts to get the ACL for the file which requires opening with OPEN_REPARSE_POINT create option.
--- fs/cifs/smb2ops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/cifs/smb2ops.c +6 -1
@@ -3072,7 +3072,12 @@ get_smb2_acl_by_path(struct cifs_sb_info oparms.tcon = tcon; oparms.desired_access =READ_CONTROL ; oparms.disposition =FILE_OPEN ; - oparms.create_options =cifs_create_options (cifs_sb,0 ); +/* +* When querying an ACL, even if the file is a symlink we want to open +* the source not the target, and so the protocol requires that the +* client specify this flag when opening a reparse point +*/ + oparms.create_options =cifs_create_options (cifs_sb,0 ) |OPEN_REPARSE_POINT ; oparms.fid = &fid; oparms.reconnect = false;
Greg Kroah-Hartman
maintainerPATCH 63/633 cifs: Return the error from crypt_message when enc/dec key not found.
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
commit 0bd294b55a5de442370c29fa53bab17aef3ff318 upstream.
In crypt_message, when smb2_get_enc_key returns error, we need to return the error back to the caller. If not, we end up processing the message further, causing a kernel oops due to unwarranted access of memory.
Call Trace: smb3_receive_transform+0x120/0x870 [cifs] cifs_demultiplex_thread+0xb53/0xc20 [cifs] ? cifs_handle_standard+0x190/0x190 [cifs] kthread+0x116/0x130 ? kthread_park+0x80/0x80 ret_from_fork+0x1f/0x30
--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
@@ -3924,7 +3924,7 @@ crypt_message(struct TCP_Server_Info *seif (rc) {cifs_server_dbg (VFS ,"%s: Could not get %scryption key\n" , __func__, enc ?"en" :"de" ); -return 0 ; +return rc; } rc =smb3_crypto_aead_allocate (server);
Greg Kroah-Hartman
maintainerPATCH 230/633 coresight: cti: disclaim device only when its claimed
In reply to Greg Kroah-HartmanFrom: Tingwei Zhang <[email protected]>
[ Upstream commit 0dee28268ddbe53a981d4d87faf5dc0f1700e698 ]
Coresight_claim_device() is called in cti_starting_cpu() only when CTI is enabled while coresight_disclaim_device() is called uncontionally in cti_dying_cpu(). This triggered below WARNING. Only call disclaim device when CTI device is enabled to fix it.
[ 75.989643] WARNING: CPU: 1 PID: 14 at kernel/drivers/hwtracing/coresight/coresight.c:209 coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989697] CPU: 1 PID: 14 Comm: migration/1 Not tainted 5.9.0-rc1-gff1304be0a05-dirty #21 [ 75.989709] Hardware name: Thundercomm Dragonboard 845c (DT) [ 75.989737] pstate: 80c00085 (Nzcv daIf +PAN +UAO BTYPE=--) [ 75.989758] pc : coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989775] lr : coresight_disclaim_device+0x24/0x38 [ 75.989783] sp : ffff800011cd3c90 . [ 75.990018] Call trace: [ 75.990041] coresight_disclaim_device_unlocked+0x10/0x24 [ 75.990066] cti_dying_cpu+0x34/0x4c [ 75.990101] cpuhp_invoke_callback+0x84/0x1e0 [ 75.990121] take_cpu_down+0x90/0xe0 [ 75.990154] multi_cpu_stop+0x134/0x160 [ 75.990171] cpu_stopper_thread+0xb0/0x13c [ 75.990196] smpboot_thread_fn+0x1c4/0x270 [ 75.990222] kthread+0x128/0x154 [ 75.990251] ret_from_fork+0x10/0x18
--- drivers/hwtracing/coresight/coresight-cti.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-cti.c +2 -1
@@ -742,7 +742,8 @@ static int cti_dying_cpu(unsigned int cpu)spin_lock (&drvdata->spinlock); drvdata->config.hw_powered = false; -coresight_disclaim_device (drvdata->base); +if (drvdata->config.hw_enabled) +coresight_disclaim_device (drvdata->base);spin_unlock (&drvdata->spinlock);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 225/633 ima: Fix NULL pointer dereference in ima_file_hash
In reply to Greg Kroah-HartmanFrom: KP Singh <[email protected]>
[ Upstream commit aa662fc04f5b290b3979332588bf8d812b189962 ]
ima_file_hash can be called when there is no iint->ima_hash available even though the inode exists in the integrity cache. It is fairly common for a file to not have a hash. (e.g. an mknodat, prior to the file being closed).
Another example where this can happen (suggested by Jann Horn):
Process A does:
while(1) {
unlink("/tmp/imafoo");
fd = open("/tmp/imafoo", O_RDWR|O_CREAT|O_TRUNC, 0700);
if (fd == -1) {
perror("open");
continue;
}
write(fd, "A", 1);
close(fd);
}and Process B does:
while (1) {
int fd = open("/tmp/imafoo", O_RDONLY);
if (fd == -1)
continue;
char *mapping = mmap(NULL, 0x1000, PROT_READ|PROT_EXEC,
MAP_PRIVATE, fd, 0);
if (mapping != MAP_FAILED)
munmap(mapping, 0x1000);
close(fd);}
Due to the race to get the iint->mutex between ima_file_hash and process_measurement iint->ima_hash could still be NULL.
--- security/integrity/ima/ima_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
security/integrity/ima/ima_main.c +10 -0
@@ -531,6 +531,16 @@ int ima_file_hash(struct file *file, char *buf, size_t buf_size)return -EOPNOTSUPP ;mutex_lock (&iint->mutex); + +/* +* ima_file_hash can be called when ima_collect_measurement has still +* not been called, we might not always have a hash. +*/ +if (!iint->ima_hash) { +mutex_unlock (&iint->mutex); +return -EOPNOTSUPP ; + } +if (buf) {size_t copied_size;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 229/633 coresight: fix offset by one error in counting ports
In reply to Greg Kroah-HartmanFrom: Mian Yousaf Kaukab <[email protected]>
[ Upstream commit 9554c3551ed35d79b029e5e69383ae33117d9765 ]
Since port-numbers start from 0, add 1 to port-number to get the port count.
Fix following crash when Coresight is enabled on ACPI based systems:
[ 61.061736] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 ... [ 61.135494] pc : acpi_coresight_parse_graph+0x1c4/0x37c [ 61.140705] lr : acpi_coresight_parse_graph+0x160/0x37c [ 61.145915] sp : ffff800012f4ba40 [ 61.145917] x29: ffff800012f4ba40 x28: ffff00becce62f98 [ 61.159896] x27: 0000000000000005 x26: ffff00becd8a7c88 [ 61.165195] x25: ffff00becd8a7d88 x24: ffff00becce62f80 [ 61.170492] x23: ffff800011ef99c0 x22: ffff009efb8bc010 [ 61.175790] x21: 0000000000000018 x20: 0000000000000005 [ 61.181087] x19: ffff00becce62e80 x18: 0000000000000020 [ 61.186385] x17: 0000000000000001 x16: 00000000000002a8 [ 61.191682] x15: ffff000838648550 x14: ffffffffffffffff [ 61.196980] x13: 0000000000000000 x12: ffff00becce62d87 [ 61.202277] x11: 00000000ffffff76 x10: 000000000000002e [ 61.207575] x9 : ffff8000107e1a68 x8 : ffff00becce63000 [ 61.212873] x7 : 0000000000000018 x6 : 000000000000003f [ 61.218170] x5 : 0000000000000000 x4 : 0000000000000000 [ 61.223467] x3 : 0000000000000000 x2 : 0000000000000000 [ 61.228764] x1 : ffff00becce62f80 x0 : 0000000000000000 [ 61.234062] Call trace: [ 61.236497] acpi_coresight_parse_graph+0x1c4/0x37c [ 61.241361] coresight_get_platform_data+0xdc/0x130 [ 61.246225] tmc_probe+0x138/0x2dc [ 61.246227] amba_probe+0xdc/0x220 [ 61.255779] really_probe+0xe8/0x49c [ 61.255781] driver_probe_device+0xec/0x140 [ 61.255782] device_driver_attach+0xc8/0xd0 [ 61.255785] __driver_attach+0xac/0x180 [ 61.265857] bus_for_each_dev+0x78/0xcc [ 61.265859] driver_attach+0x2c/0x40 [ 61.265861] bus_add_driver+0x150/0x244 [ 61.265863] driver_register+0x80/0x13c [ 61.273591] amba_driver_register+0x60/0x70 [ 61.273594] tmc_driver_init+0x20/0x2c [ 61.281582] do_one_initcall+0x50/0x230 [ 61.281585] do_initcalls+0x104/0x144 [ 61.291831] kernel_init_freeable+0x168/0x1dc [ 61.291834] kernel_init+0x1c/0x120 [ 61.299215] ret_from_fork+0x10/0x18 [ 61.299219] Code: b9400022 f9400660 9b277c42 8b020000 (f9400404) [ 61.307381] ---[ end trace 63c6c3d7ec6a9b7c ]--- [ 61.315225] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
--- drivers/hwtracing/coresight/coresight-platform.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-platform.c +5 -5
@@ -712,11 +712,11 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,return dir;if (dir ==ACPI_CORESIGHT_LINK_MASTER ) { -if (ptr->outport > pdata->nr_outport) - pdata->nr_outport = ptr->outport; +if (ptr->outport >= pdata->nr_outport) + pdata->nr_outport = ptr->outport +1 ; ptr++; }else { -WARN_ON (pdata->nr_inport == ptr->child_port); +WARN_ON (pdata->nr_inport == ptr->child_port +1 );/* * We do not track input port connections for a device. * However we need the highest port number described,
@@ -724,8 +724,8 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,* record for an output connection. Hence, do not move * the ptr for input connections */ -if (ptr->child_port > pdata->nr_inport) - pdata->nr_inport = ptr->child_port; +if (ptr->child_port >= pdata->nr_inport) + pdata->nr_inport = ptr->child_port +1 ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 234/633 coresight: cti: Write regsiters directly in cti_enable_hw()
In reply to Greg Kroah-HartmanFrom: Tingwei Zhang <[email protected]>
[ Upstream commit 984f37efa3857dcefa649fbdf64abb94591935c3 ]
Deadlock as below is triggered by one CPU holds drvdata->spinlock and calls cti_enable_hw(). Smp_call_function_single() is called in cti_enable_hw() and tries to let another CPU write CTI registers. That CPU is trying to get drvdata->spinlock in cti_cpu_pm_notify() and doesn't response to IPI from smp_call_function_single().
[ 988.335937] CPU: 6 PID: 10258 Comm: sh Tainted: G W L 5.8.0-rc6-mainline-16783-gc38daa79b26b-dirty #1 [ 988.346364] Hardware name: Thundercomm Dragonboard 845c (DT) [ 988.352073] pstate: 20400005 (nzCv daif +PAN -UAO BTYPE=--) [ 988.357689] pc : smp_call_function_single+0x158/0x1b8 [ 988.362782] lr : smp_call_function_single+0x124/0x1b8 ... [ 988.451638] Call trace: [ 988.454119] smp_call_function_single+0x158/0x1b8 [ 988.458866] cti_enable+0xb4/0xf8 [coresight_cti] [ 988.463618] coresight_control_assoc_ectdev+0x6c/0x128 [coresight] [ 988.469855] coresight_enable+0x1f0/0x364 [coresight] [ 988.474957] enable_source_store+0x5c/0x9c [coresight] [ 988.480140] dev_attr_store+0x14/0x28 [ 988.483839] sysfs_kf_write+0x38/0x4c [ 988.487532] kernfs_fop_write+0x1c0/0x2b0 [ 988.491585] vfs_write+0xfc/0x300 [ 988.494931] ksys_write+0x78/0xe0 [ 988.498283] __arm64_sys_write+0x18/0x20 [ 988.502240] el0_svc_common+0x98/0x160 [ 988.506024] do_el0_svc+0x78/0x80 [ 988.509377] el0_sync_handler+0xd4/0x270 [ 988.513337] el0_sync+0x164/0x180
This change write CTI registers directly in cti_enable_hw(). Config->hw_powered has been checked to be true with spinlock holded. CTI is powered and can be programmed until spinlock is released.
--- drivers/hwtracing/coresight/coresight-cti.c | 24 +++++---------------- 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/hwtracing/coresight/coresight-cti.c +5 -19
@@ -86,22 +86,16 @@ void cti_write_all_hw_regs(struct cti_drvdata *drvdata)CS_LOCK (drvdata->base); } -static void cti_enable_hw_smp_call (void *info) -{ -struct cti_drvdata *drvdata = info; - -cti_write_all_hw_regs (drvdata); -} -/* write regs to hardware and enable */ static int cti_enable_hw (struct cti_drvdata *drvdata) {struct cti_config *config = &drvdata->config;struct device *dev = &drvdata->csdev->dev; +unsigned long flags;int rc =0 ;pm_runtime_get_sync (dev->parent); -spin_lock (&drvdata->spinlock); +spin_lock_irqsave (&drvdata->spinlock, flags);/* no need to do anything if enabled or unpowered*/ if (config->hw_enabled || !config->hw_powered)
@@ -112,19 +106,11 @@ static int cti_enable_hw(struct cti_drvdata *drvdata)if (rc) goto cti_err_not_enabled; -if (drvdata->ctidev.cpu >=0 ) { - rc =smp_call_function_single (drvdata->ctidev.cpu, - cti_enable_hw_smp_call, - drvdata,1 ); -if (rc) - goto cti_err_not_enabled; - }else { -cti_write_all_hw_regs (drvdata); - } +cti_write_all_hw_regs (drvdata); config->hw_enabled = true;atomic_inc (&drvdata->config.enable_req_count); -spin_unlock (&drvdata->spinlock); +spin_unlock_irqrestore (&drvdata->spinlock, flags);return rc; cti_state_unchanged:
@@ -132,7 +118,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata)/* cannot enable due to error */ cti_err_not_enabled: -spin_unlock (&drvdata->spinlock); +spin_unlock_irqrestore (&drvdata->spinlock, flags);pm_runtime_put (dev->parent);return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 184/633 staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent()
In reply to Greg Kroah-HartmanFrom: Alex Dewar <[email protected]>
[ Upstream commit cc34073c6248e9cec801bf690d1455f264d12357 ]
In nbu2ss_eq_queue() memory is allocated with dma_alloc_coherent(), though, strangely, NULL is passed as the struct device* argument. Pass the UDC's device instead. Fix up the corresponding call to dma_free_coherent() in the same way.
Build-tested on x86 only.
--- drivers/staging/emxx_udc/emxx_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +2 -2
@@ -2593,7 +2593,7 @@ static int nbu2ss_ep_queue(struct usb_ep *_ep,if (req->unaligned) {if (!ep->virt_buf) - ep->virt_buf =dma_alloc_coherent (NULL ,PAGE_SIZE , + ep->virt_buf =dma_alloc_coherent (udc->dev,PAGE_SIZE , &ep->phys_buf,GFP_ATOMIC |GFP_DMA );if (ep->epnum >0 ) {
@@ -3148,7 +3148,7 @@ static int nbu2ss_drv_remove(struct platform_device *pdev)for (i =0 ; i <NUM_ENDPOINTS ; i++) { ep = &udc->ep[i];if (ep->virt_buf) -dma_free_coherent (NULL ,PAGE_SIZE , (void *)ep->virt_buf, +dma_free_coherent (udc->dev,PAGE_SIZE , (void *)ep->virt_buf, ep->phys_buf); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 223/633 cpufreq: armada-37xx: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit c942d1542f1bc5001216fabce9cb8ffbe515777e ]
CONFIG_ARM_ARMADA_37XX_CPUFREQ is tristate option and therefore this cpufreq driver can be compiled as a module. This patch adds missing MODULE_DEVICE_TABLE which generates correct modalias for automatic loading of this cpufreq driver when is compiled as an external module.
--- drivers/cpufreq/armada-37xx-cpufreq.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/cpufreq/armada-37xx-cpufreq.c +6 -0
@@ -484,6 +484,12 @@ static int __init armada37xx_cpufreq_driver_init(void)/* late_initcall, to guarantee the driver is loaded after A37xx clock driver */ late_initcall (armada37xx_cpufreq_driver_init); +static const struct of_device_id __maybe_unused armada37xx_cpufreq_of_match[] = { + { .compatible ="marvell,armada-3700-nb-pm" }, + { }, +}; +MODULE_DEVICE_TABLE (of, armada37xx_cpufreq_of_match); +MODULE_AUTHOR ("Gregory CLEMENT <[email protected]>" );MODULE_DESCRIPTION ("Armada 37xx cpufreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 203/633 video: fbdev: radeon: Fix memleak in radeonfb_pci_register
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit fe6c6a4af2be8c15bac77f7ea160f947c04840d1 ]
When radeon_kick_out_firmware_fb() fails, info should be freed just like the subsequent error paths.
--- drivers/video/fbdev/aty/radeon_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/radeon_base.c +1 -1
@@ -2311,7 +2311,7 @@ static int radeonfb_pci_register(struct pci_dev *pdev, ret =radeon_kick_out_firmware_fb (pdev);if (ret) -return ret; + goto err_release_fb;/* request the mem regions */ ret =pci_request_region (pdev,0 ,"radeonfb framebuffer" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 231/633 coresight: cti: remove pm_runtime_get_sync() from CPU hotplug
In reply to Greg Kroah-HartmanFrom: Tingwei Zhang <[email protected]>
[ Upstream commit 6e8836c6df5327bdb24211424f1ad1411d1ed64a ]
Below BUG is triggered by call pm_runtime_get_sync() in cti_cpuhp_enable_hw(). It's in CPU hotplug callback with interrupt disabled. Pm_runtime_get_sync() calls clock driver to enable clock which could sleep. Remove pm_runtime_get_sync() in cti_cpuhp_enable_hw() since pm_runtime_get_sync() is called in cti_enabld and pm_runtime_put() is called in cti_disabled. No need to increase pm count when CPU gets online since it's not decreased when CPU is offline.
[ 105.800279] BUG: scheduling while atomic: swapper/1/0/0x00000002 [ 105.800290] Modules linked in: [ 105.800327] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 5.9.0-rc1-gff1304be0a05-dirty #21 [ 105.800337] Hardware name: Thundercomm Dragonboard 845c (DT) [ 105.800353] Call trace: [ 105.800414] dump_backtrace+0x0/0x1d4 [ 105.800439] show_stack+0x14/0x1c [ 105.800462] dump_stack+0xc0/0x100 [ 105.800490] __schedule_bug+0x58/0x74 [ 105.800523] __schedule+0x590/0x65c [ 105.800538] schedule+0x78/0x10c [ 105.800553] schedule_timeout+0x188/0x250 [ 105.800585] qmp_send.constprop.10+0x12c/0x1b0 [ 105.800599] qmp_qdss_clk_prepare+0x18/0x20 [ 105.800622] clk_core_prepare+0x48/0xd4 [ 105.800639] clk_prepare+0x20/0x34 [ 105.800663] amba_pm_runtime_resume+0x54/0x90 [ 105.800695] __rpm_callback+0xdc/0x138 [ 105.800709] rpm_callback+0x24/0x78 [ 105.800724] rpm_resume+0x328/0x47c [ 105.800739] __pm_runtime_resume+0x50/0x74 [ 105.800768] cti_starting_cpu+0x40/0xa4 [ 105.800795] cpuhp_invoke_callback+0x84/0x1e0 [ 105.800814] notify_cpu_starting+0x9c/0xb8 [ 105.800834] secondary_start_kernel+0xd8/0x164 [ 105.800933] CPU1: Booted secondary processor 0x0000000100 [0x517f803c]
--- drivers/hwtracing/coresight/coresight-cti.c | 3 --- 1 file changed, 3 deletions(-)
drivers/hwtracing/coresight/coresight-cti.c +0 -3
@@ -141,9 +141,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata)static void cti_cpuhp_enable_hw (struct cti_drvdata *drvdata) {struct cti_config *config = &drvdata->config; -struct device *dev = &drvdata->csdev->dev; -pm_runtime_get_sync (dev->parent);spin_lock (&drvdata->spinlock); config->hw_powered = true;
@@ -163,7 +161,6 @@ static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata)/* did not re-enable due to no claim / no request */ cti_hp_not_enabled:spin_unlock (&drvdata->spinlock); -pm_runtime_put (dev->parent); }/* disable hardware */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 150/633 hwmon: (bt1-pvt) Cache current update timeout
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 0015503e5f6357f286bef34d039e43359fa4efd4 ]
Instead of converting the update timeout data to the milliseconds each time on the read procedure let's preserve the currently set timeout in the dedicated driver private data cache. The cached value will be then used in the timeout read method and in the alarm-less data conversion to prevent the caller task hanging up in case if the PVT sensor is suddenly powered down.
--- drivers/hwmon/bt1-pvt.c | 85 ++++++++++++++++++++++------------------- drivers/hwmon/bt1-pvt.h | 3 ++ 2 files changed, 49 insertions(+), 39 deletions(-)
drivers/hwmon/bt1-pvt.c +46 -39
@@ -655,44 +655,16 @@ static int pvt_write_trim(struct pvt_hwmon *pvt, long val)static int pvt_read_timeout (struct pvt_hwmon *pvt,long *val) { -unsigned long rate; -ktime_t kt; -u32 data; - - rate =clk_get_rate (pvt->clks[PVT_CLOCK_REF ].clk); -if (!rate) -return -ENODEV ; - -/* -* Don't bother with mutex here, since we just read data from MMIO. -* We also have to scale the ticks timeout up to compensate the -* ms-ns-data translations. -*/ - data =readl (pvt->regs +PVT_TTIMEOUT ) +1 ; +int ret; -/* -* Calculate ref-clock based delay (Ttotal) between two consecutive -* data samples of the same sensor. So we first must calculate the -* delay introduced by the internal ref-clock timer (Tref * Fclk). -* Then add the constant timeout cuased by each conversion latency -* (Tmin). The basic formulae for each conversion is following: -* Ttotal = Tref * Fclk + Tmin -* Note if alarms are enabled the sensors are polled one after -* another, so in order to have the delay being applicable for each -* sensor the requested value must be equally redistirbuted. -*/ -#if defined(CONFIG_SENSORS_BT1_PVT_ALARMS ) - kt =ktime_set (PVT_SENSORS_NUM * (u64 )data,0 ); - kt =ktime_divns (kt, rate); - kt =ktime_add_ns (kt,PVT_SENSORS_NUM *PVT_TOUT_MIN ); -#else - kt =ktime_set (data,0 ); - kt =ktime_divns (kt, rate); - kt =ktime_add_ns (kt,PVT_TOUT_MIN ); -#endif + ret =mutex_lock_interruptible (&pvt->iface_mtx); +if (ret) +return ret;/* Return the result in msec as hwmon sysfs interface requires. */ - *val =ktime_to_ms (kt); + *val =ktime_to_ms (pvt->timeout); + +mutex_unlock (&pvt->iface_mtx);return 0 ; }
@@ -700,7 +672,7 @@ static int pvt_read_timeout(struct pvt_hwmon *pvt, long *val)static int pvt_write_timeout (struct pvt_hwmon *pvt,long val) {unsigned long rate; -ktime_t kt; +ktime_t kt, cache;u32 data;int ret;
@@ -713,7 +685,7 @@ static int pvt_write_timeout(struct pvt_hwmon *pvt, long val)* between all available sensors to have the requested delay * applicable to each individual sensor. */ - kt =ms_to_ktime (val); + cache = kt =ms_to_ktime (val);#if defined(CONFIG_SENSORS_BT1_PVT_ALARMS ) kt =ktime_divns (kt,PVT_SENSORS_NUM );#endif
@@ -742,6 +714,7 @@ static int pvt_write_timeout(struct pvt_hwmon *pvt, long val)return ret;pvt_set_tout (pvt, data); + pvt->timeout = cache;mutex_unlock (&pvt->iface_mtx);
@@ -1018,10 +991,17 @@ static int pvt_check_pwr(struct pvt_hwmon *pvt)return ret; } -static void pvt_init_iface (struct pvt_hwmon *pvt) +static int pvt_init_iface (struct pvt_hwmon *pvt) { +unsigned long rate;u32 trim, temp; + rate =clk_get_rate (pvt->clks[PVT_CLOCK_REF ].clk); +if (!rate) { +dev_err (pvt->dev,"Invalid reference clock rate\n" ); +return -ENODEV ; + } +/* * Make sure all interrupts and controller are disabled so not to * accidentally have ISR executed before the driver data is fully
@@ -1036,12 +1016,37 @@ static void pvt_init_iface(struct pvt_hwmon *pvt)pvt_set_mode (pvt, pvt_info[pvt->sensor].mode);pvt_set_tout (pvt,PVT_TOUT_DEF ); +/* +* Preserve the current ref-clock based delay (Ttotal) between the +* sensors data samples in the driver data so not to recalculate it +* each time on the data requests and timeout reads. It consists of the +* delay introduced by the internal ref-clock timer (N / Fclk) and the +* constant timeout caused by each conversion latency (Tmin): +* Ttotal = N / Fclk + Tmin +* If alarms are enabled the sensors are polled one after another and +* in order to get the next measurement of a particular sensor the +* caller will have to wait for at most until all the others are +* polled. In that case the formulae will look a bit different: +* Ttotal = 5 * (N / Fclk + Tmin) +*/ +#if defined(CONFIG_SENSORS_BT1_PVT_ALARMS ) + pvt->timeout =ktime_set (PVT_SENSORS_NUM *PVT_TOUT_DEF ,0 ); + pvt->timeout =ktime_divns (pvt->timeout, rate); + pvt->timeout =ktime_add_ns (pvt->timeout,PVT_SENSORS_NUM *PVT_TOUT_MIN ); +#else + pvt->timeout =ktime_set (PVT_TOUT_DEF ,0 ); + pvt->timeout =ktime_divns (pvt->timeout, rate); + pvt->timeout =ktime_add_ns (pvt->timeout,PVT_TOUT_MIN ); +#endif + trim =PVT_TRIM_DEF ;if (!of_property_read_u32 (pvt->dev->of_node,"baikal,pvt-temp-offset-millicelsius" , &temp)) trim =pvt_calc_trim (temp);pvt_set_trim (pvt, trim); + +return 0 ; }static int pvt_request_irq (struct pvt_hwmon *pvt)
@@ -1149,7 +1154,9 @@ static int pvt_probe(struct platform_device *pdev)if (ret)return ret; -pvt_init_iface (pvt); + ret =pvt_init_iface (pvt); +if (ret) +return ret; ret =pvt_request_irq (pvt);if (ret)
drivers/hwmon/bt1-pvt.h +3 -0
@@ -10,6 +10,7 @@#include <linux/completion.h> #include <linux/hwmon.h> #include <linux/kernel.h> +#include <linux/ktime.h> #include <linux/mutex.h> #include <linux/seqlock.h>
@@ -201,6 +202,7 @@ struct pvt_cache {* if alarms are disabled). * @sensor: current PVT sensor the data conversion is being performed for. * @cache: data cache descriptor. +* @timeout: conversion timeout cache. */ struct pvt_hwmon {struct device *dev;
@@ -214,6 +216,7 @@ struct pvt_hwmon {struct mutex iface_mtx;enum pvt_sensor_type sensor;struct pvt_cache cache[PVT_SENSORS_NUM ]; +ktime_t timeout; };/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 196/633 pty: do tty_flip_buffer_push without port->lock in pty_write
In reply to Greg Kroah-HartmanFrom: Artem Savkov <[email protected]>
[ Upstream commit 71a174b39f10b4b93223d374722aa894b5d8a82e ]
b6da31b2c07c "tty: Fix data race in tty_insert_flip_string_fixed_flag" puts tty_flip_buffer_push under port->lock introducing the following possible circular locking dependency:
[30129.876566] ======================================================
[30129.876566] WARNING: possible circular locking dependency detected
[30129.876567] 5.9.0-rc2+ #3 Tainted: G S W
[30129.876568] ------------------------------------------------------
[30129.876568] sysrq.sh/1222 is trying to acquire lock:
[30129.876569] ffffffff92c39480 (console_owner){....}-{0:0}, at: console_unlock+0x3fe/0xa90[30129.876572] but task is already holding lock:
[30129.876572] ffff888107cb9018 (&pool->lock/1){-.-.}-{2:2}, at: show_workqueue_state.cold.55+0x15b/0x6ca[30129.876576] which lock already depends on the new lock.
[30129.876577] the existing dependency chain (in reverse order) is:
[30129.876578] -> #3 (&pool->lock/1){-.-.}-{2:2}:
[30129.876581] _raw_spin_lock+0x30/0x70
[30129.876581] __queue_work+0x1a3/0x10f0
[30129.876582] queue_work_on+0x78/0x80
[30129.876582] pty_write+0x165/0x1e0
[30129.876583] n_tty_write+0x47f/0xf00
[30129.876583] tty_write+0x3d6/0x8d0
[30129.876584] vfs_write+0x1a8/0x650[30129.876588] -> #2 (&port->lock#2){-.-.}-{2:2}:
[30129.876590] _raw_spin_lock_irqsave+0x3b/0x80
[30129.876591] tty_port_tty_get+0x1d/0xb0
[30129.876592] tty_port_default_wakeup+0xb/0x30
[30129.876592] serial8250_tx_chars+0x3d6/0x970
[30129.876593] serial8250_handle_irq.part.12+0x216/0x380
[30129.876593] serial8250_default_handle_irq+0x82/0xe0
[30129.876594] serial8250_interrupt+0xdd/0x1b0
[30129.876595] __handle_irq_event_percpu+0xfc/0x850[30129.876602] -> #1 (&port->lock){-.-.}-{2:2}:
[30129.876605] _raw_spin_lock_irqsave+0x3b/0x80
[30129.876605] serial8250_console_write+0x12d/0x900
[30129.876606] console_unlock+0x679/0xa90
[30129.876606] register_console+0x371/0x6e0
[30129.876607] univ8250_console_init+0x24/0x27
[30129.876607] console_init+0x2f9/0x45e[30129.876609] -> #0 (console_owner){....}-{0:0}:
[30129.876611] __lock_acquire+0x2f70/0x4e90
[30129.876612] lock_acquire+0x1ac/0xad0
[30129.876612] console_unlock+0x460/0xa90
[30129.876613] vprintk_emit+0x130/0x420
[30129.876613] printk+0x9f/0xc5
[30129.876614] show_pwq+0x154/0x618
[30129.876615] show_workqueue_state.cold.55+0x193/0x6ca
[30129.876615] __handle_sysrq+0x244/0x460
[30129.876616] write_sysrq_trigger+0x48/0x4a
[30129.876616] proc_reg_write+0x1a6/0x240
[30129.876617] vfs_write+0x1a8/0x650[30129.876619] other info that might help us debug this:
[30129.876620] Chain exists of: [30129.876621] console_owner --> &port->lock#2 --> &pool->lock/1
[30129.876625] Possible unsafe locking scenario:
[30129.876626] CPU0 CPU1 [30129.876626] ---- ---- [30129.876627] lock(&pool->lock/1); [30129.876628] lock(&port->lock#2); [30129.876630] lock(&pool->lock/1); [30129.876631] lock(console_owner);
[30129.876633] *** DEADLOCK ***
[30129.876634] 5 locks held by sysrq.sh/1222:
[30129.876634] #0: ffff8881d3ce0470 (sb_writers#3){.+.+}-{0:0}, at: vfs_write+0x359/0x650
[30129.876637] #1: ffffffff92c612c0 (rcu_read_lock){....}-{1:2}, at: __handle_sysrq+0x4d/0x460
[30129.876640] #2: ffffffff92c612c0 (rcu_read_lock){....}-{1:2}, at: show_workqueue_state+0x5/0xf0
[30129.876642] #3: ffff888107cb9018 (&pool->lock/1){-.-.}-{2:2}, at: show_workqueue_state.cold.55+0x15b/0x6ca
[30129.876645] #4: ffffffff92c39980 (console_lock){+.+.}-{0:0}, at: vprintk_emit+0x123/0x420[30129.876648] stack backtrace: [30129.876649] CPU: 3 PID: 1222 Comm: sysrq.sh Tainted: G S W 5.9.0-rc2+ #3 [30129.876649] Hardware name: Intel Corporation 2012 Client Platform/Emerald Lake 2, BIOS ACRVMBY1.86C.0078.P00.1201161002 01/16/2012 [30129.876650] Call Trace: [30129.876650] dump_stack+0x9d/0xe0 [30129.876651] check_noncircular+0x34f/0x410 [30129.876653] __lock_acquire+0x2f70/0x4e90 [30129.876656] lock_acquire+0x1ac/0xad0 [30129.876658] console_unlock+0x460/0xa90 [30129.876660] vprintk_emit+0x130/0x420 [30129.876660] printk+0x9f/0xc5 [30129.876661] show_pwq+0x154/0x618 [30129.876662] show_workqueue_state.cold.55+0x193/0x6ca [30129.876664] __handle_sysrq+0x244/0x460 [30129.876665] write_sysrq_trigger+0x48/0x4a [30129.876665] proc_reg_write+0x1a6/0x240 [30129.876666] vfs_write+0x1a8/0x650
It looks like the commit was aimed to protect tty_insert_flip_string and there is no need for tty_flip_buffer_push to be under this lock.
--- drivers/tty/pty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/pty.c +1 -1
@@ -120,10 +120,10 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)spin_lock_irqsave (&to->port->lock, flags);/* Stuff the data into the input queue of the other end */ c =tty_insert_flip_string (to->port, buf, c); +spin_unlock_irqrestore (&to->port->lock, flags);/* And shovel */ if (c)tty_flip_buffer_push (to->port); -spin_unlock_irqrestore (&to->port->lock, flags); }return c; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 147/633 spi: spi-s3c64xx: swap s3c64xx_spi_set_cs() and s3c64xx_enable_datapath()
In reply to Greg Kroah-HartmanFrom: Łukasz Stelmach <[email protected]>
[ Upstream commit 581e2b41977dfc2d4c26c8e976f89c43bb92f9bf ]
Fix issues with DMA transfers bigger than 512 bytes on Exynos3250. Without the patches such transfers fail to complete. This solution to the problem is found in the vendor kernel for ARTIK5 boards based on Exynos3250.
--- drivers/spi/spi-s3c64xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-s3c64xx.c +2 -2
@@ -678,11 +678,11 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, sdd->state &= ~RXBUSY ; sdd->state &= ~TXBUSY ; -s3c64xx_enable_datapath (sdd, xfer, use_dma); -/* Start the signals */ s3c64xx_spi_set_cs (spi, true); +s3c64xx_enable_datapath (sdd, xfer, use_dma); +spin_unlock_irqrestore (&sdd->lock, flags);if (use_dma)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 174/633 scsi: qla4xxx: Fix an error handling path in qla4xxx_get_host_stats()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 574918e69720fe62ab3eb42ec3750230c8d16b06 ]
Update the size used in 'dma_free_coherent()' in order to match the one used in the corresponding 'dma_alloc_coherent()'.
--- drivers/scsi/qla4xxx/ql4_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +1 -1
@@ -1220,7 +1220,7 @@ static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len)le64_to_cpu (ql_iscsi_stats->iscsi_sequence_error); exit_host_stats:if (ql_iscsi_stats) -dma_free_coherent (&ha->pdev->dev, host_stats_size, +dma_free_coherent (&ha->pdev->dev, stats_size, ql_iscsi_stats, iscsi_stats_dma); ql4_printk(KERN_INFO, ha, "%s: Get host stats done\n",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 146/633 pinctrl: bcm: fix kconfig dependency warning when !GPIOLIB
In reply to Greg Kroah-HartmanFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 513034d8b089b9a49dab57845aee70e830fe7334 ]
When PINCTRL_BCM2835 is enabled and GPIOLIB is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for GPIOLIB_IRQCHIP
Depends on [n]: GPIOLIB [=n]
Selected by [y]:
- PINCTRL_BCM2835 [=y] && PINCTRL [=y] && OF [=y] && (ARCH_BCM2835 [=n] || ARCH_BRCMSTB [=n] || COMPILE_TEST [=y])
The reason is that PINCTRL_BCM2835 selects GPIOLIB_IRQCHIP without depending on or selecting GPIOLIB while GPIOLIB_IRQCHIP is subordinate to GPIOLIB.
Honor the kconfig menu hierarchy to remove kconfig dependency warnings.
--- drivers/pinctrl/bcm/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/bcm/Kconfig +1 -0
@@ -23,6 +23,7 @@ config PINCTRL_BCM2835 select PINMUX select PINCONF select GENERIC_PINCONF + select GPIOLIB select GPIOLIB_IRQCHIP default ARCH_BCM2835 || ARCH_BRCMSTB help
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 168/633 brcmfmac: check ndev pointer
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 9c9f015bc9f8839831c7ba0a6d731a3853c464e2 ]
Clang static analysis reports this error
brcmfmac/core.c:490:4: warning: Dereference of null pointer
(*ifp)->ndev->stats.rx_errors++;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In this block of code
if (ret || !(*ifp) || !(*ifp)->ndev) {
if (ret != -ENODATA && *ifp)
(*ifp)->ndev->stats.rx_errors++;
brcmu_pkt_buf_free_skb(skb);
return -ENODATA;
}(*ifp)->ndev being NULL is caught as an error
But then it is used to report the error.
So add a check before using it.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +1 -1
@@ -483,7 +483,7 @@ static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb, ret =brcmf_proto_hdrpull (drvr, true, skb, ifp);if (ret || !(*ifp) || !(*ifp)->ndev) { -if (ret != -ENODATA && *ifp) +if (ret != -ENODATA && *ifp && (*ifp)->ndev) (*ifp)->ndev->stats.rx_errors++;brcmu_pkt_buf_free_skb (skb);return -ENODATA ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 170/633 staging: rtl8192u: Do not use GFP_KERNEL in atomic context
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit acac75bb451fd39344eb54fad6602dfc9482e970 ]
'rtl8192_irq_rx_tasklet()' is a tasklet initialized in 'rtl8192_init_priv_task()'.
Quoted 1 line
From this function it is possible to allocate some memory with the
GFP_KERNEL flag, which is not allowed in the atomic context of a tasklet.
Use GFP_ATOMIC instead.
The call chain is:
rtl8192_irq_rx_tasklet (in r8192U_core.c)
--> rtl8192_rx_nomal (in r8192U_core.c)
--> ieee80211_rx (in ieee80211/ieee80211_rx.c)
--> RxReorderIndicatePacket (in ieee80211/ieee80211_rx.c)--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1 -1
@@ -597,7 +597,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, prxbIndicateArray =kmalloc_array (REORDER_WIN_SIZE ,sizeof (struct ieee80211_rxb *), -GFP_KERNEL ); +GFP_ATOMIC );if (!prxbIndicateArray)return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 144/633 media: ti-vpe: Fix a missing check and reference count leak
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 7dae2aaaf432767ca7aa11fa84643a7c2600dbdd ]
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. And also, when the call of function vpe_runtime_get() failed, we won't call vpe_runtime_put().
Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails inside vpe_runtime_get().
--- drivers/media/platform/ti-vpe/vpe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/ti-vpe/vpe.c +2 -0
@@ -2475,6 +2475,8 @@ static int vpe_runtime_get(struct platform_device *pdev) r =pm_runtime_get_sync (&pdev->dev);WARN_ON (r <0 ); +if (r) +pm_runtime_put_noidle (&pdev->dev);return r <0 ? r :0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 163/633 ath10k: Fix the size used in a dma_free_coherent() call in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 454530a9950b5a26d4998908249564cedfc4babc ]
Update the size used in 'dma_free_coherent()' in order to match the one used in the corresponding 'dma_alloc_coherent()'.
--- drivers/net/wireless/ath/ath10k/ce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/ce.c +1 -1
@@ -1555,7 +1555,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, ret =ath10k_ce_alloc_shadow_base (ar, src_ring, nentries);if (ret) {dma_free_coherent (ar->dev, - (nentries *sizeof (struct ce_desc_64 ) + + (nentries *sizeof (struct ce_desc ) +CE_DESC_RING_ALIGN ), src_ring->base_addr_owner_space_unaligned, base_addr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 162/633 ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2705cd7558e718a7240c64eb0afb2edad5f8c190 ]
The value of "htc_hdr->endpoint_id" comes from skb->data so Smatch marks it as untrusted so we have to check it before using it as an array offset.
This is similar to a bug that syzkaller found in commit e4ff08a4d727 ("ath9k: Fix use-after-free Write in ath9k_htc_rx_msg") so it is probably a real issue.
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/htc_hst.c +2 -0
@@ -339,6 +339,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,if (skb) { htc_hdr = (struct htc_frame_hdr *) skb->data; +if (htc_hdr->endpoint_id >=ARRAY_SIZE (htc_handle->endpoint)) + goto ret; endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id];skb_pull (skb,sizeof (struct htc_frame_hdr ));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 164/633 wcn36xx: Fix reported 802.11n rx_highest rate wcn3660/wcn3680
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 3b9fb6791e7113679b1eb472e6ce1659e80f5797 ]
Qualcomm's document "80-WL007-1 Rev. J" states that the highest rx rate for the WCN3660 and WCN3680 on MCS 7 is 150 Mbps not the 72 Mbps stated here.
This patch fixes the data-rate declared in the 5GHz table.
hardware")
--- drivers/net/wireless/ath/wcn36xx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/main.c +1 -1
@@ -163,7 +163,7 @@ static struct ieee80211_supported_band wcn_band_5ghz = { .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, .mcs = { .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest =cpu_to_le16 (72 ), + .rx_highest =cpu_to_le16 (150 ), .tx_params = IEEE80211_HT_MCS_TX_DEFINED, } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 166/633 ASoC: qcom: lpass-cpu: fix concurrency issue
In reply to Greg Kroah-HartmanFrom: Rohit kumar <[email protected]>
[ Upstream commit 753a6e17942f6f425ca622e1610625998312ad89 ]
i2sctl register value is set to 0 during hw_free(). This impacts any ongoing concurrent session on the same i2s port. As trigger() stop already resets enable bit to 0, there is no need of explicit hw_free. Removing it to fix the issue.
--- sound/soc/qcom/lpass-cpu.c | 16 ---------------- 1 file changed, 16 deletions(-)
sound/soc/qcom/lpass-cpu.c +0 -16
@@ -209,21 +209,6 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,return 0 ; } -static int lpass_cpu_daiops_hw_free (struct snd_pcm_substream *substream, -struct snd_soc_dai *dai) -{ -struct lpass_data *drvdata =snd_soc_dai_get_drvdata (dai); -int ret; - - ret =regmap_write (drvdata->lpaif_map, -LPAIF_I2SCTL_REG (drvdata->variant, dai->driver->id), -0 ); -if (ret) -dev_err (dai->dev,"error writing to i2sctl reg: %d\n" , ret); - -return ret; -} -static int lpass_cpu_daiops_prepare (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {
@@ -304,7 +289,6 @@ const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = { .startup = lpass_cpu_daiops_startup, .shutdown = lpass_cpu_daiops_shutdown, .hw_params = lpass_cpu_daiops_hw_params, - .hw_free = lpass_cpu_daiops_hw_free, .prepare = lpass_cpu_daiops_prepare, .trigger = lpass_cpu_daiops_trigger, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 165/633 ASoC: qcom: lpass-platform: fix memory leak
In reply to Greg Kroah-HartmanFrom: Rohit kumar <[email protected]>
[ Upstream commit 5fd188215d4eb52703600d8986b22311099a5940 ]
lpass_pcm_data is never freed. Free it in close
ops to avoid memory leak.
--- sound/soc/qcom/lpass-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/qcom/lpass-platform.c +2 -1
@@ -61,7 +61,7 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,int ret, dma_ch, dir = substream->stream;struct lpass_pcm_data *data; - data =devm_kzalloc (soc_runtime->dev,sizeof (*data),GFP_KERNEL ); + data =kzalloc (sizeof (*data),GFP_KERNEL );if (!data)return -ENOMEM ;
@@ -118,6 +118,7 @@ static int lpass_platform_pcmops_close(struct snd_soc_component *component,if (v->free_dma_channel) v->free_dma_channel (drvdata, data->dma_ch); +kfree (data);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 161/633 ath6kl: prevent potential array overflow in ath6kl_add_new_sta()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 54f9ab7b870934b70e5a21786d951fbcf663970f ]
The value for "aid" comes from skb->data so Smatch marks it as untrusted. If it's invalid then it can result in an out of bounds array access in ath6kl_add_new_sta().
--- drivers/net/wireless/ath/ath6kl/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath6kl/main.c +3 -0
@@ -430,6 +430,9 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,ath6kl_dbg (ATH6KL_DBG_TRC ,"new station %pM aid=%d\n" , mac_addr, aid); +if (aid <1 || aid >AP_MAX_NUM_STA ) +return ; +if (assoc_req_len >sizeof (struct ieee80211_hdr_3addr )) {struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) assoc_info;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 208/633 drm/panfrost: Ensure GPU quirks are always initialised
In reply to Greg Kroah-HartmanFrom: Steven Price <[email protected]>
[ Upstream commit 8c3c818c23a5bbce6ff180dd2ee04415241df77c ]
The GPU 'CONFIG' registers used to work around hardware issues are cleared on reset so need to be programmed every time the GPU is reset. However panfrost_device_reset() failed to do this.
To avoid this in future instead move the call to panfrost_gpu_init_quirks() to panfrost_gpu_power_on() so that the regsiters are always programmed just before the cores are powered.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +2 -1
@@ -304,6 +304,8 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev)int ret;u32 val; +panfrost_gpu_init_quirks (pfdev); +/* Just turn on everything for now */ gpu_write (pfdev,L2_PWRON_LO , pfdev->features.l2_present); ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO,
@@ -355,7 +357,6 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)return err; } -panfrost_gpu_init_quirks (pfdev);panfrost_gpu_power_on (pfdev);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 179/633 libbpf: Fix unintentional success return code in bpf_object__load
In reply to Greg Kroah-HartmanFrom: Alex Gartrell <[email protected]>
[ Upstream commit ef05afa66c59c2031a3798916ef3ff3778232129 ]
There are code paths where EINVAL is returned directly without setting errno. In that case, errno could be 0, which would mask the failure. For example, if a careless programmer set log_level to 10000 out of laziness, they would have to spend a long time trying to figure out why.
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -5253,7 +5253,7 @@ load_program(struct bpf_program *prog, struct bpf_insn *insns, int insns_cnt,free (log_buf); goto retry_load; } - ret = -errno; + ret = errno ? -errno : -LIBBPF_ERRNO__LOAD ; cp =libbpf_strerror_r (errno, errmsg,sizeof (errmsg));pr_warn ("load bpf program failed: %s\n" , cp);pr_perm_msg (ret);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 205/633 scsi: ufs: ufs-mediatek: Fix HOST_PA_TACTIVATE quirk
In reply to Greg Kroah-HartmanFrom: Stanley Chu <[email protected]>
[ Upstream commit a3e40b80dc951057033dce86f0e675b2b822b513 ]
Simply add HOST_PA_TACTIVATE quirk back since it was incorrectly removed before.
--- drivers/scsi/ufs/ufs-mediatek.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +0 -6
@@ -585,13 +585,7 @@ static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)static void ufs_mtk_fixup_dev_quirks (struct ufs_hba *hba) { -struct ufs_dev_info *dev_info = &hba->dev_info; -u16 mid = dev_info->wmanufacturerid; -ufshcd_fixup_dev_quirks (hba, ufs_mtk_dev_fixups); - -if (mid ==UFS_VENDOR_SAMSUNG ) - hba->dev_quirks &= ~UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE ; }/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 204/633 ASoC: fsl: imx-es8328: add missing put_device() call in imx_es8328_probe()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit e525db7e4b44c5b2b5aac0dad24e23cb58c54d22 ]
if of_find_device_by_node() succeed, imx_es8328_probe() doesn't have a corresponding put_device(). Thus add a jump target to fix the exception handling for this function implementation.
--- sound/soc/fsl/imx-es8328.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/fsl/imx-es8328.c +7 -5
@@ -145,13 +145,13 @@ static int imx_es8328_probe(struct platform_device *pdev) data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data) { ret = -ENOMEM ; - goto fail; + goto put_device; } comp =devm_kzalloc (dev,3 *sizeof (*comp),GFP_KERNEL );if (!comp) { ret = -ENOMEM ; - goto fail; + goto put_device; } data->dev = dev;
@@ -182,12 +182,12 @@ static int imx_es8328_probe(struct platform_device *pdev) ret =snd_soc_of_parse_card_name (&data->card,"model" );if (ret) {dev_err (dev,"Unable to parse card name\n" ); - goto fail; + goto put_device; } ret =snd_soc_of_parse_audio_routing (&data->card,"audio-routing" );if (ret) {dev_err (dev,"Unable to parse routing: %d\n" , ret); - goto fail; + goto put_device; } data->card.num_links =1 ; data->card.owner =THIS_MODULE ;
@@ -196,10 +196,12 @@ static int imx_es8328_probe(struct platform_device *pdev) ret =snd_soc_register_card (&data->card);if (ret) {dev_err (dev,"Unable to register: %d\n" , ret); - goto fail; + goto put_device; }platform_set_drvdata (pdev, data); +put_device: +put_device (&ssi_pdev->dev); fail:of_node_put (ssi_np);of_node_put (codec_np);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 200/633 ath11k: fix a double free and a memory leak
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 7e8453e35e406981d7c529ff8f804285bc894ba3 ]
clang static analyzer reports this problem
mac.c:6204:2: warning: Attempt to free released memory
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The channels pointer is allocated in ath11k_mac_setup_channels_rates() When it fails midway, it cleans up the memory it has already allocated. So the error handling needs to skip freeing the memory.
There is a second problem. ath11k_mac_setup_channels_rates(), allocates 3 channels. err_free misses releasing ar->mac.sbands[NL80211_BAND_6GHZ].channels
--- drivers/net/wireless/ath/ath11k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mac.c +3 -1
@@ -5824,7 +5824,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ret =ath11k_mac_setup_channels_rates (ar, cap->supported_bands);if (ret) - goto err_free; + goto err;ath11k_mac_setup_ht_vht_cap (ar, cap, &ht_cap);ath11k_mac_setup_he_cap (ar, cap);
@@ -5938,7 +5938,9 @@ static int __ath11k_mac_register(struct ath11k *ar) err_free:kfree (ar->mac.sbands[NL80211_BAND_2GHZ ].channels);kfree (ar->mac.sbands[NL80211_BAND_5GHZ ].channels); +kfree (ar->mac.sbands[NL80211_BAND_6GHZ ].channels); +err:SET_IEEE80211_DEV (ar->hw,NULL );return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 187/633 drm: panel: Fix bpc for OrtusTech COM43H4M85ULC panel
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 3b8095169982ff4ec2a1b4be61b7224bbef23b48 ]
The OrtusTech COM43H4M85ULC panel is a 18-bit RGB panel. Commit f098f168e91c ("drm: panel: Fix bus format for OrtusTech COM43H4M85ULC panel") has fixed the bus formats, but forgot to address the bpc value. Set it to 6.
--- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +1 -1
@@ -2862,7 +2862,7 @@ static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {static const struct panel_desc ortustech_com43h4m85ulc = { .modes = &ortustech_com43h4m85ulc_mode, .num_modes =1 , - .bpc =8 , + .bpc =6 , .size = { .width =56 , .height =93 ,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 201/633 video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c72fab81ceaa54408b827a2f0486d9a0f4be34cf ]
The pixclock is being set locally because it is being passed as a pass-by-value argument rather than pass-by-reference, so the computed pixclock is never being set in var->pixclock. Fix this by passing by reference.
[This dates back to 2002, I found the offending commit from the git history git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git ]
Addresses-Coverity: ("Unused value")
--- drivers/video/fbdev/vga16fb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/video/fbdev/vga16fb.c +7 -7
@@ -243,7 +243,7 @@ static void vga16fb_update_fix(struct fb_info *info) }static void vga16fb_clock_chip (struct vga16fb_par *par, -unsigned int pixclock, +unsigned int *pixclock,const struct fb_info *info,int mul,int div) {
@@ -259,14 +259,14 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, { 0 /* bad */, 0x00, 0x00}};int err; - pixclock = (pixclock * mul) / div; + *pixclock = (*pixclock * mul) / div; best = vgaclocks; - err = pixclock - best->pixclock; + err = *pixclock - best->pixclock;if (err <0 ) err = -err;for (ptr = vgaclocks +1 ; ptr->pixclock; ptr++) {int tmp; - tmp = pixclock - ptr->pixclock; + tmp = *pixclock - ptr->pixclock;if (tmp <0 ) tmp = -tmp;if (tmp < err) { err = tmp;
@@ -275,7 +275,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, } par->misc |= best->misc; par->clkdiv = best->seq_clock_mode; - pixclock = (best->pixclock * div) / mul; + *pixclock = (best->pixclock * div) / mul; }#define FAIL (X ) return -EINVAL
@@ -497,10 +497,10 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,if (mode &MODE_8BPP )/* pixel clock == vga clock / 2 */ -vga16fb_clock_chip (par, var->pixclock, info,1 ,2 ); +vga16fb_clock_chip (par, &var->pixclock, info,1 ,2 );else /* pixel clock == vga clock */ -vga16fb_clock_chip (par, var->pixclock, info,1 ,1 ); +vga16fb_clock_chip (par, &var->pixclock, info,1 ,1 ); var->red.offset = var->green.offset = var->blue.offset = var->transp.offset =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 199/633 drivers/virt/fsl_hypervisor: Fix error handling path
In reply to Greg Kroah-HartmanFrom: Souptick Joarder <[email protected]>
[ Upstream commit 7f360bec37857bfd5a48cef21d86f58a09a3df63 ]
First, when memory allocation for sg_list_unaligned failed, there is a bug of calling put_pages() as we haven't pinned any pages.
Second, if get_user_pages_fast() failed we should unpin num_pinned pages.
This will address both.
As part of these changes, minor update in documentation.
--- drivers/virt/fsl_hypervisor.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/virt/fsl_hypervisor.c +8 -9
@@ -157,7 +157,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)unsigned int i;long ret =0 ; -int num_pinned;/* return value from get_user_pages() */ +int num_pinned =0 ;/* return value from get_user_pages_fast() */ phys_addr_t remote_paddr;/* The next address in the remote buffer */ uint32_t count;/* The number of bytes left to copy */
@@ -174,7 +174,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)return -EINVAL ;/* -* The array of pages returned by get_user_pages() covers only +* The array of pages returned by get_user_pages_fast() covers only * page-aligned memory. Since the user buffer is probably not * page-aligned, we need to handle the discrepancy. *
@@ -224,7 +224,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)/* * 'pages' is an array of struct page pointers that's initialized by -* get_user_pages(). +* get_user_pages_fast(). */ pages =kcalloc (num_pages,sizeof (struct page *),GFP_KERNEL );if (!pages) {
@@ -241,7 +241,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)if (!sg_list_unaligned) {pr_debug ("fsl-hv: could not allocate S/G list\n" ); ret = -ENOMEM ; - goto exit; + goto free_pages; } sg_list =PTR_ALIGN (sg_list_unaligned,sizeof (struct fh_sg_list ));
@@ -250,7 +250,6 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) num_pages, param.source != -1 ? FOLL_WRITE : 0, pages);if (num_pinned != num_pages) { -/* get_user_pages() failed */ pr_debug ("fsl-hv: could not lock source buffer\n" ); ret = (num_pinned <0 ) ? num_pinned : -EFAULT ; goto exit;
@@ -292,13 +291,13 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) virt_to_phys(sg_list), num_pages); exit: -if (pages) { -for (i =0 ; i < num_pages; i++) -if (pages[i]) -put_page (pages[i]); +if (pages && (num_pinned >0 )) { +for (i =0 ; i < num_pinned; i++) +put_page (pages[i]); }kfree (sg_list_unaligned); +free_pages:kfree (pages);if (!ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 222/633 xfs: force the log after remapping a synchronous-writes file
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 5ffce3cc22a0e89813ed0c7162a68b639aef9ab6 ]
Commit 5833112df7e9 tried to make it so that a remap operation would force the log out to disk if the filesystem is mounted with mandatory synchronous writes. Unfortunately, that commit failed to handle the case where the inode or the file descriptor require mandatory synchronous writes.
Refactor the check into into a helper that will look for all three conditions, and now we can treat reflink just like any other synchronous write.
--- fs/xfs/xfs_file.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/xfs/xfs_file.c +16 -1
@@ -1005,6 +1005,21 @@ xfs_file_fadvise(return ret; } +/* Does this file, inode, or mount want synchronous writes? */ +static inline bool xfs_file_sync_writes (struct file *filp) +{ +struct xfs_inode *ip =XFS_I (file_inode (filp)); + +if (ip->i_mount->m_flags &XFS_MOUNT_WSYNC ) +return true; +if (filp->f_flags & (__O_SYNC |O_DSYNC )) +return true; +if (IS_SYNC (file_inode (filp))) +return true; + +return false; +} + STATIC loff_t xfs_file_remap_range( struct file *file_in,
@@ -1062,7 +1077,7 @@ xfs_file_remap_range(if (ret) goto out_unlock; -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_file_sync_writes (file_in) ||xfs_file_sync_writes (file_out))xfs_log_force_inode (dest); out_unlock:xfs_reflink_remap_unlock (file_in, file_out);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 219/633 scsi: mpt3sas: Fix sync irqs
In reply to Greg Kroah-HartmanFrom: Tomas Henzl <[email protected]>
[ Upstream commit 45181eab8ba79ed7a41b549f00500c0093828521 ]
_base_process_reply_queue() called from _base_interrupt() may schedule a new irq poll. Fix this by calling synchronize_irq() first.
Also ensure that enable_irq() is called only when necessary to avoid "Unbalanced enable for IRQ..." errors.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +9 -5
@@ -1808,18 +1808,22 @@ mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc)/* TMs are on msix_index == 0 */ if (reply_q->msix_index ==0 )continue ; +synchronize_irq (pci_irq_vector (ioc->pdev, reply_q->msix_index));if (reply_q->irq_poll_scheduled) {/* Calling irq_poll_disable will wait for any pending * callbacks to have completed. */ irq_poll_disable (&reply_q->irqpoll);irq_poll_enable (&reply_q->irqpoll); - reply_q->irq_poll_scheduled = false; - reply_q->irq_line_enable = true; -enable_irq (reply_q->os_irq); -continue ; +/* check how the scheduled poll has ended, +* clean up only if necessary +*/ +if (reply_q->irq_poll_scheduled) { + reply_q->irq_poll_scheduled = false; + reply_q->irq_line_enable = true; +enable_irq (reply_q->os_irq); + } } -synchronize_irq (pci_irq_vector (ioc->pdev, reply_q->msix_index)); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 141/633 media: camss: Fix a reference count leak.
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit d0675b67b42eb4f1a840d1513b5b00f78312f833 ]
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 is not called in error handling paths. Thus call pm_runtime_put_sync() if pm_runtime_get_sync() fails.
--- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/camss/camss-csiphy.c +3 -1
@@ -176,8 +176,10 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on)int ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);return ret; + } ret =csiphy_set_clock_rates (csiphy);if (ret <0 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 149/633 hwmon: (bt1-pvt) Test sensor power supply on probe
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit a6db1561291fc0f2f9aa23bf38f381adc63e7b14 ]
Baikal-T1 PVT sensor has got a dedicated power supply domain (feed up by the external GPVT/VPVT_18 pins). In case if it isn't powered up, the registers will be accessible, but the sensor conversion just won't happen. Due to that an attempt to read data from any PVT sensor will cause the task hanging up. For instance that will happen if XP11 jumper isn't installed on the Baikal-T1-based BFK3.1 board. Let's at least test whether the conversion work on the device probe procedure. By doing so will make sure that the PVT sensor is powered up at least at boot time.
--- drivers/hwmon/bt1-pvt.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/hwmon/bt1-pvt.c +40 -0
@@ -13,6 +13,7 @@#include <linux/bitops.h> #include <linux/clk.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/device.h> #include <linux/hwmon-sysfs.h> #include <linux/hwmon.h>
@@ -982,6 +983,41 @@ static int pvt_request_clks(struct pvt_hwmon *pvt)return 0 ; } +static int pvt_check_pwr (struct pvt_hwmon *pvt) +{ +unsigned long tout; +int ret =0 ; +u32 data; + +/* +* Test out the sensor conversion functionality. If it is not done on +* time then the domain must have been unpowered and we won't be able +* to use the device later in this driver. +* Note If the power source is lost during the normal driver work the +* data read procedure will either return -ETIMEDOUT (for the +* alarm-less driver configuration) or just stop the repeated +* conversion. In the later case alas we won't be able to detect the +* problem. +*/ +pvt_update (pvt->regs +PVT_INTR_MASK ,PVT_INTR_ALL ,PVT_INTR_ALL ); +pvt_update (pvt->regs +PVT_CTRL ,PVT_CTRL_EN ,PVT_CTRL_EN ); +pvt_set_tout (pvt,0 ); +readl (pvt->regs +PVT_DATA ); + + tout =PVT_TOUT_MIN /NSEC_PER_USEC ; +usleep_range (tout,2 * tout); + + data =readl (pvt->regs +PVT_DATA ); +if (!(data &PVT_DATA_VALID )) { + ret = -ENODEV ; +dev_err (pvt->dev,"Sensor is powered down\n" ); + } + +pvt_update (pvt->regs +PVT_CTRL ,PVT_CTRL_EN ,0 ); + +return ret; +} +static void pvt_init_iface (struct pvt_hwmon *pvt) {u32 trim, temp;
@@ -1109,6 +1145,10 @@ static int pvt_probe(struct platform_device *pdev)if (ret)return ret; + ret =pvt_check_pwr (pvt); +if (ret) +return ret; +pvt_init_iface (pvt); ret =pvt_request_irq (pvt);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 171/633 drm/amd/display: fix potential integer overflow when shifting 32 bit variable bl_pwm
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 1d5503331b12a76266049289747dfd94f1643fde ]
The 32 bit unsigned integer bl_pwm is being shifted using 32 bit arithmetic and then being assigned to a 64 bit unsigned integer. There is a potential for a 32 bit overflow so cast bl_pwm to enforce a 64 bit shift operation to avoid this.
Addresses-Coverity: ("unintentional integer overflow")
--- drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c +1 -1
@@ -75,7 +75,7 @@ static unsigned int calculate_16_bit_backlight_from_pwm(struct dce_panel_cntl *delse bl_pwm &=0xFFFF ; - current_backlight = bl_pwm << (1 + bl_int_count); + current_backlight = (uint64_t )bl_pwm << (1 + bl_int_count);if (bl_period ==0 ) bl_period =0xFFFF ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 167/633 ath11k: Fix possible memleak in ath11k_qmi_init_service
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 28f1632118818d9dccabf4c0fccfe49686742317 ]
When qmi_add_lookup fail, we should destroy the workqueue
--- drivers/net/wireless/ath/ath11k/qmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath11k/qmi.c +1 -0
@@ -2419,6 +2419,7 @@ int ath11k_qmi_init_service(struct ath11k_base *ab) ATH11K_QMI_WLFW_SERVICE_INS_ID_V01);if (ret <0 ) {ath11k_warn (ab,"failed to add qmi lookup\n" ); +destroy_workqueue (ab->qmi.event_wq);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 169/633 mwifiex: Do not use GFP_KERNEL in atomic context
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d2ab7f00f4321370a8ee14e5630d4349fdacc42e ]
A possible call chain is as follow:
mwifiex_sdio_interrupt (sdio.c)
--> mwifiex_main_process (main.c)
--> mwifiex_process_cmdresp (cmdevt.c)
--> mwifiex_process_sta_cmdresp (sta_cmdresp.c)
--> mwifiex_ret_802_11_scan (scan.c)
--> mwifiex_parse_single_response_buf (scan.c)'mwifiex_sdio_interrupt()' is an interrupt function.
Also note that 'mwifiex_ret_802_11_scan()' already uses GFP_ATOMIC.
So use GFP_ATOMIC instead of GFP_KERNEL when memory is allocated in 'mwifiex_parse_single_response_buf()'.
or
--- drivers/net/wireless/marvell/mwifiex/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/scan.c +1 -1
@@ -1889,7 +1889,7 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info, chan,CFG80211_BSS_FTYPE_UNKNOWN , bssid, timestamp, cap_info_bitmap, beacon_period, - ie_buf, ie_len, rssi, GFP_KERNEL); + ie_buf, ie_len, rssi, GFP_ATOMIC);if (bss) { bss_priv = (struct mwifiex_bss_priv *)bss->priv; bss_priv->band = band;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 178/633 scsi: csiostor: Fix wrong return value in csio_hw_prep_fw()
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit 44f4daf8678ae5f08c93bbe70792f90cd88e4649 ]
On an error exit path, a negative error code should be returned instead of a positive return value.
--- drivers/scsi/csiostor/csio_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_hw.c +1 -1
@@ -2384,7 +2384,7 @@ static int csio_hw_prep_fw(struct csio_hw *hw, struct fw_info *fw_info,FW_HDR_FW_VER_MICRO_G (c),FW_HDR_FW_VER_BUILD_G (c),FW_HDR_FW_VER_MAJOR_G (k),FW_HDR_FW_VER_MINOR_G (k), FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); - ret =EINVAL ; + ret = -EINVAL ; goto bye; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 180/633 wilc1000: Fix memleak in wilc_sdio_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 8d95ab34b21ee0f870a9185b6457e8f6eb54914c ]
When devm_clk_get() returns -EPROBE_DEFER, sdio_priv should be freed just like when wilc_cfg80211_init() fails.
--- drivers/staging/wilc1000/sdio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/sdio.c +3 -2
@@ -151,9 +151,10 @@ static int wilc_sdio_probe(struct sdio_func *func, wilc->dev = &func->dev; wilc->rtc_clk =devm_clk_get (&func->card->dev,"rtc" ); -if (PTR_ERR_OR_ZERO (wilc->rtc_clk) == -EPROBE_DEFER ) +if (PTR_ERR_OR_ZERO (wilc->rtc_clk) == -EPROBE_DEFER ) { +kfree (sdio_priv);return -EPROBE_DEFER ; -else if (!IS_ERR (wilc->rtc_clk)) + }else if (!IS_ERR (wilc->rtc_clk))clk_prepare_enable (wilc->rtc_clk);dev_info (&func->dev,"Driver Initializing success\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 182/633 rtw88: dont treat NULL pointer as an array
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 22b726cbdd09d9891ede8aa122a950d2d0ae5e09 ]
I'm not a standards expert, but this really looks to be undefined behavior, when chip->dig_cck may be NULL. (And, we're trying to do a NULL check a few lines down, because some chip variants will use NULL.)
--- drivers/net/wireless/realtek/rtw88/phy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +3 -2
@@ -147,12 +147,13 @@ void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi) {struct rtw_chip_info *chip = rtwdev->chip;struct rtw_hal *hal = &rtwdev->hal; -const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0 ];u32 addr, mask;u8 path; -if (dig_cck) +if (chip->dig_cck) { +const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0 ];rtw_write32_mask (rtwdev, dig_cck->addr, dig_cck->mask, igi >>1 ); + }for (path =0 ; path < hal->rf_path_num; path++) { addr = chip->dig[path].addr;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 143/633 media: stm32-dcmi: Fix a reference count leak
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 88f50a05f907d96a27a9ce3cc9e8cbb91a6f0f22 ]
Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put is not called in error handling paths. Thus replace the jump target "err_release_buffers" by "err_pm_putw".
--- drivers/media/platform/stm32/stm32-dcmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +1 -3
@@ -733,7 +733,7 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)if (ret <0 ) {dev_err (dcmi->dev,"%s: Failed to start streaming, cannot get sync (%d)\n" , __func__, ret); - goto err_release_buffers; + goto err_pm_put; } ret =media_pipeline_start (&dcmi->vdev->entity, &dcmi->pipeline);
@@ -837,8 +837,6 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) err_pm_put:pm_runtime_put (dcmi->dev); - -err_release_buffers:spin_lock_irq (&dcmi->irqlock);/* * Return all buffers to vb2 in QUEUED state.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 61/633 ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
In reply to Greg Kroah-HartmanFrom: Jian-Hong Pan <[email protected]>
commit ca184355db8e60290fa34bf61c13308e6f4f50d3 upstream.
The ASUS D700SA desktop's audio (1043:2390) with ALC887 cannot detect the headset microphone and another headphone jack until ALC887_FIXUP_ASUS_HMIC and ALC887_FIXUP_ASUS_AUDIO quirks are applied. The NID 0x15 maps as the headset microphone and NID 0x19 maps as another headphone jack. Also need the function like alc887_fixup_asus_jack to enable the audio jacks.
--- sound/pci/hda/patch_realtek.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
sound/pci/hda/patch_realtek.c +42 -0
@@ -1922,6 +1922,8 @@ enum {ALC1220_FIXUP_CLEVO_P950 ,ALC1220_FIXUP_CLEVO_PB51ED ,ALC1220_FIXUP_CLEVO_PB51ED_PINS , +ALC887_FIXUP_ASUS_AUDIO , + ALC887_FIXUP_ASUS_HMIC, }; static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2134,6 +2136,31 @@ static void alc1220_fixup_clevo_pb51ed(salc_fixup_headset_mode_no_hp_mic (codec, fix, action); } +static void alc887_asus_hp_automute_hook (struct hda_codec *codec, +struct hda_jack_callback *jack) +{ +struct alc_spec *spec = codec->spec; +unsigned int vref; + +snd_hda_gen_hp_automute (codec, jack); + +if (spec->gen.hp_jack_present) + vref =AC_PINCTL_VREF_80 ; +else + vref =AC_PINCTL_VREF_HIZ ; +snd_hda_set_pin_ctl (codec,0x19 ,PIN_HP | vref); +} + +static void alc887_fixup_asus_jack (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +if (action !=HDA_FIXUP_ACT_PROBE ) +return ; +snd_hda_set_pin_ctl_cache (codec,0x1b ,PIN_HP ); + spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook; +} +static const struct hda_fixup alc882_fixups[] = { [ALC882_FIXUP_ABIT_AW9D_MAX ] = { .type =HDA_FIXUP_PINS ,
@@ -2391,6 +2418,20 @@ static const struct hda_fixup alc882_fix .chained = true, .chain_id = ALC1220_FIXUP_CLEVO_PB51ED, }, + [ALC887_FIXUP_ASUS_AUDIO] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x15 ,0x02a14150 },/* use as headset mic, without its own jack detect */ + {0x19 ,0x22219420 }, + {} + }, + }, + [ALC887_FIXUP_ASUS_HMIC] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc887_fixup_asus_jack, + .chained = true, + .chain_id = ALC887_FIXUP_ASUS_AUDIO, + }, };static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2424,6 +2465,7 @@ static const struct snd_pci_quirk alc882SND_PCI_QUIRK (0x1043 ,0x13c2 ,"Asus A7M" ,ALC882_FIXUP_EAPD ),SND_PCI_QUIRK (0x1043 ,0x1873 ,"ASUS W90V" ,ALC882_FIXUP_ASUS_W90V ),SND_PCI_QUIRK (0x1043 ,0x1971 ,"Asus W2JC" ,ALC882_FIXUP_ASUS_W2JC ), +SND_PCI_QUIRK (0x1043 ,0x2390 ,"Asus D700SA" ,ALC887_FIXUP_ASUS_HMIC ),SND_PCI_QUIRK (0x1043 ,0x835f ,"Asus Eee 1601" ,ALC888_FIXUP_EEE1601 ),SND_PCI_QUIRK (0x1043 ,0x84bc ,"ASUS ET2700" ,ALC887_FIXUP_ASUS_BASS ), SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Greg Kroah-Hartman
maintainerPATCH 18/633 socket: fix option SO_TIMESTAMPING_NEW
In reply to Greg Kroah-HartmanFrom: Christian Eggers <[email protected]>
[ Upstream commit 59e611a566e7cd48cf54b6777a11fe3f9c2f9db5 ]
The comparison of optname with SO_TIMESTAMPING_NEW is wrong way around, so SOCK_TSTAMP_NEW will first be set and than reset again. Additionally move it out of the test for SOF_TIMESTAMPING_RX_SOFTWARE as this seems unrelated.
This problem happens on 32 bit platforms were the libc has already switched to struct timespec64 (from SO_TIMExxx_OLD to SO_TIMExxx_NEW socket options). ptp4l complains with "missing timestamp on transmitted peer delay request" because the wrong format is received (and discarded).
--- net/core/sock.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
net/core/sock.c +3 -7
@@ -1007,8 +1007,6 @@ set_sndbuf:__sock_set_timestamps (sk, valbool, true, true);break ;case SO_TIMESTAMPING_NEW : -sock_set_flag (sk,SOCK_TSTAMP_NEW ); -/* fall through */ case SO_TIMESTAMPING_OLD :if (val & ~SOF_TIMESTAMPING_MASK ) { ret = -EINVAL ;
@@ -1037,16 +1035,14 @@ set_sndbuf: } sk->sk_tsflags = val; +sock_valbool_flag (sk,SOCK_TSTAMP_NEW , optname ==SO_TIMESTAMPING_NEW ); +if (val &SOF_TIMESTAMPING_RX_SOFTWARE )sock_enable_timestamp (sk,SOCK_TIMESTAMPING_RX_SOFTWARE ); -else { -if (optname ==SO_TIMESTAMPING_NEW ) -sock_reset_flag (sk,SOCK_TSTAMP_NEW ); - +else sock_disable_timestamp (sk, (1UL <<SOCK_TIMESTAMPING_RX_SOFTWARE )); - }break ;case SO_RCVLOWAT :
Greg Kroah-Hartman
maintainerPATCH 160/633 drm: panel: Fix bus format for OrtusTech COM43H4M85ULC panel
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit f098f168e91ca915c6cf8aa316136af647792f2f ]
The OrtusTech COM43H4M85ULC panel is a 18-bit RGB panel, set the bus format to MEDIA_BUS_FMT_RGB666_1X18.
--- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +1 -1
@@ -2867,7 +2867,7 @@ static const struct panel_desc ortustech_com43h4m85ulc = { .width = 56, .height = 93, }, - .bus_format = MEDIA_BUS_FMT_RGB888_1X24, + .bus_format = MEDIA_BUS_FMT_RGB666_1X18, .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, .connector_type = DRM_MODE_CONNECTOR_DPI, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 43/633 net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup
In reply to Greg Kroah-HartmanFrom: Xie He <[email protected]>
[ Upstream commit 5fce1e43e2d5bf2f7e3224d7b99b1c65ab2c26e2 ]
This driver calls ether_setup to set up the network device. The ether_setup function would add the IFF_TX_SKB_SHARING flag to the device. This flag indicates that it is safe to transmit shared skbs to the device.
However, this is not true. This driver may pad the frame (in eth_tx) before transmission, so the skb may be modified.
--- drivers/net/wan/hdlc_raw_eth.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wan/hdlc_raw_eth.c +1 -0
@@ -99,6 +99,7 @@ static int raw_eth_ioctl(struct net_devi old_qlen = dev->tx_queue_len;ether_setup (dev); dev->tx_queue_len = old_qlen; + dev->priv_flags &= ~IFF_TX_SKB_SHARING ;eth_hw_addr_random (dev);call_netdevice_notifiers (NETDEV_POST_TYPE_CHANGE , dev);netif_dormant_off (dev);
Greg Kroah-Hartman
maintainerPATCH 159/633 drm/vkms: add missing platform_device_unregister() in vkms_init()
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 7995bd13296111d672d8c5959f5e81dbbbda5286 ]
When vkms_init() get into out_put, the unregister call of vkms_device->platform is missing. So add it before return.
--- drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +1 -1
@@ -188,8 +188,8 @@ static int __init vkms_init(void) out_put:drm_dev_put (&vkms_device->drm); +platform_device_unregister (vkms_device->platform);return ret; - out_unregister:platform_device_unregister (vkms_device->platform); out_free:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 157/633 drm/amd/display: Fix wrong return value in dm_update_plane_state()
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit c35376137e940c3389df2726a92649c01a9844b4 ]
On an error exit path, a negative error code should be returned instead of a positive return value.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -8178,8 +8178,7 @@ static int dm_update_plane_state(struct dc *dc, dm_old_plane_state->dc_state, dm_state->context)) { - ret =EINVAL ; -return ret; +return -EINVAL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 158/633 drm/vgem: add missing platform_device_unregister() in vgem_init()
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 57fb54082d5d14512dfd21bc39d91945d3ad1ee9 ]
When vgem_init() get into out_put, the unregister call of vgem_device->platform is missing. So add it before return.
--- drivers/gpu/drm/vgem/vgem_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +1 -1
@@ -471,8 +471,8 @@ static int __init vgem_init(void) out_put:drm_dev_put (&vgem_device->drm); +platform_device_unregister (vgem_device->platform);return ret; - out_unregister:platform_device_unregister (vgem_device->platform); out_free:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 156/633 Bluetooth: hci_uart: Cancel init work before unregistering
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit 3b799254cf6f481460719023d7a18f46651e5e7f ]
If hci_uart_tty_close() or hci_uart_unregister_device() is called while hu->init_ready is scheduled, hci_register_dev() could be called after the hci_uart is torn down. Avoid this by ensuring the work is complete or canceled before checking the HCI_UART_REGISTERED flag.
--- drivers/bluetooth/hci_ldisc.c | 1 + drivers/bluetooth/hci_serdev.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/bluetooth/hci_ldisc.c +1 -0
@@ -538,6 +538,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)clear_bit (HCI_UART_PROTO_READY , &hu->flags);percpu_up_write (&hu->proto_lock); +cancel_work_sync (&hu->init_ready);cancel_work_sync (&hu->write_work);if (hdev) {
drivers/bluetooth/hci_serdev.c +2 -0
@@ -355,6 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu)struct hci_dev *hdev = hu->hdev;clear_bit (HCI_UART_PROTO_READY , &hu->flags); + +cancel_work_sync (&hu->init_ready);if (test_bit (HCI_UART_REGISTERED , &hu->flags))hci_unregister_dev (hdev);hci_free_dev (hdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 155/633 drm/vkms: fix xrgb on compute crc
In reply to Greg Kroah-HartmanFrom: Melissa Wen <[email protected]>
[ Upstream commit 0986191186128b10b6bbfa5220fc587ed5725e49 ]
The previous memset operation was not correctly zeroing the alpha channel to compute the crc, and as a result, the IGT subtest kms_cursor_crc/pipe-A-cursor-alpha-transparent fails.
--- drivers/gpu/drm/vkms/vkms_composer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_composer.c +1 -1
@@ -33,7 +33,7 @@ static uint32_t compute_crc(void *vaddr_out, struct vkms_composer *composer) + (i * composer->pitch) + (j * composer->cpp);/* XRGB format ignores Alpha channel */ -memset (vaddr_out + src_offset +24 ,0 ,8 ); +bitmap_clear (vaddr_out + src_offset,24 ,8 ); crc =crc32_le (crc, vaddr_out + src_offset,sizeof (u32)); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 154/633 ath10k: provide survey info as accumulated data
In reply to Greg Kroah-HartmanFrom: Venkateswara Naralasetty <[email protected]>
[ Upstream commit 720e5c03e5cb26d33d97f55192b791bb48478aa5 ]
It is expected that the returned counters by .get_survey are monotonic increasing. But the data from ath10k gets reset to zero regularly. Channel active/busy time are then showing incorrect values (less than previous or sometimes zero) for the currently active channel during successive survey dump commands.
example:
$ iw dev wlan0 survey dump Survey data from wlan0 frequency: 5180 MHz [in use] channel active time: 54995 ms channel busy time: 432 ms channel receive time: 0 ms channel transmit time: 59 ms ...
$ iw dev wlan0 survey dump Survey data from wlan0 frequency: 5180 MHz [in use] channel active time: 32592 ms channel busy time: 254 ms channel receive time: 0 ms channel transmit time: 0 ms ...
The correct way to handle this is to use the non-clearing WMI_BSS_SURVEY_REQ_TYPE_READ wmi_bss_survey_req_type. The firmware will then accumulate the survey data and handle wrap arounds.
Tested-on: QCA9984 hw1.0 10.4-3.5.3-00057
Tested-on: QCA988X hw2.0 10.2.4-1.0-00047
Tested-on: QCA9888 hw2.0 10.4-3.9.0.2-00024
Tested-on: QCA4019 hw1.0 10.4-3.6-00140
--- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +1 -1
@@ -7283,7 +7283,7 @@ ath10k_mac_update_bss_chan_survey(struct ath10k *ar, struct ieee80211_channel *channel) {int ret; -enum wmi_bss_survey_req_type type =WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR ; +enum wmi_bss_survey_req_type type =WMI_BSS_SURVEY_REQ_TYPE_READ ;lockdep_assert_held (&ar->conf_mutex);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 57/633 ALSA: usb-audio: Line6 Pod Go interface requires static clock rate quirk
In reply to Greg Kroah-HartmanFrom: Lukasz Halman <[email protected]>
commit 7da4c510abff8ad47eb2d7cc9a97def5a411947f upstream.
Recently released Line6 Pod Go requires static clock rate quirk to make its usb audio interface working. Added its usb id to the list of similar line6 devices.
--- sound/usb/format.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/format.c +1 -0
@@ -406,6 +406,7 @@ static int line6_parse_audio_format_ratecase USB_ID (0x0e41 ,0x4242 ):/* Line6 Helix Rack */ case USB_ID (0x0e41 ,0x4244 ):/* Line6 Helix LT */ case USB_ID (0x0e41 ,0x4246 ):/* Line6 HX-Stomp */ +case USB_ID (0x0e41 ,0x4247 ):/* Line6 Pod Go */ case USB_ID (0x0e41 ,0x4248 ):/* Line6 Helix >= fw 2.82 */ case USB_ID (0x0e41 ,0x4249 ):/* Line6 Helix Rack >= fw 2.82 */ case USB_ID (0x0e41 ,0x424a ):/* Line6 Helix LT >= fw 2.82 */
Greg Kroah-Hartman
maintainerPATCH 152/633 btrfs: add owner and fs_info to alloc_state io_tree
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit 154f7cb86809a3a796bffbc7a5a7ce0dee585eaa ]
Commit 1c11b63eff2a ("btrfs: replace pending/pinned chunks lists with io tree") introduced btrfs_device::alloc_state extent io tree, but it doesn't initialize the fs_info and owner member.
This means the following features are not properly supported:
- Fs owner report for insert_state() error
Without fs_info initialized, although btrfs_err() won't panic, it won't output which fs is causing the error.
- Wrong owner for trace events
alloc_state will get the owner as pinned extents.
Fix this by assiging proper fs_info and owner forbtrfs_device::alloc_state.
--- fs/btrfs/extent-io-tree.h | 1 + fs/btrfs/volumes.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
fs/btrfs/extent-io-tree.h +1 -0
@@ -48,6 +48,7 @@ enum {IO_TREE_INODE_FILE_EXTENT ,IO_TREE_LOG_CSUM_RANGE ,IO_TREE_SELFTEST , + IO_TREE_DEVICE_ALLOC_STATE, }; struct extent_io_tree {
fs/btrfs/volumes.c +4 -3
@@ -406,7 +406,7 @@ void __exit btrfs_cleanup_fs_uuids(void)* Returned struct is not linked onto any lists and must be destroyed using * btrfs_free_device. */ -static struct btrfs_device *__alloc_device (void ) +static struct btrfs_device *__alloc_device (struct btrfs_fs_info *fs_info) {struct btrfs_device *dev;
@@ -433,7 +433,8 @@ static struct btrfs_device *__alloc_device(void)btrfs_device_data_ordered_init (dev);INIT_RADIX_TREE (&dev->reada_zones,GFP_NOFS & ~__GFP_DIRECT_RECLAIM);INIT_RADIX_TREE (&dev->reada_extents,GFP_NOFS & ~__GFP_DIRECT_RECLAIM); -extent_io_tree_init (NULL , &dev->alloc_state,0 ,NULL ); +extent_io_tree_init (fs_info, &dev->alloc_state, +IO_TREE_DEVICE_ALLOC_STATE ,NULL );return dev; }
@@ -6545,7 +6546,7 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,if (WARN_ON (!devid && !fs_info))return ERR_PTR (-EINVAL ); - dev =__alloc_device (); + dev =__alloc_device (fs_info);if (IS_ERR (dev))return dev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 151/633 hwmon: (bt1-pvt) Wait for the completion with timeout
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 0ffd21d5985506d164ada9e8fff6daae8ef469a1 ]
If the PVT sensor is suddenly powered down while a caller is waiting for the conversion completion, the request won't be finished and the task will hang up on this procedure until the power is back up again. Let's call the wait_for_completion_timeout() method instead to prevent that. The cached timeout is exactly what we need to predict for how long conversion could normally last.
--- drivers/hwmon/bt1-pvt.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/hwmon/bt1-pvt.c +12 -1
@@ -477,6 +477,7 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type, long *val) {struct pvt_cache *cache = &pvt->cache[type]; +unsigned long timeout;u32 data;int ret;
@@ -500,7 +501,14 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type,pvt_update (pvt->regs +PVT_INTR_MASK ,PVT_INTR_DVALID ,0 );pvt_update (pvt->regs +PVT_CTRL ,PVT_CTRL_EN ,PVT_CTRL_EN ); -wait_for_completion (&cache->conversion); +/* +* Wait with timeout since in case if the sensor is suddenly powered +* down the request won't be completed and the caller will hang up on +* this procedure until the power is back up again. Multiply the +* timeout by the factor of two to prevent a false timeout. +*/ + timeout =2 *usecs_to_jiffies (ktime_to_us (pvt->timeout)); + ret =wait_for_completion_timeout (&cache->conversion, timeout);pvt_update (pvt->regs +PVT_CTRL ,PVT_CTRL_EN ,0 ); pvt_update(pvt->regs + PVT_INTR_MASK, PVT_INTR_DVALID,
@@ -510,6 +518,9 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type,mutex_unlock (&pvt->iface_mtx); +if (!ret) +return -ETIMEDOUT ; +if (type ==PVT_TEMP ) *val =pvt_calc_poly (&poly_N_to_temp, data);else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 108/633 crypto: ccree - fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: [email protected] <[email protected]>
[ Upstream commit b7b57a5643c2ae45afe6aa5e73363b553cacd14b ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. However, users of cc_pm_get(), a direct wrapper of pm_runtime_get_sync(), assume that PM usage counter will not change on error. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/crypto/ccree/cc_pm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/ccree/cc_pm.c +5 -1
@@ -65,8 +65,12 @@ const struct dev_pm_ops ccree_pm = {int cc_pm_get (struct device *dev) {int rc =pm_runtime_get_sync (dev); +if (rc <0 ) { +pm_runtime_put_noidle (dev); +return rc; + } -return (rc ==1 ?0 : rc); +return 0 ; }void cc_pm_put_suspend (struct device *dev)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/633 media: staging/intel-ipu3: css: Correctly reset some memory
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 08913a8e458e03f886a1a1154a6501fcb9344c39 ]
The intent here is to reset the whole 'scaler_coeffs_luma' array, not just the first element.
--- drivers/staging/media/ipu3/ipu3-css-params.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu3/ipu3-css-params.c +1 -1
@@ -159,7 +159,7 @@ imgu_css_scaler_calc(u32 input_width, u32 input_height, u32 target_width,memset (&cfg->scaler_coeffs_chroma,0 ,sizeof (cfg->scaler_coeffs_chroma)); -memset (&cfg->scaler_coeffs_luma,0 ,sizeof (*cfg->scaler_coeffs_luma)); +memset (&cfg->scaler_coeffs_luma,0 ,sizeof (cfg->scaler_coeffs_luma)); do { phase_step_correction++;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 116/633 media: uvcvideo: Silence shift-out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 171994e498a0426cbe17f874c5c6af3c0af45200 ]
UBSAN reports a shift-out-of-bounds warning in uvc_get_le_value(). The report is correct, but the issue should be harmless as the computed value isn't used when the shift is negative. This may however cause incorrect behaviour if a negative shift could generate adverse side effects (such as a trap on some architectures for instance).
Regardless of whether that may happen or not, silence the warning as a full WARN backtrace isn't nice.
--- drivers/media/usb/uvc/uvc_ctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +5 -1
@@ -773,12 +773,16 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, offset &=7 ; mask = ((1LL << bits) -1 ) << offset; -for (; bits >0 ; data++) { +while (1 ) {u8 byte = *data & mask; value |= offset >0 ? (byte >> offset) : (byte << (-offset)); bits -=8 - (offset >0 ? offset :0 ); +if (bits <=0 ) +break ; + offset -=8 ; mask = (1 << bits) -1 ; + data++; }/* Sign-extend the value if needed. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 115/633 media: uvcvideo: Set media controller entity functions
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit d6834b4b58d110814aaf3469e7fd87d34ae5ae81 ]
The media controller core prints a warning when an entity is registered without a function being set. This affects the uvcvideo driver, as the warning was added without first addressing the issue in existing drivers. The problem is harmless, but unnecessarily worries users. Fix it by mapping UVC entity types to MC entity functions as accurately as possible using the existing functions.
--- drivers/media/usb/uvc/uvc_entity.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/media/usb/uvc/uvc_entity.c +35 -0
@@ -73,10 +73,45 @@ static int uvc_mc_init_entity(struct uvc_video_chain *chain,int ret;if (UVC_ENTITY_TYPE (entity) !=UVC_TT_STREAMING ) { +u32 function; +v4l2_subdev_init (&entity->subdev, &uvc_subdev_ops);strscpy (entity->subdev.name, entity->name,sizeof (entity->subdev.name)); +switch (UVC_ENTITY_TYPE (entity)) { +case UVC_VC_SELECTOR_UNIT : + function =MEDIA_ENT_F_VID_MUX ; +break ; +case UVC_VC_PROCESSING_UNIT : +case UVC_VC_EXTENSION_UNIT : +/* For lack of a better option. */ + function =MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER ; +break ; +case UVC_COMPOSITE_CONNECTOR : +case UVC_COMPONENT_CONNECTOR : + function =MEDIA_ENT_F_CONN_COMPOSITE ; +break ; +case UVC_SVIDEO_CONNECTOR : + function =MEDIA_ENT_F_CONN_SVIDEO ; +break ; +case UVC_ITT_CAMERA : + function =MEDIA_ENT_F_CAM_SENSOR ; +break ; +case UVC_TT_VENDOR_SPECIFIC : +case UVC_ITT_VENDOR_SPECIFIC : +case UVC_ITT_MEDIA_TRANSPORT_INPUT : +case UVC_OTT_VENDOR_SPECIFIC : +case UVC_OTT_DISPLAY : +case UVC_OTT_MEDIA_TRANSPORT_OUTPUT : +case UVC_EXTERNAL_VENDOR_SPECIFIC : +default : + function =MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN ; +break ; + } + + entity->subdev.entity.function = function; + ret =media_entity_pads_init (&entity->subdev.entity, entity->num_pads, entity->pads);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 114/633 fscrypt: restrict IV_INO_LBLK_32 to ino_bits <= 32
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 5e895bd4d5233cb054447d0491d4e63c8496d419 ]
When an encryption policy has the IV_INO_LBLK_32 flag set, the IV generation method involves hashing the inode number. This is different from fscrypt's other IV generation methods, where the inode number is either not used at all or is included directly in the IVs.
Therefore, in principle IV_INO_LBLK_32 can work with any length inode number. However, currently fscrypt gets the inode number from inode::i_ino, which is 'unsigned long'. So currently the implementation limit is actually 32 bits (like IV_INO_LBLK_64), since longer inode numbers will have been truncated by the VFS on 32-bit platforms.
Fix fscrypt_supported_v2_policy() to enforce the correct limit.
This doesn't actually matter currently, since only ext4 and f2fs support IV_INO_LBLK_32, and they both only support 32-bit inode numbers. But we might as well fix it in case it matters in the future.
Ideally inode::i_ino would instead be made 64-bit, but for now it's not needed. (Note, this limit does *not* prevent filesystems with 64-bit inode numbers from adding fscrypt support, since IV_INO_LBLK_* support is optional and is useful only on certain hardware.)
--- fs/crypto/policy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/crypto/policy.c +7 -2
@@ -178,10 +178,15 @@ static bool fscrypt_supported_v2_policy(const struct fscrypt_policy_v2 *policy, 32, 32))return false; +/* +* IV_INO_LBLK_32 hashes the inode number, so in principle it can +* support any ino_bits. However, currently the inode number is gotten +* from inode::i_ino which is 'unsigned long'. So for now the +* implementation limit is 32 bits. +*/ if ((policy->flags &FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 ) && -/* This uses hashed inode numbers, so ino_bits doesn't matter. */ !supported_iv_ino_lblk_policy (policy, inode,"IV_INO_LBLK_32" , -INT_MAX ,32 )) +32 ,32 ))return false;if (memchr_inv (policy->__reserved,0 ,sizeof (policy->__reserved))) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 113/633 media: m5mols: Check function pointer in m5mols_sensor_power
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 52438c4463ac904d14bf3496765e67750766f3a6 ]
clang static analysis reports this error
m5mols_core.c:767:4: warning: Called function pointer
is null (null dereference) [core.CallAndMessage]
info->set_power(&client->dev, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In other places, the set_power ptr is checked.
So add a check.
--- drivers/media/i2c/m5mols/m5mols_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/m5mols/m5mols_core.c +2 -1
@@ -764,7 +764,8 @@ static int m5mols_sensor_power(struct m5mols_info *info, bool enable) ret =regulator_bulk_enable (ARRAY_SIZE (supplies), supplies);if (ret) { - info->set_power (&client->dev,0 ); +if (info->set_power) + info->set_power (&client->dev,0 );return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 112/633 media: ov5640: Correct Bit Div register in clock tree diagram
In reply to Greg Kroah-HartmanFrom: Paul Kocialkowski <[email protected]>
[ Upstream commit 4c85f628f6639e3e3e0a7788416154f28dfcae4f ]
Although the code is correct and doing the right thing, the clock diagram showed the wrong register for the bit divider, which had me doubting the understanding of the tree. Fix this to avoid doubts in the future.
--- drivers/media/i2c/ov5640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov5640.c +1 -1
@@ -751,7 +751,7 @@ static int ov5640_mod_reg(struct ov5640_dev *sensor, u16 reg,* +->| PLL Root Div | - reg 0x3037, bit 4 * +-+------------+ * | +---------+ -* +->| Bit Div | - reg 0x3035, bits 0-3 +* +->| Bit Div | - reg 0x3034, bits 0-3 * +-+-------+ * | +-------------+ * +->| SCLK Div | - reg 0x3108, bits 0-1
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 140/633 media: platform: fcp: Fix a reference count leak.
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 63e36a381d92a9cded97e90d481ee22566557dd1 ]
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/rcar-fcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/rcar-fcp.c +3 -1
@@ -103,8 +103,10 @@ int rcar_fcp_enable(struct rcar_fcp_device *fcp)return 0 ; ret =pm_runtime_get_sync (fcp->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (fcp->dev);return ret; + }return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 139/633 media: rockchip/rga: Fix a reference count leak.
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 884d638e0853c4b5f01eb6d048fc3b6239012404 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
--- drivers/media/platform/rockchip/rga/rga-buf.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/rockchip/rga/rga-buf.c +1 -0
@@ -81,6 +81,7 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count) ret =pm_runtime_get_sync (rga->dev);if (ret <0 ) { +pm_runtime_put_noidle (rga->dev);rga_buf_return_buffers (q,VB2_BUF_STATE_QUEUED );return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 110/633 media: hantro: h264: Get the correct fallback reference buffer
In reply to Greg Kroah-HartmanFrom: Ezequiel Garcia <[email protected]>
[ Upstream commit 6d9e8cd0553bb03e8ab9d4d2d7d17f3fb639bd86 ]
If the bitstream and the application are incorrectly configuring the reference pictures, the hardware will need to fallback to using some other reference picture.
When the post-processor is enabled, the fallback buffer should be a shadow buffer (postproc.dec_q), and not a CAPTURE queue buffer, since the latter is post-processed and not really the output of the decoder core.
--- drivers/staging/media/hantro/hantro_h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/hantro/hantro_h264.c +1 -1
@@ -327,7 +327,7 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx,*/ dst_buf =hantro_get_dst_buf (ctx); buf = &dst_buf->vb2_buf; - dma_addr =vb2_dma_contig_plane_dma_addr (buf,0 ); + dma_addr =hantro_get_dec_buf_addr (ctx, buf); }return dma_addr;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 128/633 spi: dw-pci: free previously allocated IRQs if desc->setup() fails
In reply to Greg Kroah-HartmanFrom: Jay Fang <[email protected]>
[ Upstream commit 9599f341889c87e56bb944659c32490d05e2532f ]
Free previously allocated IRQs when return an error code of desc->setup() which is not always successful. And simplify the code by adding a goto label.
--- drivers/spi/spi-dw-pci.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/spi/spi-dw-pci.c +9 -7
@@ -127,18 +127,16 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (desc->setup) { ret = desc->setup (dws);if (ret) -return ret; + goto err_free_irq_vectors; } }else { -pci_free_irq_vectors (pdev); -return -ENODEV ; + ret = -ENODEV ; + goto err_free_irq_vectors; } ret =dw_spi_add_host (&pdev->dev, dws); -if (ret) { -pci_free_irq_vectors (pdev); -return ret; - } +if (ret) + goto err_free_irq_vectors;/* PCI hook and SPI hook use the same drv data */ pci_set_drvdata (pdev, dws);
@@ -152,6 +150,10 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pm_runtime_allow (&pdev->dev);return 0 ; + +err_free_irq_vectors: +pci_free_irq_vectors (pdev); +return ret; }static void spi_pci_remove (struct pci_dev *pdev)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 79/633 RAS/CEC: Fix cec_init() prototype
In reply to Greg Kroah-HartmanFrom: Luca Stefani <[email protected]>
[ Upstream commit 85e6084e0b436cabe9c909e679937998ffbf9c9d ]
late_initcall() expects a function that returns an integer. Update the function signature to match.
[ bp: Massage commit message into proper sentences. ]
--- drivers/ras/cec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/ras/cec.c +5 -4
@@ -553,20 +553,20 @@ static struct notifier_block cec_nb = { .priority = MCE_PRIO_CEC, }; -static void __init cec_init (void ) +static int __init cec_init (void ) {if (ce_arr.disabled) -return ; +return -ENODEV ; ce_arr.array = (void *)get_zeroed_page (GFP_KERNEL );if (!ce_arr.array) {pr_err ("Error allocating CE array page!\n" ); -return ; +return -ENOMEM ; }if (create_debugfs_nodes ()) {free_page ((unsigned long )ce_arr.array); -return ; +return -ENOMEM ; }INIT_DELAYED_WORK (&cec_work, cec_work_fn);
@@ -575,6 +575,7 @@ static void __init cec_init(void)mce_register_decode_chain (&cec_nb);pr_info ("Correctable Errors collector initialized.\n" ); +return 0 ; }late_initcall (cec_init);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 106/633 media: vivid: Fix global-out-of-bounds read in precalculate_color()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit e3158a5e7e661786b3ab650c7e4d21024e8eff0f ]
vivid_meta_out_process() is setting brightness, contrast, saturation and hue using tpg_s_*(). This is wrong, since tpg_s_*() do not provide range checks. Using tpg_s_*() here also makes the control framework out-of-sync with the actual values. Use v4l2_ctrl_s_ctrl() instead.
This issue has been reported by syzbot as an out-of-bounds read bug in precalculate_color().
--- drivers/media/test-drivers/vivid/vivid-meta-out.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/test-drivers/vivid/vivid-meta-out.c +5 -4
@@ -164,10 +164,11 @@ void vivid_meta_out_process(struct vivid_dev *dev, {struct vivid_meta_out_buf *meta =vb2_plane_vaddr (&buf->vb.vb2_buf,0 ); -tpg_s_brightness (&dev->tpg, meta->brightness); -tpg_s_contrast (&dev->tpg, meta->contrast); -tpg_s_saturation (&dev->tpg, meta->saturation); -tpg_s_hue (&dev->tpg, meta->hue); +v4l2_ctrl_s_ctrl (dev->brightness, meta->brightness); +v4l2_ctrl_s_ctrl (dev->contrast, meta->contrast); +v4l2_ctrl_s_ctrl (dev->saturation, meta->saturation); +v4l2_ctrl_s_ctrl (dev->hue, meta->hue); +dprintk (dev,2 ," %s brightness %u contrast %u saturation %u hue %d\n" , __func__, meta->brightness, meta->contrast, meta->saturation, meta->hue);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 118/633 media: omap3isp: Fix memleak in isp_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d8fc21c17099635e8ebd986d042be65a6c6b5bd0 ]
When devm_ioremap_resource() fails, isp should be
freed just like other error paths in isp_probe.
--- drivers/media/platform/omap3isp/isp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/omap3isp/isp.c +4 -2
@@ -2328,8 +2328,10 @@ static int isp_probe(struct platform_device *pdev) mem =platform_get_resource (pdev,IORESOURCE_MEM , i); isp->mmio_base[map_idx] =devm_ioremap_resource (isp->dev, mem); -if (IS_ERR (isp->mmio_base[map_idx])) -return PTR_ERR (isp->mmio_base[map_idx]); +if (IS_ERR (isp->mmio_base[map_idx])) { + ret =PTR_ERR (isp->mmio_base[map_idx]); + goto error; + } } ret =isp_get_clocks (isp);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 78/633 crypto: caam/qi - add support for more XTS key lengths
In reply to Greg Kroah-HartmanFrom: Andrei Botila <[email protected]>
commit 62b9a6690926ee199445b23fd46e6349d9057146 upstream.
CAAM accelerator only supports XTS-AES-128 and XTS-AES-256 since it adheres strictly to the standard. All the other key lengths are accepted and processed through a fallback as long as they pass the xts_verify_key() checks.
--- drivers/crypto/caam/caamalg_qi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/crypto/caam/caamalg_qi.c +10 -3
@@ -18,6 +18,7 @@#include "qi.h" #include "jr.h" #include "caamalg_desc.h" +#include <crypto/xts.h> #include <asm/unaligned.h> /*
@@ -68,6 +69,7 @@ struct caam_ctx {struct device *qidev;spinlock_t lock;/* Protects multiple init of driver context */ struct caam_drv_ctx *drv_ctx[NUM_OP ]; +bool xts_key_fallback;struct crypto_skcipher *fallback; };
@@ -734,11 +736,15 @@ static int xts_skcipher_setkey(struct crint ret =0 ;int err; -if (keylen !=2 *AES_MIN_KEY_SIZE && keylen !=2 *AES_MAX_KEY_SIZE ) { + err =xts_verify_key (skcipher, key, keylen); +if (err) {dev_dbg (jrdev,"key size mismatch\n" ); -return -EINVAL ; +return err; } +if (keylen !=2 *AES_KEYSIZE_128 && keylen !=2 *AES_KEYSIZE_256 ) + ctx->xts_key_fallback = true; + err =crypto_skcipher_setkey (ctx->fallback, key, keylen);if (err)return err;
@@ -1402,7 +1408,8 @@ static inline int skcipher_crypt(structif (!req->cryptlen)return 0 ; -if (ctx->fallback &&xts_skcipher_ivsize (req)) { +if (ctx->fallback && (xts_skcipher_ivsize (req) || + ctx->xts_key_fallback)) {struct caam_skcipher_req_ctx *rctx =skcipher_request_ctx (req);skcipher_request_set_tfm (&rctx->fallback_req, ctx->fallback);
Greg Kroah-Hartman
maintainerPATCH 132/633 cypto: mediatek - fix leaks in mtk_desc_ring_alloc
In reply to Greg Kroah-HartmanFrom: Xiaoliang Pang <[email protected]>
[ Upstream commit 228d284aac61283cde508a925d666f854b57af63 ]
In the init loop, if an error occurs in function 'dma_alloc_coherent', then goto the err_cleanup section, after run i--,
in the array ring, the struct mtk_ring with index i will not be released, causing memory leaks
--- drivers/crypto/mediatek/mtk-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/mediatek/mtk-platform.c +2 -2
@@ -469,13 +469,13 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)return 0 ; err_cleanup: -for (; i--; ) { +do {dma_free_coherent (cryp->dev,MTK_DESC_RING_SZ , ring[i]->res_base, ring[i]->res_dma);dma_free_coherent (cryp->dev,MTK_DESC_RING_SZ , ring[i]->cmd_base, ring[i]->cmd_dma);kfree (ring[i]); - } + }while (i--);return -ENOMEM ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 131/633 hwmon: (w83627ehf) Fix a resource leak in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 18360b33a071e5883250fd1e04bfdeff8c3887a3 ]
Smatch has a new check for resource leaks which found a bug in probe:
drivers/hwmon/w83627ehf.c:2417 w83627ehf_probe()
warn: 'res->start' not released on lines: 2412.We need to clean up if devm_hwmon_device_register_with_info() fails.
--- drivers/hwmon/w83627ehf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/w83627ehf.c +5 -1
@@ -1951,8 +1951,12 @@ static int w83627ehf_probe(struct platform_device *pdev) data, &w83627ehf_chip_info, w83627ehf_groups); +if (IS_ERR (hwmon_dev)) { + err =PTR_ERR (hwmon_dev); + goto exit_release; + } -return PTR_ERR_OR_ZERO (hwmon_dev); +return 0 ; exit_release:release_region (res->start,IOREGION_LENGTH );
Signature · 1 line
2.25.1