[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b5c23a86-37a5-48af-b3f3-48bcd5d57cd8@roeck-us.net>
Date: Wed, 12 Nov 2025 12:02:36 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Haotian Zhang <vulab@...as.ac.cn>, wim@...ux-watchdog.org
Cc: linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/x86: wdat_wdt: Fix ACPI table leak on probe
errors
On 11/10/25 19:28, Haotian Zhang wrote:
> wdat_wdt_probe() calls acpi_get_table() to obtain the WDAT ACPI table but
> returns early on multiple error paths without calling acpi_put_table().
It _never_ calls acpi_put_table().
> This causes a permanent ACPI table memory leak if the driver probe fails.
>
Seems to me that itdoesn't just cause a table leak if probe fails.
> Add a single cleanup path which calls acpi_put_table() and redirect all
> error returns to it, ensuring the ACPI table is always released.
>
> Fixes: 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
> drivers/watchdog/wdat_wdt.c | 66 ++++++++++++++++++++++++-------------
> 1 file changed, 44 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
> index 650fdc7996e1..f827844a0c69 100644
> --- a/drivers/watchdog/wdat_wdt.c
> +++ b/drivers/watchdog/wdat_wdt.c
> @@ -318,7 +318,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
> struct resource *res;
> void __iomem **regs;
> acpi_status status;
> - int i, ret;
> + int i, ret = 0;
Unnecessary initialization.
Guenter
Powered by blists - more mailing lists