From: Greg Kroah-Hartman Date: Mon, 27 Jun 2022 10:45:23 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.202~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0f9c6f92f771560ec84d65fcec5cb87d8c0748c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch arm-dts-imx6qdl-correct-pu-regulator-ramp-delay.patch arm-dts-imx7-move-hsic_phy-power-domain-to-hsic-phy-node.patch arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch arm-fix-refcount-leak-in-axxia_boot_secondary.patch kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch modpost-fix-section-mismatch-check-for-exported-init-exit-sections.patch random-update-comment-from-copy_to_user-copy_to_iter.patch soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch --- diff --git a/queue-5.10/arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch b/queue-5.10/arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch new file mode 100644 index 00000000000..45203eaf3b6 --- /dev/null +++ b/queue-5.10/arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch @@ -0,0 +1,40 @@ +From 1ba904b6b16e08de5aed7c1349838d9cd0d178c5 Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Sun, 5 Jun 2022 11:58:41 +0400 +Subject: ARM: cns3xxx: Fix refcount leak in cns3xxx_init + +From: Miaoqian Lin + +commit 1ba904b6b16e08de5aed7c1349838d9cd0d178c5 upstream. + +of_find_compatible_node() returns a node pointer with refcount +incremented, we should use of_node_put() on it when done. +Add missing of_node_put() to avoid refcount leak. + +Fixes: 415f59142d9d ("ARM: cns3xxx: initial DT support") +Signed-off-by: Miaoqian Lin +Acked-by: Krzysztof Halasa +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/mach-cns3xxx/core.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm/mach-cns3xxx/core.c ++++ b/arch/arm/mach-cns3xxx/core.c +@@ -372,6 +372,7 @@ static void __init cns3xxx_init(void) + /* De-Asscer SATA Reset */ + cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SATA)); + } ++ of_node_put(dn); + + dn = of_find_compatible_node(NULL, NULL, "cavium,cns3420-sdhci"); + if (of_device_is_available(dn)) { +@@ -385,6 +386,7 @@ static void __init cns3xxx_init(void) + cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO)); + cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO)); + } ++ of_node_put(dn); + + pm_power_off = cns3xxx_power_off; + diff --git a/queue-5.10/arm-dts-imx6qdl-correct-pu-regulator-ramp-delay.patch b/queue-5.10/arm-dts-imx6qdl-correct-pu-regulator-ramp-delay.patch new file mode 100644 index 00000000000..94a56431e0f --- /dev/null +++ b/queue-5.10/arm-dts-imx6qdl-correct-pu-regulator-ramp-delay.patch @@ -0,0 +1,47 @@ +From 93a8ba2a619816d631bd69e9ce2172b4d7a481b8 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Wed, 11 May 2022 18:08:23 +0200 +Subject: ARM: dts: imx6qdl: correct PU regulator ramp delay + +From: Lucas Stach + +commit 93a8ba2a619816d631bd69e9ce2172b4d7a481b8 upstream. + +Contrary to what was believed at the time, the ramp delay of 150us is not +plenty for the PU LDO with the default step time of 512 pulses of the 24MHz +clock. Measurements have shown that after enabling the LDO the voltage on +VDDPU_CAP jumps to ~750mV in the first step and after that the regulator +executes the normal ramp up as defined by the step size control. + +This means it takes the regulator between 360us and 370us to ramp up to +the nominal 1.15V voltage for this power domain. With the old setting of +the ramp delay the power up of the PU GPC domain would happen in the middle +of the regulator ramp with the voltage being at around 900mV. Apparently +this was enough for most units to properly power up the peripherals in the +domain and execute the reset. Some units however, fail to power up properly, +especially when the chip is at a low temperature. In that case any access +to the GPU registers would yield an incorrect result with no way to recover +from this situation. + +Change the ramp delay to 380us to cover the measured ramp up time with a +bit of additional slack. + +Fixes: 40130d327f72 ("ARM: dts: imx6qdl: Allow disabling the PU regulator, add a enable ramp delay") +Signed-off-by: Lucas Stach +Signed-off-by: Shawn Guo +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/imx6qdl.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/imx6qdl.dtsi ++++ b/arch/arm/boot/dts/imx6qdl.dtsi +@@ -756,7 +756,7 @@ + regulator-name = "vddpu"; + regulator-min-microvolt = <725000>; + regulator-max-microvolt = <1450000>; +- regulator-enable-ramp-delay = <150>; ++ regulator-enable-ramp-delay = <380>; + anatop-reg-offset = <0x140>; + anatop-vol-bit-shift = <9>; + anatop-vol-bit-width = <5>; diff --git a/queue-5.10/arm-dts-imx7-move-hsic_phy-power-domain-to-hsic-phy-node.patch b/queue-5.10/arm-dts-imx7-move-hsic_phy-power-domain-to-hsic-phy-node.patch new file mode 100644 index 00000000000..6a343d2f484 --- /dev/null +++ b/queue-5.10/arm-dts-imx7-move-hsic_phy-power-domain-to-hsic-phy-node.patch @@ -0,0 +1,41 @@ +From 552ca27929ab28b341ae9b2629f0de3a84c98ee8 Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Tue, 10 May 2022 07:46:12 +0200 +Subject: ARM: dts: imx7: Move hsic_phy power domain to HSIC PHY node + +From: Alexander Stein + +commit 552ca27929ab28b341ae9b2629f0de3a84c98ee8 upstream. + +Move the power domain to its actual user. This keeps the power domain +enabled even when the USB host is runtime suspended. This is necessary +to detect any downstream events, like device attach. + +Fixes: 02f8eb40ef7b ("ARM: dts: imx7s: Add power domain for imx7d HSIC") +Suggested-by: Jun Li +Signed-off-by: Alexander Stein +Reviewed-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/imx7s.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/imx7s.dtsi ++++ b/arch/arm/boot/dts/imx7s.dtsi +@@ -102,6 +102,7 @@ + compatible = "usb-nop-xceiv"; + clocks = <&clks IMX7D_USB_HSIC_ROOT_CLK>; + clock-names = "main_clk"; ++ power-domains = <&pgc_hsic_phy>; + #phy-cells = <0>; + }; + +@@ -1104,7 +1105,6 @@ + compatible = "fsl,imx7d-usb", "fsl,imx27-usb"; + reg = <0x30b30000 0x200>; + interrupts = ; +- power-domains = <&pgc_hsic_phy>; + clocks = <&clks IMX7D_USB_CTRL_CLK>; + fsl,usbphy = <&usbphynop3>; + fsl,usbmisc = <&usbmisc3 0>; diff --git a/queue-5.10/arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch b/queue-5.10/arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch new file mode 100644 index 00000000000..ca6a5bf9c61 --- /dev/null +++ b/queue-5.10/arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch @@ -0,0 +1,33 @@ +From c4c79525042a4a7df96b73477feaf232fe44ae81 Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Mon, 23 May 2022 18:55:13 +0400 +Subject: ARM: exynos: Fix refcount leak in exynos_map_pmu + +From: Miaoqian Lin + +commit c4c79525042a4a7df96b73477feaf232fe44ae81 upstream. + +of_find_matching_node() returns a node pointer with refcount +incremented, we should use of_node_put() on it when not need anymore. +Add missing of_node_put() to avoid refcount leak. +of_node_put() checks null pointer. + +Fixes: fce9e5bb2526 ("ARM: EXYNOS: Add support for mapping PMU base address via DT") +Signed-off-by: Miaoqian Lin +Link: https://lore.kernel.org/r/20220523145513.12341-1-linmq006@gmail.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/mach-exynos/exynos.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm/mach-exynos/exynos.c ++++ b/arch/arm/mach-exynos/exynos.c +@@ -149,6 +149,7 @@ static void exynos_map_pmu(void) + np = of_find_matching_node(NULL, exynos_dt_pmu_match); + if (np) + pmu_base_addr = of_iomap(np, 0); ++ of_node_put(np); + } + + static void __init exynos_init_irq(void) diff --git a/queue-5.10/arm-fix-refcount-leak-in-axxia_boot_secondary.patch b/queue-5.10/arm-fix-refcount-leak-in-axxia_boot_secondary.patch new file mode 100644 index 00000000000..02c195e86aa --- /dev/null +++ b/queue-5.10/arm-fix-refcount-leak-in-axxia_boot_secondary.patch @@ -0,0 +1,32 @@ +From 7c7ff68daa93d8c4cdea482da4f2429c0398fcde Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Wed, 1 Jun 2022 13:05:48 +0400 +Subject: ARM: Fix refcount leak in axxia_boot_secondary + +From: Miaoqian Lin + +commit 7c7ff68daa93d8c4cdea482da4f2429c0398fcde upstream. + +of_find_compatible_node() returns a node pointer with refcount +incremented, we should use of_node_put() on it when done. +Add missing of_node_put() to avoid refcount leak. + +Fixes: 1d22924e1c4e ("ARM: Add platform support for LSI AXM55xx SoC") +Signed-off-by: Miaoqian Lin +Link: https://lore.kernel.org/r/20220601090548.47616-1-linmq006@gmail.com' +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/mach-axxia/platsmp.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm/mach-axxia/platsmp.c ++++ b/arch/arm/mach-axxia/platsmp.c +@@ -39,6 +39,7 @@ static int axxia_boot_secondary(unsigned + return -ENOENT; + + syscon = of_iomap(syscon_np, 0); ++ of_node_put(syscon_np); + if (!syscon) + return -ENOMEM; + diff --git a/queue-5.10/kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch b/queue-5.10/kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch new file mode 100644 index 00000000000..ad8cbc0e094 --- /dev/null +++ b/queue-5.10/kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch @@ -0,0 +1,49 @@ +From 53632ba87d9f302a8d97a11ec2f4f4eec7bb75ea Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Fri, 24 Jun 2022 04:11:47 +0900 +Subject: kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS (2nd attempt) + +From: Masahiro Yamada + +commit 53632ba87d9f302a8d97a11ec2f4f4eec7bb75ea upstream. + +If CONFIG_TRIM_UNUSED_KSYMS is enabled and the kernel is built from +a pristine state, the vmlinux is linked twice. + +Commit 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for +CONFIG_TRIM_UNUSED_KSYMS") explains why this happens, but it did not fix +the issue at all. + +Now I realized I had applied a wrong patch. + +In v1 patch [1], the autoksyms_recursive target correctly recurses to +"$(MAKE) -f $(srctree)/Makefile autoksyms_recursive". + +In v2 patch [2], I accidentally dropped the diff line, and it recurses to +"$(MAKE) -f $(srctree)/Makefile vmlinux". + +Restore the code I intended in v1. + +[1]: https://lore.kernel.org/linux-kbuild/1521045861-22418-8-git-send-email-yamada.masahiro@socionext.com/ +[2]: https://lore.kernel.org/linux-kbuild/1521166725-24157-8-git-send-email-yamada.masahiro@socionext.com/ + +Fixes: 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS") +Signed-off-by: Masahiro Yamada +Tested-by: Sami Tolvanen +Reviewed-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/Makefile ++++ b/Makefile +@@ -1156,7 +1156,7 @@ KBUILD_MODULES := 1 + + autoksyms_recursive: descend modules.order + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ +- "$(MAKE) -f $(srctree)/Makefile vmlinux" ++ "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive" + endif + + autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) diff --git a/queue-5.10/memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch b/queue-5.10/memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch new file mode 100644 index 00000000000..da3ceb9ec4a --- /dev/null +++ b/queue-5.10/memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch @@ -0,0 +1,92 @@ +From 1332661e09304b7b8e84e5edc11811ba08d12abe Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Thu, 2 Jun 2022 08:17:21 +0400 +Subject: memory: samsung: exynos5422-dmc: Fix refcount leak in of_get_dram_timings + +From: Miaoqian Lin + +commit 1332661e09304b7b8e84e5edc11811ba08d12abe upstream. + +of_parse_phandle() returns a node pointer with refcount +incremented, we should use of_node_put() on it when not need anymore. +This function doesn't call of_node_put() in some error paths. +To unify the structure, Add put_node label and goto it on errors. + +Fixes: 6e7674c3c6df ("memory: Add DMC driver for Exynos5422") +Signed-off-by: Miaoqian Lin +Reviewed-by: Lukasz Luba +Link: https://lore.kernel.org/r/20220602041721.64348-1-linmq006@gmail.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/memory/samsung/exynos5422-dmc.c | 29 ++++++++++++++++++----------- + 1 file changed, 18 insertions(+), 11 deletions(-) + +--- a/drivers/memory/samsung/exynos5422-dmc.c ++++ b/drivers/memory/samsung/exynos5422-dmc.c +@@ -1192,33 +1192,39 @@ static int of_get_dram_timings(struct ex + + dmc->timing_row = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + sizeof(u32), GFP_KERNEL); +- if (!dmc->timing_row) +- return -ENOMEM; ++ if (!dmc->timing_row) { ++ ret = -ENOMEM; ++ goto put_node; ++ } + + dmc->timing_data = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + sizeof(u32), GFP_KERNEL); +- if (!dmc->timing_data) +- return -ENOMEM; ++ if (!dmc->timing_data) { ++ ret = -ENOMEM; ++ goto put_node; ++ } + + dmc->timing_power = devm_kmalloc_array(dmc->dev, TIMING_COUNT, + sizeof(u32), GFP_KERNEL); +- if (!dmc->timing_power) +- return -ENOMEM; ++ if (!dmc->timing_power) { ++ ret = -ENOMEM; ++ goto put_node; ++ } + + dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dmc->dev, + DDR_TYPE_LPDDR3, + &dmc->timings_arr_size); + if (!dmc->timings) { +- of_node_put(np_ddr); + dev_warn(dmc->dev, "could not get timings from DT\n"); +- return -EINVAL; ++ ret = -EINVAL; ++ goto put_node; + } + + dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dmc->dev); + if (!dmc->min_tck) { +- of_node_put(np_ddr); + dev_warn(dmc->dev, "could not get tck from DT\n"); +- return -EINVAL; ++ ret = -EINVAL; ++ goto put_node; + } + + /* Sorted array of OPPs with frequency ascending */ +@@ -1232,13 +1238,14 @@ static int of_get_dram_timings(struct ex + clk_period_ps); + } + +- of_node_put(np_ddr); + + /* Take the highest frequency's timings as 'bypass' */ + dmc->bypass_timing_row = dmc->timing_row[idx - 1]; + dmc->bypass_timing_data = dmc->timing_data[idx - 1]; + dmc->bypass_timing_power = dmc->timing_power[idx - 1]; + ++put_node: ++ of_node_put(np_ddr); + return ret; + } + diff --git a/queue-5.10/modpost-fix-section-mismatch-check-for-exported-init-exit-sections.patch b/queue-5.10/modpost-fix-section-mismatch-check-for-exported-init-exit-sections.patch new file mode 100644 index 00000000000..8391a08d9f5 --- /dev/null +++ b/queue-5.10/modpost-fix-section-mismatch-check-for-exported-init-exit-sections.patch @@ -0,0 +1,37 @@ +From 28438794aba47a27e922857d27b31b74e8559143 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Sat, 11 Jun 2022 03:32:30 +0900 +Subject: modpost: fix section mismatch check for exported init/exit sections + +From: Masahiro Yamada + +commit 28438794aba47a27e922857d27b31b74e8559143 upstream. + +Since commit f02e8a6596b7 ("module: Sort exported symbols"), +EXPORT_SYMBOL* is placed in the individual section ___ksymtab(_gpl)+ +(3 leading underscores instead of 2). + +Since then, modpost cannot detect the bad combination of EXPORT_SYMBOL +and __init/__exit. + +Fix the .fromsec field. + +Fixes: f02e8a6596b7 ("module: Sort exported symbols") +Signed-off-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + scripts/mod/modpost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -1119,7 +1119,7 @@ static const struct sectioncheck section + }, + /* Do not export init/exit functions or data */ + { +- .fromsec = { "__ksymtab*", NULL }, ++ .fromsec = { "___ksymtab*", NULL }, + .bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, + .mismatch = EXPORT_TO_INIT_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, diff --git a/queue-5.10/random-update-comment-from-copy_to_user-copy_to_iter.patch b/queue-5.10/random-update-comment-from-copy_to_user-copy_to_iter.patch new file mode 100644 index 00000000000..47ba8088119 --- /dev/null +++ b/queue-5.10/random-update-comment-from-copy_to_user-copy_to_iter.patch @@ -0,0 +1,30 @@ +From 63b8ea5e4f1a87dea4d3114293fc8e96a8f193d7 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 20 Jun 2022 11:03:48 +0200 +Subject: random: update comment from copy_to_user() -> copy_to_iter() + +From: Jason A. Donenfeld + +commit 63b8ea5e4f1a87dea4d3114293fc8e96a8f193d7 upstream. + +This comment wasn't updated when we moved from read() to read_iter(), so +this patch makes the trivial fix. + +Fixes: 1b388e7765f2 ("random: convert to using fops->read_iter()") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -452,7 +452,7 @@ static ssize_t get_random_bytes_user(str + + /* + * Immediately overwrite the ChaCha key at index 4 with random +- * bytes, in case userspace causes copy_to_user() below to sleep ++ * bytes, in case userspace causes copy_to_iter() below to sleep + * forever, so that we still retain forward secrecy in that case. + */ + crng_make_state(chacha_state, (u8 *)&chacha_state[4], CHACHA_KEY_SIZE); diff --git a/queue-5.10/series b/queue-5.10/series index 742734c65ec..bcf3c68234d 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -89,3 +89,13 @@ parisc-enable-arch_has_strict_module_rwx.patch powerpc-enable-execve-syscall-exit-tracepoint.patch powerpc-rtas-allow-ibm-platform-dump-rtas-call-with-null-buffer-address.patch powerpc-powernv-wire-up-rng-during-setup_arch.patch +arm-dts-imx7-move-hsic_phy-power-domain-to-hsic-phy-node.patch +arm-dts-imx6qdl-correct-pu-regulator-ramp-delay.patch +arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch +soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch +arm-fix-refcount-leak-in-axxia_boot_secondary.patch +memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch +arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch +modpost-fix-section-mismatch-check-for-exported-init-exit-sections.patch +random-update-comment-from-copy_to_user-copy_to_iter.patch +kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch diff --git a/queue-5.10/soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch b/queue-5.10/soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch new file mode 100644 index 00000000000..426af0225fd --- /dev/null +++ b/queue-5.10/soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch @@ -0,0 +1,37 @@ +From 37d838de369b07b596c19ff3662bf0293fdb09ee Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Thu, 26 May 2022 11:53:22 +0400 +Subject: soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe + +From: Miaoqian Lin + +commit 37d838de369b07b596c19ff3662bf0293fdb09ee upstream. + +of_find_matching_node() returns a node pointer with refcount +incremented, we should use of_node_put() on it when not need anymore. +Add missing of_node_put() to avoid refcount leak. + +In brcmstb_init_sram, it pass dn to of_address_to_resource(), +of_address_to_resource() will call of_find_device_by_node() to take +reference, so we should release the reference returned by +of_find_matching_node(). + +Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)") +Signed-off-by: Miaoqian Lin +Reviewed-by: Andy Shevchenko +Signed-off-by: Florian Fainelli +Signed-off-by: Greg Kroah-Hartman +--- + drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c ++++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c +@@ -780,6 +780,7 @@ static int brcmstb_pm_probe(struct platf + } + + ret = brcmstb_init_sram(dn); ++ of_node_put(dn); + if (ret) { + pr_err("error setting up SRAM for PM\n"); + return ret;