From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
stable@vger.kernel.org, sashiko-bot <sashiko-bot@kernel.org>
Subject: [PATCH v2 2/4] power: sequencing: fix NULL-pointer dereference in pwrseq_unit_new()
Date: Wed, 09 Sep 2026 14:37:08 +0200 [thread overview]
Message-ID: <20260909-pwrseq-kunit-v2-2-ef496afc89d2@oss.qualcomm.com> (raw)
In-Reply-To: <20260909-pwrseq-kunit-v2-0-ef496afc89d2@oss.qualcomm.com>
If memory allocation fails in pwrseq_unit_setup_deps(), pwrseq_unit_put()
is called to release the partially initialized unit. However, we've
never initialized unit->list and pwrseq_unit_release() will
unconditionally call list_del() on it. Initialize unit->list right after
allocating the unit struct.
Fixes: 249ebf3f65f8 ("power: sequencing: implement the pwrseq core")
Cc: stable@vger.kernel.org
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260903-pwrseq-kunit-v1-0-1f893d2cabc2%40oss.qualcomm.com?part=1
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/power/sequencing/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
index a26615b727f6fe8e7cdc3ab1d3f362ba2f1c5684..a092031943397241b2a9970de5793a0bbc8d7ecf 100644
--- a/drivers/power/sequencing/core.c
+++ b/drivers/power/sequencing/core.c
@@ -101,6 +101,7 @@ static struct pwrseq_unit *pwrseq_unit_new(const struct pwrseq_unit_data *data)
}
kref_init(&unit->ref);
+ INIT_LIST_HEAD(&unit->list);
INIT_LIST_HEAD(&unit->deps);
unit->enable = data->enable;
unit->disable = data->disable;
--
2.47.3
next prev parent reply other threads:[~2026-09-09 12:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 12:37 [PATCH v2 0/4] power: sequencing: add kunit test cases Bartosz Golaszewski
2026-09-09 12:37 ` [PATCH v2 1/4] power: sequencing: don't call .post_enable() if pwrseq_unit_enable() failed Bartosz Golaszewski
2026-09-09 12:37 ` Bartosz Golaszewski [this message]
2026-09-09 12:37 ` [PATCH v2 3/4] power: sequencing: fix NULL-pointer dereference in pwrseq_device_register() Bartosz Golaszewski
2026-09-09 12:37 ` [PATCH v2 4/4] power: sequencing: add kunit test cases Bartosz Golaszewski
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=20260909-pwrseq-kunit-v2-2-ef496afc89d2@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mani@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
--cc=wens@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