lkml.org 
[lkml]   [2022]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] input/serio: Fix refcount leak bug in i8042-sparcio
Hi Liang,

On Sun, Jun 19, 2022 at 03:30:36PM +0800, Liang He wrote:
> In i8042_platform_init() and i8042_platform_exit(), we need call
> of_node_put() to keep refcount balance.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/input/serio/i8042-sparcio.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> index fce76812843b..a2a9db9220d7 100644
> --- a/drivers/input/serio/i8042-sparcio.h
> +++ b/drivers/input/serio/i8042-sparcio.h
> @@ -108,6 +108,8 @@ static int __init i8042_platform_init(void)
> struct device_node *root = of_find_node_by_path("/");
> const char *name = of_get_property(root, "name", NULL);
>
> + of_node_put(root);
> +
> if (name && !strcmp(name, "SUNW,JavaStation-1")) {
> /* Hardcoded values for MrCoffee. */
> i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
> @@ -139,6 +141,8 @@ static inline void i8042_platform_exit(void)
> struct device_node *root = of_find_node_by_path("/");
> const char *name = of_get_property(root, "name", NULL);
>
> + of_node_put(root);
> +
> if (!name || strcmp(name, "SUNW,JavaStation-1"))
> platform_driver_unregister(&sparc_i8042_driver);
> }

There already was an attempt to fix this issue in a slightly better way,
unfortunately the original author did not finish the work:

https://lore.kernel.org/all/20181212163548.23723-1-tiny.windzz@gmail.com/

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2022-07-09 06:50    [W:0.060 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site