[PATCH] via_wdt: fix critical boot hang due to unnamed resource allocation

Li Qiang posted 1 patch 3 days, 11 hours ago
drivers/watchdog/via_wdt.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] via_wdt: fix critical boot hang due to unnamed resource allocation
Posted by Li Qiang 3 days, 11 hours ago
The VIA watchdog driver uses allocate_resource() to reserve a MMIO
region for the watchdog control register. However, the allocated
resource was not given a name, which causes the kernel resource tree
to contain an entry marked as "<BAD>" under /proc/iomem on x86
platforms.

During boot, this unnamed resource can lead to a critical hang because
subsequent resource lookups and conflict checks fail to handle the
invalid entry properly.

Signed-off-by: Li Qiang <liqiang01@kylinos.cn>
---
 drivers/watchdog/via_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
index d647923d68fe..f55576392651 100644
--- a/drivers/watchdog/via_wdt.c
+++ b/drivers/watchdog/via_wdt.c
@@ -165,6 +165,7 @@ static int wdt_probe(struct pci_dev *pdev,
 		dev_err(&pdev->dev, "cannot enable PCI device\n");
 		return -ENODEV;
 	}
+	wdt_res.name = "via_wdt";
 
 	/*
 	 * Allocate a MMIO region which contains watchdog control register
-- 
2.25.1
Re: [PATCH] via_wdt: fix critical boot hang due to unnamed resource allocation
Posted by Guenter Roeck 3 days, 6 hours ago
On 9/28/25 01:33, Li Qiang wrote:
> The VIA watchdog driver uses allocate_resource() to reserve a MMIO
> region for the watchdog control register. However, the allocated
> resource was not given a name, which causes the kernel resource tree
> to contain an entry marked as "<BAD>" under /proc/iomem on x86
> platforms.
> 
> During boot, this unnamed resource can lead to a critical hang because
> subsequent resource lookups and conflict checks fail to handle the
> invalid entry properly.

FWIW, I only see the name used in print messages, which should show <NULL>
when called with a NULL pointer. Some more details would have been useful,
especially with the idea in mind that a missing resource name should be
reported but not result in a hang and/or crash.

> 
> Signed-off-by: Li Qiang <liqiang01@kylinos.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> ---
>   drivers/watchdog/via_wdt.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
> index d647923d68fe..f55576392651 100644
> --- a/drivers/watchdog/via_wdt.c
> +++ b/drivers/watchdog/via_wdt.c
> @@ -165,6 +165,7 @@ static int wdt_probe(struct pci_dev *pdev,
>   		dev_err(&pdev->dev, "cannot enable PCI device\n");
>   		return -ENODEV;
>   	}
> +	wdt_res.name = "via_wdt";
>   
>   	/*
>   	 * Allocate a MMIO region which contains watchdog control register