* [PATCH] mtd: intel-dg: Fix runtime PM error path in probe
@ 2026-07-05 3:31 Guangshuo Li
2026-07-07 7:57 ` Raag Jadav
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-07-05 3:31 UTC (permalink / raw)
To: Alexander Usyskin, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Raag Jadav, Lucas De Marchi, linux-mtd,
linux-kernel
Cc: Guangshuo Li
intel_dg_mtd_probe() allocates region names before enabling runtime PM
and before calling pm_runtime_resume_and_get().
If kasprintf() fails while building a region name, the error path jumps
to err, which calls pm_runtime_put(). At that point there has not been a
successful pm_runtime_resume_and_get() call to balance, so the runtime PM
usage count can underflow.
Jump to err_norpm from the kasprintf() failure path, as the runtime PM
reference has not been acquired yet.
Fixes: 779c59274d03 ("mtd: intel-dg: Fix accessing regions before setting nregions")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/mtd/devices/mtd_intel_dg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/mtd_intel_dg.c b/drivers/mtd/devices/mtd_intel_dg.c
index f2fa8f68d190..a566e86eb5e3 100644
--- a/drivers/mtd/devices/mtd_intel_dg.c
+++ b/drivers/mtd/devices/mtd_intel_dg.c
@@ -780,7 +780,7 @@ static int intel_dg_mtd_probe(struct auxiliary_device *aux_dev,
dev_name(&aux_dev->dev), invm->regions[i].name);
if (!name) {
ret = -ENOMEM;
- goto err;
+ goto err_norpm;
}
nvm->regions[n].name = name;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: intel-dg: Fix runtime PM error path in probe
2026-07-05 3:31 [PATCH] mtd: intel-dg: Fix runtime PM error path in probe Guangshuo Li
@ 2026-07-07 7:57 ` Raag Jadav
0 siblings, 0 replies; 2+ messages in thread
From: Raag Jadav @ 2026-07-07 7:57 UTC (permalink / raw)
To: Guangshuo Li
Cc: Alexander Usyskin, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Lucas De Marchi, linux-mtd, linux-kernel
On Sun, Jul 05, 2026 at 11:31:07AM +0800, Guangshuo Li wrote:
> intel_dg_mtd_probe() allocates region names before enabling runtime PM
> and before calling pm_runtime_resume_and_get().
>
> If kasprintf() fails while building a region name, the error path jumps
> to err, which calls pm_runtime_put(). At that point there has not been a
> successful pm_runtime_resume_and_get() call to balance, so the runtime PM
> usage count can underflow.
>
> Jump to err_norpm from the kasprintf() failure path, as the runtime PM
> reference has not been acquired yet.
>
> Fixes: 779c59274d03 ("mtd: intel-dg: Fix accessing regions before setting nregions")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-07 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 3:31 [PATCH] mtd: intel-dg: Fix runtime PM error path in probe Guangshuo Li
2026-07-07 7:57 ` Raag Jadav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox