Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 00/10] power: supply: Fix Critical and High issues reported by Sashiko
@ 2026-12-03 16:12 Lee Jones
  2026-12-03 16:12 ` [PATCH 09/10] power: supply: qcom_battmgr: Hold battmgr->lock in qcom_battmgr_enable_worker() Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-12-03 16:12 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, Andrew F. Davis, Mark A. Greer, Pali Rohár,
	Uwe Kleine-König (The Capable Hub),
	AngeloGioacchino Del Regno, Anish Kumar, Anton Vorontsov,
	Arun R Murthy, Bjorn Andersson, Grazvydas Ignotas, Hans de Goede,
	Ian Molton, Johan Palsson, Jonathan Cameron, Karl Komierowski,
	Ladislav Michl, Lars-Peter Clausen, Linus Walleij, linux-arm-msm,
	linux-pm, Neil Armstrong, Rhyland Klein, Sebastian Reichel,
	Svyatoslav Ryhel, Tony Lindgren, Xu Rao

These issues were reported by Sashiko.

Cc: "Andrew F. Davis" <afd@ti.com>
Cc: "Mark A. Greer" <mgreer@animalcreek.com>
Cc: "Pali Rohár" <pali@kernel.org>
Cc: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Anish Kumar <yesanishhere@gmail.com>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: Arun R Murthy <arun.murthy@stericsson.com>
Cc: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Cc: Grazvydas Ignotas <notasas@gmail.com>
Cc: Hans de Goede <johannes.goede@oss.qualcomm.com>
Cc: Ian Molton <spyro@f2s.com>
Cc: Johan Palsson <johan.palsson@stericsson.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Karl Komierowski <karl.komierowski@stericsson.com>
Cc: Ladislav Michl <ladis@linux-mips.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Linus Walleij <linusw@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Rhyland Klein <rklein@nvidia.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Xu Rao <raoxu@uniontech.com>

Lee Jones (10):
  power: supply: bq27xxx: Check for short i2c_transfer() in
    bq27xxx_battery_i2c_read()
  power: supply: generic-adc-battery: Initialise bat_work before
    registering supply
  power: supply: bq24190: Manage teardown order with devm to prevent UAF
  power: supply: gpio-charger: Avoid printing uninitialised chargetype
  power: supply: ab8500_btemp: Remove unused global device list
  power: supply: core: Pack supplied_from densely and bound writes
  power: supply: core: Reject empty ocv-capacity-table properties
  power: supply: cpcap-battery: Release battery info in
    cpcap_battery_update_battery_data()
  power: supply: qcom_battmgr: Hold battmgr->lock in
    qcom_battmgr_enable_worker()
  power: supply: sbs-battery: Always cancel delayed work on suspend

 drivers/power/supply/ab8500_btemp.c        |   6 -
 drivers/power/supply/bq24190_charger.c     | 122 +++++++++++----------
 drivers/power/supply/bq27xxx_battery_i2c.c |   2 +
 drivers/power/supply/cpcap-battery.c       |   2 +
 drivers/power/supply/generic-adc-battery.c |  40 +++++--
 drivers/power/supply/gpio-charger.c        |   2 +-
 drivers/power/supply/power_supply_core.c   |  29 +++--
 drivers/power/supply/qcom_battmgr.c        |   8 +-
 drivers/power/supply/sbs-battery.c         |   3 +-
 9 files changed, 124 insertions(+), 90 deletions(-)

-- 
2.56.1.911.g883d8bcb20-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 09/10] power: supply: qcom_battmgr: Hold battmgr->lock in qcom_battmgr_enable_worker()
  2026-12-03 16:12 [PATCH 00/10] power: supply: Fix Critical and High issues reported by Sashiko Lee Jones
@ 2026-12-03 16:12 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-12-03 16:12 UTC (permalink / raw)
  To: lee, Sebastian Reichel, Bjorn Andersson, Neil Armstrong,
	linux-arm-msm, linux-pm, linux-kernel
  Cc: stable

qcom_battmgr_enable_worker() calls qcom_battmgr_request() without
acquiring battmgr->lock, racing with concurrent sysfs property queries
that also use battmgr->ack and battmgr->error and sending overlapping
requests to PMIC GLINK firmware.

Acquire battmgr->lock around qcom_battmgr_request() in
qcom_battmgr_enable_worker() and assert the lock in
qcom_battmgr_request().

Fixes: 29e8142b5623 ("power: supply: Introduce Qualcomm PMIC GLINK power supply")
Closes: https://sashiko.dev/#/bug/linux-35b68138-5485-48e9-a9ab-df314c5c19ec
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/power/supply/qcom_battmgr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
index 0789303a5965..4a86c3b5235c 100644
--- a/drivers/power/supply/qcom_battmgr.c
+++ b/drivers/power/supply/qcom_battmgr.c
@@ -351,10 +351,8 @@ static int qcom_battmgr_request(struct qcom_battmgr *battmgr, void *data, size_t
 	unsigned long left;
 	int ret;
 
-	/*
-	 * Callers hold @lock, except enable_work, which is disabled before
-	 * client_gone is set.
-	 */
+	lockdep_assert_held(&battmgr->lock);
+
 	if (battmgr->client_gone)
 		return -ENODEV;
 
@@ -1748,7 +1746,9 @@ static void qcom_battmgr_enable_worker(struct work_struct *work)
 	};
 	int ret;
 
+	mutex_lock(&battmgr->lock);
 	ret = qcom_battmgr_request(battmgr, &req, sizeof(req));
+	mutex_unlock(&battmgr->lock);
 	if (ret)
 		dev_err(battmgr->dev, "failed to request power notifications\n");
 }
-- 
2.56.1.911.g883d8bcb20-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:12 [PATCH 00/10] power: supply: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 16:12 ` [PATCH 09/10] power: supply: qcom_battmgr: Hold battmgr->lock in qcom_battmgr_enable_worker() Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox