mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
net: ipa: balance runtime PM reference on remove error
ipa_remove() takes a runtime PM reference before accessing IPA hardware
during teardown. If a concurrent modem start or stop keeps
ipa_modem_stop() busy across both attempts, the callback intentionally
returns without releasing the remaining resources because proceeding
with teardown could crash. That return also skips the matching
pm_runtime_put_noidle(), leaving the callback's usage-count reference
held.
Drop only this runtime PM reference before returning.
pm_runtime_put_noidle() does not request an idle transition, so the
hardware and resources retained on this exceptional path remain
untouched while the usage count stays balanced.
This issue was found by a static analysis checker and confirmed by
manual source review.
Fixes: 923a6b6984 ("net: ipa: get clock in ipa_probe()")
Signed-off-by: Ruoyu Wang <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
1 parent
a4d7fc3255
commit
6b9eaa61ff
1 file changed
+3
-3
@@ -972,12 +972,12 @@ static void ipa_remove(struct platform_device *pdev)
|
||||
}
|
||||
if (ret) {
|
||||
/*
|
||||
* Not cleaning up here properly might also yield a
|
||||
* crash later on. As the device is still unregistered
|
||||
* in this case, this might even yield a crash later on.
|
||||
* Continuing teardown after failing to stop the modem
|
||||
* could crash, so leave the remaining resources allocated.
|
||||
*/
|
||||
dev_err(dev, "Failed to stop modem (%pe), leaking resources\n",
|
||||
ERR_PTR(ret));
|
||||
pm_runtime_put_noidle(dev);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user