From: Greg Kroah-Hartman Date: Mon, 27 Jun 2022 09:51:14 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.202~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61e45401aedfa57e873f51986d34f8734f83ea04;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch iio-adc-axp288-override-ts-pin-bias-current-for-some-models.patch parisc-enable-arch_has_strict_module_rwx.patch parisc-stifb-fix-fb_is_primary_device-only-available-with-config_fb_sti.patch powerpc-enable-execve-syscall-exit-tracepoint.patch powerpc-powernv-wire-up-rng-during-setup_arch.patch powerpc-rtas-allow-ibm-platform-dump-rtas-call-with-null-buffer-address.patch xtensa-fix-refcount-leak-bug-in-time.c.patch xtensa-xtfpga-fix-refcount-leak-bug-in-setup.patch --- diff --git a/queue-5.10/iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch b/queue-5.10/iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch new file mode 100644 index 00000000000..b9c07a58baa --- /dev/null +++ b/queue-5.10/iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch @@ -0,0 +1,45 @@ +From ada7b0c0dedafd7d059115adf49e48acba3153a8 Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Tue, 24 May 2022 11:45:17 +0400 +Subject: iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client + +From: Miaoqian Lin + +commit ada7b0c0dedafd7d059115adf49e48acba3153a8 upstream. + +of_parse_phandle() 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. + +Fixes: ef04070692a2 ("iio: adc: adi-axi-adc: add support for AXI ADC IP core") +Signed-off-by: Miaoqian Lin +Link: https://lore.kernel.org/r/20220524074517.45268-1-linmq006@gmail.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/adi-axi-adc.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/iio/adc/adi-axi-adc.c ++++ b/drivers/iio/adc/adi-axi-adc.c +@@ -334,16 +334,19 @@ static struct adi_axi_adc_client *adi_ax + + if (!try_module_get(cl->dev->driver->owner)) { + mutex_unlock(®istered_clients_lock); ++ of_node_put(cln); + return ERR_PTR(-ENODEV); + } + + get_device(cl->dev); + cl->info = info; + mutex_unlock(®istered_clients_lock); ++ of_node_put(cln); + return cl; + } + + mutex_unlock(®istered_clients_lock); ++ of_node_put(cln); + + return ERR_PTR(-EPROBE_DEFER); + } diff --git a/queue-5.10/iio-adc-axp288-override-ts-pin-bias-current-for-some-models.patch b/queue-5.10/iio-adc-axp288-override-ts-pin-bias-current-for-some-models.patch new file mode 100644 index 00000000000..a559cda68a1 --- /dev/null +++ b/queue-5.10/iio-adc-axp288-override-ts-pin-bias-current-for-some-models.patch @@ -0,0 +1,51 @@ +From 048058399f19d43cf21de9f5d36cd8144337d004 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 6 May 2022 11:50:40 +0200 +Subject: iio: adc: axp288: Override TS pin bias current for some models +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Hans de Goede + +commit 048058399f19d43cf21de9f5d36cd8144337d004 upstream. + +Since commit 9bcf15f75cac ("iio: adc: axp288: Fix TS-pin handling") we +preserve the bias current set by the firmware at boot. This fixes issues +we were seeing on various models. + +Some models like the Nuvision Solo 10 Draw tablet actually need the +old hardcoded 80ųA bias current for battery temperature monitoring +to work properly. + +Add a quirk entry for the Nuvision Solo 10 Draw to the DMI quirk table +to restore setting the bias current to 80ųA on this model. + +Fixes: 9bcf15f75cac ("iio: adc: axp288: Fix TS-pin handling") +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215882 +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20220506095040.21008-1-hdegoede@redhat.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/axp288_adc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/iio/adc/axp288_adc.c ++++ b/drivers/iio/adc/axp288_adc.c +@@ -196,6 +196,14 @@ static const struct dmi_system_id axp288 + }, + .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, + }, ++ { ++ /* Nuvision Solo 10 Draw */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TMAX"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "TM101W610L"), ++ }, ++ .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, ++ }, + {} + }; + diff --git a/queue-5.10/parisc-enable-arch_has_strict_module_rwx.patch b/queue-5.10/parisc-enable-arch_has_strict_module_rwx.patch new file mode 100644 index 00000000000..183a8aff216 --- /dev/null +++ b/queue-5.10/parisc-enable-arch_has_strict_module_rwx.patch @@ -0,0 +1,32 @@ +From 0a1355db36718178becd2bfe728a023933d73123 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Sun, 26 Jun 2022 11:50:43 +0200 +Subject: parisc: Enable ARCH_HAS_STRICT_MODULE_RWX + +From: Helge Deller + +commit 0a1355db36718178becd2bfe728a023933d73123 upstream. + +Fix a boot crash on a c8000 machine as reported by Dave. Basically it changes +patch_map() to return an alias mapping to the to-be-patched code in order to +prevent writing to write-protected memory. + +Signed-off-by: Helge Deller +Suggested-by: John David Anglin +Cc: stable@vger.kernel.org # v5.2+ +Link: https://lore.kernel.org/all/e8ec39e8-25f8-e6b4-b7ed-4cb23efc756e@bell.net/ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/parisc/Kconfig ++++ b/arch/parisc/Kconfig +@@ -11,6 +11,7 @@ config PARISC + select ARCH_WANT_FRAME_POINTERS + select ARCH_HAS_ELF_RANDOMIZE + select ARCH_HAS_STRICT_KERNEL_RWX ++ select ARCH_HAS_STRICT_MODULE_RWX + select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_NO_SG_CHAIN + select ARCH_SUPPORTS_MEMORY_FAILURE diff --git a/queue-5.10/parisc-stifb-fix-fb_is_primary_device-only-available-with-config_fb_sti.patch b/queue-5.10/parisc-stifb-fix-fb_is_primary_device-only-available-with-config_fb_sti.patch new file mode 100644 index 00000000000..4d3333a2ff4 --- /dev/null +++ b/queue-5.10/parisc-stifb-fix-fb_is_primary_device-only-available-with-config_fb_sti.patch @@ -0,0 +1,52 @@ +From 1d0811b03eb30b2f0793acaa96c6ce90b8b9c87a Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Tue, 7 Jun 2022 12:57:58 +0200 +Subject: parisc/stifb: Fix fb_is_primary_device() only available with CONFIG_FB_STI + +From: Helge Deller + +commit 1d0811b03eb30b2f0793acaa96c6ce90b8b9c87a upstream. + +Fix this build error noticed by the kernel test robot: + +drivers/video/console/sticore.c:1132:5: error: redefinition of 'fb_is_primary_device' + arch/parisc/include/asm/fb.h:18:19: note: previous definition of 'fb_is_primary_device' + +Signed-off-by: Helge Deller +Reported-by: kernel test robot +Cc: stable@vger.kernel.org # v5.10+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/include/asm/fb.h | 2 +- + drivers/video/console/sticore.c | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/parisc/include/asm/fb.h ++++ b/arch/parisc/include/asm/fb.h +@@ -12,7 +12,7 @@ static inline void fb_pgprotect(struct f + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; + } + +-#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI) ++#if defined(CONFIG_FB_STI) + int fb_is_primary_device(struct fb_info *info); + #else + static inline int fb_is_primary_device(struct fb_info *info) +--- a/drivers/video/console/sticore.c ++++ b/drivers/video/console/sticore.c +@@ -1127,6 +1127,7 @@ int sti_call(const struct sti_struct *st + return ret; + } + ++#if defined(CONFIG_FB_STI) + /* check if given fb_info is the primary device */ + int fb_is_primary_device(struct fb_info *info) + { +@@ -1142,6 +1143,7 @@ int fb_is_primary_device(struct fb_info + return (sti->info == info); + } + EXPORT_SYMBOL(fb_is_primary_device); ++#endif + + MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); + MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); diff --git a/queue-5.10/powerpc-enable-execve-syscall-exit-tracepoint.patch b/queue-5.10/powerpc-enable-execve-syscall-exit-tracepoint.patch new file mode 100644 index 00000000000..9f566b62224 --- /dev/null +++ b/queue-5.10/powerpc-enable-execve-syscall-exit-tracepoint.patch @@ -0,0 +1,58 @@ +From ec6d0dde71d760aa60316f8d1c9a1b0d99213529 Mon Sep 17 00:00:00 2001 +From: "Naveen N. Rao" +Date: Thu, 9 Jun 2022 16:03:28 +0530 +Subject: powerpc: Enable execve syscall exit tracepoint + +From: Naveen N. Rao + +commit ec6d0dde71d760aa60316f8d1c9a1b0d99213529 upstream. + +On execve[at], we are zero'ing out most of the thread register state +including gpr[0], which contains the syscall number. Due to this, we +fail to trigger the syscall exit tracepoint properly. Fix this by +retaining gpr[0] in the thread register state. + +Before this patch: + # tail /sys/kernel/debug/tracing/trace + cat-123 [000] ..... 61.449351: sys_execve(filename: + 7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8) + cat-124 [000] ..... 62.428481: sys_execve(filename: + 7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8) + echo-125 [000] ..... 65.813702: sys_execve(filename: + 7fffa6b23378, argv: 7fffa6b233a0, envp: 7fffa6b233b0) + echo-125 [000] ..... 65.822214: sys_execveat(fd: 0, + filename: 1009ac48, argv: 7ffff65d0c98, envp: 7ffff65d0ca8, flags: 0) + +After this patch: + # tail /sys/kernel/debug/tracing/trace + cat-127 [000] ..... 100.416262: sys_execve(filename: + 7fffa41b3448, argv: 7fffa41b33e0, envp: 7fffa41b33f8) + cat-127 [000] ..... 100.418203: sys_execve -> 0x0 + echo-128 [000] ..... 103.873968: sys_execve(filename: + 7fffa41b3378, argv: 7fffa41b33a0, envp: 7fffa41b33b0) + echo-128 [000] ..... 103.875102: sys_execve -> 0x0 + echo-128 [000] ..... 103.882097: sys_execveat(fd: 0, + filename: 1009ac48, argv: 7fffd10d2148, envp: 7fffd10d2158, flags: 0) + echo-128 [000] ..... 103.883225: sys_execveat -> 0x0 + +Cc: stable@vger.kernel.org +Signed-off-by: Naveen N. Rao +Tested-by: Sumit Dubey2 +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220609103328.41306-1-naveen.n.rao@linux.vnet.ibm.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/kernel/process.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/powerpc/kernel/process.c ++++ b/arch/powerpc/kernel/process.c +@@ -1800,7 +1800,7 @@ void start_thread(struct pt_regs *regs, + tm_reclaim_current(0); + #endif + +- memset(regs->gpr, 0, sizeof(regs->gpr)); ++ memset(®s->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0])); + regs->ctr = 0; + regs->link = 0; + regs->xer = 0; diff --git a/queue-5.10/powerpc-powernv-wire-up-rng-during-setup_arch.patch b/queue-5.10/powerpc-powernv-wire-up-rng-during-setup_arch.patch new file mode 100644 index 00000000000..b0a29cfde4a --- /dev/null +++ b/queue-5.10/powerpc-powernv-wire-up-rng-during-setup_arch.patch @@ -0,0 +1,148 @@ +From f3eac426657d985b97c92fa5f7ae1d43f04721f3 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Tue, 21 Jun 2022 16:08:49 +0200 +Subject: powerpc/powernv: wire up rng during setup_arch + +From: Jason A. Donenfeld + +commit f3eac426657d985b97c92fa5f7ae1d43f04721f3 upstream. + +The platform's RNG must be available before random_init() in order to be +useful for initial seeding, which in turn means that it needs to be +called from setup_arch(), rather than from an init call. + +Complicating things, however, is that POWER8 systems need some per-cpu +state and kmalloc, which isn't available at this stage. So we split +things up into an early phase and a later opportunistic phase. This +commit also removes some noisy log messages that don't add much. + +Fixes: a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv") +Cc: stable@vger.kernel.org # v3.13+ +Signed-off-by: Jason A. Donenfeld +Reviewed-by: Christophe Leroy +[mpe: Add of_node_put(), use pnv naming, minor change log editing] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220621140849.127227-1-Jason@zx2c4.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/platforms/powernv/powernv.h | 2 + + arch/powerpc/platforms/powernv/rng.c | 52 +++++++++++++++++++++---------- + arch/powerpc/platforms/powernv/setup.c | 2 + + 3 files changed, 40 insertions(+), 16 deletions(-) + +--- a/arch/powerpc/platforms/powernv/powernv.h ++++ b/arch/powerpc/platforms/powernv/powernv.h +@@ -42,4 +42,6 @@ ssize_t memcons_copy(struct memcons *mc, + u32 memcons_get_size(struct memcons *mc); + struct memcons *memcons_init(struct device_node *node, const char *mc_prop_name); + ++void pnv_rng_init(void); ++ + #endif /* _POWERNV_H */ +--- a/arch/powerpc/platforms/powernv/rng.c ++++ b/arch/powerpc/platforms/powernv/rng.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include "powernv.h" + + #define DARN_ERR 0xFFFFFFFFFFFFFFFFul + +@@ -28,7 +29,6 @@ struct powernv_rng { + + static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng); + +- + int powernv_hwrng_present(void) + { + struct powernv_rng *rng; +@@ -98,9 +98,6 @@ static int initialise_darn(void) + return 0; + } + } +- +- pr_warn("Unable to use DARN for get_random_seed()\n"); +- + return -EIO; + } + +@@ -163,32 +160,55 @@ static __init int rng_create(struct devi + + rng_init_per_cpu(rng, dn); + +- pr_info_once("Registering arch random hook.\n"); +- + ppc_md.get_random_seed = powernv_get_random_long; + + return 0; + } + +-static __init int rng_init(void) ++static int __init pnv_get_random_long_early(unsigned long *v) + { + struct device_node *dn; +- int rc; ++ ++ if (!slab_is_available()) ++ return 0; ++ ++ if (cmpxchg(&ppc_md.get_random_seed, pnv_get_random_long_early, ++ NULL) != pnv_get_random_long_early) ++ return 0; + + for_each_compatible_node(dn, NULL, "ibm,power-rng") { +- rc = rng_create(dn); +- if (rc) { +- pr_err("Failed creating rng for %pOF (%d).\n", +- dn, rc); ++ if (rng_create(dn)) + continue; +- } +- + /* Create devices for hwrng driver */ + of_platform_device_create(dn, NULL, NULL); + } + +- initialise_darn(); ++ if (!ppc_md.get_random_seed) ++ return 0; ++ return ppc_md.get_random_seed(v); ++} ++ ++void __init pnv_rng_init(void) ++{ ++ struct device_node *dn; + ++ /* Prefer darn over the rest. */ ++ if (!initialise_darn()) ++ return; ++ ++ dn = of_find_compatible_node(NULL, NULL, "ibm,power-rng"); ++ if (dn) ++ ppc_md.get_random_seed = pnv_get_random_long_early; ++ ++ of_node_put(dn); ++} ++ ++static int __init pnv_rng_late_init(void) ++{ ++ unsigned long v; ++ /* In case it wasn't called during init for some other reason. */ ++ if (ppc_md.get_random_seed == pnv_get_random_long_early) ++ pnv_get_random_long_early(&v); + return 0; + } +-machine_subsys_initcall(powernv, rng_init); ++machine_subsys_initcall(powernv, pnv_rng_late_init); +--- a/arch/powerpc/platforms/powernv/setup.c ++++ b/arch/powerpc/platforms/powernv/setup.c +@@ -193,6 +193,8 @@ static void __init pnv_setup_arch(void) + pnv_check_guarded_cores(); + + /* XXX PMCS */ ++ ++ pnv_rng_init(); + } + + static void __init pnv_init(void) diff --git a/queue-5.10/powerpc-rtas-allow-ibm-platform-dump-rtas-call-with-null-buffer-address.patch b/queue-5.10/powerpc-rtas-allow-ibm-platform-dump-rtas-call-with-null-buffer-address.patch new file mode 100644 index 00000000000..1ed11e90117 --- /dev/null +++ b/queue-5.10/powerpc-rtas-allow-ibm-platform-dump-rtas-call-with-null-buffer-address.patch @@ -0,0 +1,60 @@ +From 7bc08056a6dabc3a1442216daf527edf61ac24b6 Mon Sep 17 00:00:00 2001 +From: Andrew Donnellan +Date: Tue, 14 Jun 2022 23:49:52 +1000 +Subject: powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address + +From: Andrew Donnellan + +commit 7bc08056a6dabc3a1442216daf527edf61ac24b6 upstream. + +Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS +call through the RTAS filter if the buffer address is 0. + +According to PAPR, ibm,platform-dump is called with a null buffer address +to notify the platform firmware that processing of a particular dump is +finished. + +Without this, on a pseries machine with CONFIG_PPC_RTAS_FILTER enabled, an +application such as rtas_errd that is attempting to retrieve a dump will +encounter an error at the end of the retrieval process. + +Fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace") +Cc: stable@vger.kernel.org +Reported-by: Sathvika Vasireddy +Signed-off-by: Andrew Donnellan +Reviewed-by: Tyrel Datwyler +Reviewed-by: Nathan Lynch +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220614134952.156010-1-ajd@linux.ibm.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/kernel/rtas.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/kernel/rtas.c ++++ b/arch/powerpc/kernel/rtas.c +@@ -1040,7 +1040,7 @@ static struct rtas_filter rtas_filters[] + { "get-time-of-day", -1, -1, -1, -1, -1 }, + { "ibm,get-vpd", -1, 0, -1, 1, 2 }, + { "ibm,lpar-perftools", -1, 2, 3, -1, -1 }, +- { "ibm,platform-dump", -1, 4, 5, -1, -1 }, ++ { "ibm,platform-dump", -1, 4, 5, -1, -1 }, /* Special cased */ + { "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 }, + { "ibm,scan-log-dump", -1, 0, 1, -1, -1 }, + { "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 }, +@@ -1087,6 +1087,15 @@ static bool block_rtas_call(int token, i + size = 1; + + end = base + size - 1; ++ ++ /* ++ * Special case for ibm,platform-dump - NULL buffer ++ * address is used to indicate end of dump processing ++ */ ++ if (!strcmp(f->name, "ibm,platform-dump") && ++ base == 0) ++ return false; ++ + if (!in_rmo_buf(base, end)) + goto err; + } diff --git a/queue-5.10/series b/queue-5.10/series index 618202d33c8..742734c65ec 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -80,3 +80,12 @@ iio-adc-stm32-fix-maximum-clock-rate-for-stm32mp15x.patch iio-imu-inv_icm42600-fix-broken-icm42600-chip-id-0-value.patch iio-adc-stm32-fix-adcs-iteration-in-irq-handler.patch iio-adc-stm32-fix-irqs-on-stm32f4-by-removing-custom-spurious-irqs-message.patch +iio-adc-axp288-override-ts-pin-bias-current-for-some-models.patch +iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch +xtensa-xtfpga-fix-refcount-leak-bug-in-setup.patch +xtensa-fix-refcount-leak-bug-in-time.c.patch +parisc-stifb-fix-fb_is_primary_device-only-available-with-config_fb_sti.patch +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 diff --git a/queue-5.10/xtensa-fix-refcount-leak-bug-in-time.c.patch b/queue-5.10/xtensa-fix-refcount-leak-bug-in-time.c.patch new file mode 100644 index 00000000000..169adfc23a5 --- /dev/null +++ b/queue-5.10/xtensa-fix-refcount-leak-bug-in-time.c.patch @@ -0,0 +1,32 @@ +From a0117dc956429f2ede17b323046e1968d1849150 Mon Sep 17 00:00:00 2001 +From: Liang He +Date: Fri, 17 Jun 2022 20:44:32 +0800 +Subject: xtensa: Fix refcount leak bug in time.c + +From: Liang He + +commit a0117dc956429f2ede17b323046e1968d1849150 upstream. + +In calibrate_ccount(), of_find_compatible_node() will return a node +pointer with refcount incremented. We should use of_node_put() when +it is not used anymore. + +Cc: stable@vger.kernel.org +Signed-off-by: Liang He +Message-Id: <20220617124432.4049006-1-windhl@126.com> +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman +--- + arch/xtensa/kernel/time.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/xtensa/kernel/time.c ++++ b/arch/xtensa/kernel/time.c +@@ -154,6 +154,7 @@ static void __init calibrate_ccount(void + cpu = of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu"); + if (cpu) { + clk = of_clk_get(cpu, 0); ++ of_node_put(cpu); + if (!IS_ERR(clk)) { + ccount_freq = clk_get_rate(clk); + return; diff --git a/queue-5.10/xtensa-xtfpga-fix-refcount-leak-bug-in-setup.patch b/queue-5.10/xtensa-xtfpga-fix-refcount-leak-bug-in-setup.patch new file mode 100644 index 00000000000..06e32665d14 --- /dev/null +++ b/queue-5.10/xtensa-xtfpga-fix-refcount-leak-bug-in-setup.patch @@ -0,0 +1,32 @@ +From 173940b3ae40114d4179c251a98ee039dc9cd5b3 Mon Sep 17 00:00:00 2001 +From: Liang He +Date: Fri, 17 Jun 2022 19:53:23 +0800 +Subject: xtensa: xtfpga: Fix refcount leak bug in setup + +From: Liang He + +commit 173940b3ae40114d4179c251a98ee039dc9cd5b3 upstream. + +In machine_setup(), of_find_compatible_node() will return a node +pointer with refcount incremented. We should use of_node_put() when +it is not used anymore. + +Cc: stable@vger.kernel.org +Signed-off-by: Liang He +Message-Id: <20220617115323.4046905-1-windhl@126.com> +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman +--- + arch/xtensa/platforms/xtfpga/setup.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/xtensa/platforms/xtfpga/setup.c ++++ b/arch/xtensa/platforms/xtfpga/setup.c +@@ -133,6 +133,7 @@ static int __init machine_setup(void) + + if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) + update_local_mac(eth); ++ of_node_put(eth); + return 0; + } + arch_initcall(machine_setup);