media: qcom: iris: handle runtime PM resume failure in core deinit
Subsystems (4)
PATCH 1/1 media: qcom: iris: handle runtime PM resume failure in core deinit
Check the return value of pm_runtime_resume_and_get() in iris_core_deinit().
If runtime PM resume fails, avoid accessing hardware resources and skip the corresponding pm_runtime_put_sync() call, preventing unbalanced runtime PM references.
--- drivers/media/platform/qcom/iris/iris_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_core.c +5 -1
@@ -12,7 +12,11 @@void iris_core_deinit (struct iris_core *core) { -pm_runtime_resume_and_get (core->dev); +int ret; + + ret =pm_runtime_resume_and_get (core->dev); +if (ret) +return ;mutex_lock (&core->lock);if (core->state !=IRIS_CORE_DEINIT ) {
Signature · 1 line
2.34.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Returning early when pm_runtime_resume_and_get() fails skips critical software teardown, leading…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning early when pm_runtime_resume_and_get() fails skips critical software teardown, leading to DMA memory leaks, TrustZone resource leaks, and state machine corruption. --
commit 8dfed661c7987b309b6408296f5d14cf1983d0aa
Author: Hungyu Lin <[email protected]>
media: qcom: iris: handle runtime PM resume failure in core deinit
This commit adds a return value check for pm_runtime_resume_and_get() in iris_core_deinit(). If the runtime PM resume fails, it returns early to avoid accessing hardware resources and prevent unbalanced runtime PM references.
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_core.c +0
-0
drivers/media/platform/qcom/iris/iris_core.c line 19
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_core.c +5
-1@@ -12,7 +12,11 @@void iris_core_deinit (struct iris_core *core) { -pm_runtime_resume_and_get (core->dev); +int ret; + + ret =pm_runtime_resume_and_get (core->dev); +if (ret) +return ;
[Severity: High]
Does returning early here when pm_runtime_resume_and_get() fails skip critical software teardown?
If the early return is taken in iris_core_deinit() in drivers/media/platform/qcom/iris/iris_core.c, the function bypasses iris_hfi_queues_deinit(), which appears to leak the DMA memory allocated for the interface queues. It also skips iris_fw_unload(), potentially leaving the PAS in an authenticated state in TrustZone.
Finally, the early return fails to transition core->state to IRIS_CORE_DEINIT. During error recovery, if the state is left as IRIS_CORE_ERROR, could this cause the subsequent iris_core_init() to fail instantly with -EINVAL, permanently breaking the device state machine until a driver reload?
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_core.c +0
-0mutex_lock (&core->lock);if (core->state !=IRIS_CORE_DEINIT ) {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1