From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Ziyi Guo <n7l8m4@u.northwestern.edu>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Sasha Levin <sashal@kernel.org>,
brgl@kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.12] power: sequencing: fix missing state_lock in pwrseq_power_on() error path
Date: Fri, 13 Feb 2026 19:59:48 -0500 [thread overview]
Message-ID: <20260214010245.3671907-108-sashal@kernel.org> (raw)
In-Reply-To: <20260214010245.3671907-1-sashal@kernel.org>
From: Ziyi Guo <n7l8m4@u.northwestern.edu>
[ Upstream commit e1dccb485c2876ac1318f36ccc0155416c633a48 ]
pwrseq_power_on() calls pwrseq_unit_disable() when the
post_enable callback fails. However, this call is outside the
scoped_guard(mutex, &pwrseq->state_lock) block that ends.
pwrseq_unit_disable() has lockdep_assert_held(&pwrseq->state_lock),
which will fail when called from this error path.
Add the scoped_guard block to cover the post_enable callback and its
error handling to ensure the lock is held when pwrseq_unit_disable() is
called.
Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Link: https://patch.msgid.link/20260130182651.1576579-1-n7l8m4@u.northwestern.edu
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
The power sequencing core was introduced in v6.11. So this fix is
relevant for stable trees v6.11.y and later (6.12.y, 6.13.y, etc.).
### 8. SELF-CONTAINEDNESS
This is a completely self-contained fix. It doesn't depend on any other
patches. It simply wraps two existing lines of code with the appropriate
lock scope.
### VERDICT
**Meets stable criteria:**
- **Obviously correct**: Yes — the lock is required (enforced by
`lockdep_assert_held`), and it was missing.
- **Fixes a real bug**: Yes — lockdep assertion failure and potential
race condition.
- **Small and contained**: Yes — 6 lines changed in 1 file.
- **No new features**: Correct — purely a locking fix.
- **Low regression risk**: Adding a lock that was already required by
the callee.
The fix is small, surgical, obviously correct, and fixes a real locking
bug that would trigger lockdep warnings and could lead to race
conditions. It meets all stable kernel criteria.
**YES**
drivers/power/sequencing/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
index 190564e559885..1fcf0af7cc0bb 100644
--- a/drivers/power/sequencing/core.c
+++ b/drivers/power/sequencing/core.c
@@ -914,8 +914,10 @@ int pwrseq_power_on(struct pwrseq_desc *desc)
if (target->post_enable) {
ret = target->post_enable(pwrseq);
if (ret) {
- pwrseq_unit_disable(pwrseq, unit);
- desc->powered_on = false;
+ scoped_guard(mutex, &pwrseq->state_lock) {
+ pwrseq_unit_disable(pwrseq, unit);
+ desc->powered_on = false;
+ }
}
}
--
2.51.0
parent reply other threads:[~2026-02-14 1:06 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260214010245.3671907-1-sashal@kernel.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260214010245.3671907-108-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=n7l8m4@u.northwestern.edu \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox