mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mtd: intel-dg: Fix runtime PM error path in probe
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: 779c59274d ("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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
d276783e49
commit
df6f582df3
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user