summaryrefslogtreecommitdiff
path: root/include/linux/stackprotector.h
diff options
context:
space:
mode:
authorZhou Minqiang <zhouminqiang2@huawei.com>2026-11-04 19:56:41 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2026-11-04 15:30:37 +0100
commit1f65b45f0f16e1c80a68a5757c9556f78bb39f19 (patch)
tree78c742f93947f5a393826cdbde109edca48ea392 /include/linux/stackprotector.h
parent6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 (diff)
PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove
When a WQ_MEM_RECLAIM workqueue (e.g. iscsi_ctrl) triggers device removal via device_del -> pm_runtime_remove, the unconditional flush_work inside pm_runtime_remove can trigger a check_flush_dependency warning: CPU1: pm_wq worker CPU2: iscsi_ctrl wq -------- -------- pm_runtime_work(starget) pm_runtime_remove(starget) spin_lock_irq(&starget->lock) __pm_runtime_disable(starget, false) request_pending = false spin_lock_irq(&starget->lock) (blocked, CPU1 holds the lock) rpm_suspend(starget, RPM_NOWAIT) status = RPM_SUSPENDING rpm_callback(cb, starget) spin_unlock_irq(&starget->lock) (acquires lock) disable_depth 0→1 __pm_runtime_barrier(): request_pending == false → skip cancel_work_sync status == RPM_SUSPENDING → enter wait_queue, sleep spin_unlock_irq(&starget->lock) cb(starget) → 0 spin_lock_irq(&starget->lock) status = RPM_SUSPENDED wake_up_all(&wait_queue) (woken up, waiting for lock) spin_unlock(&starget->lock) spin_lock_irq(&starget->lock) status == RPM_SUSPENDED spin_lock(&parent->lock) → exit wait_queue rpm_idle(parent, RPM_ASYNC) barrier returns spin_unlock(&parent->lock) flush_work(&starget->work) spin_lock(&starget->lock) __flush_work(from_cancel=false) spin_unlock_irq(&starget->lock) check_flush_dependency() ← WARNING! Replace flush_work with cancel_work_sync in pm_runtime_remove. cancel_work_sync internally calls __flush_work with from_cancel=true, which causes check_flush_dependency to return early before the warning. This preserves the use-after-free fix from commit 29ab76827761 ("PM: runtime: Fix a race condition related to device removal") without the warning. Fixes: 29ab76827761 ("PM: runtime: Fix a race condition related to device removal") Signed-off-by: Zhou Minqiang <zhouminqiang2@huawei.com> Link: https://patch.msgid.link/20261104115641.2682786-1-zhouminqiang2@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/stackprotector.h')
0 files changed, 0 insertions, 0 deletions