mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] regulator: of: Fixes to of_regulator_bulk_get_all()
@ 2026-09-30 16:13 Alexey Charkov
  2026-09-30 16:13 ` [PATCH v2 1/2] regulator: of: fill in supply names in of_regulator_bulk_get_all() Alexey Charkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Charkov @ 2026-09-30 16:13 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Corentin Labbe
  Cc: Alexey Charkov, linux-kernel, stable, Sashiko

of_regulator_bulk_get_all() only fills in the .consumer part of the
struct regulator_bulk_data for the regulators it gets, leaving .supply as
garbage, while the rest of the regulator core expects a meaningful name
there (e.g. for error prints), causing uninitialized memory access in any
failure paths in the core.

It also allocates the supplies array and hands it to callers, but never
says the callers need to free it (which they don't currently), causing
leaks.

Fix the former and document the latter in the kerneldoc to help any new
users avoid the leak.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
Changes in v2:
- Split by subsystem for easier application, per Mark's feedback
- Link to v1: https://patch.msgid.link/20260929-regulator-get-all-v1-0-e887c66a47f1@flipper.net

To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Corentin Labbe <clabbe@baylibre.com>
Cc: linux-kernel@vger.kernel.org

---
Alexey Charkov (2):
      regulator: of: fill in supply names in of_regulator_bulk_get_all()
      regulator: of: state who owns the array from of_regulator_bulk_get_all()

 drivers/regulator/of_regulator.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
---
base-commit: 6c2cb8b8b843d216ab549b678a0d8831c43153e0
change-id: 20260929-regulator-get-all-a553e73ff1ce

Best regards,
--  
Alexey Charkov <alchark@flipper.net>


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

end of thread, other threads:[~2026-10-04 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 16:13 [PATCH v2 0/2] regulator: of: Fixes to of_regulator_bulk_get_all() Alexey Charkov
2026-09-30 16:13 ` [PATCH v2 1/2] regulator: of: fill in supply names in of_regulator_bulk_get_all() Alexey Charkov
2026-09-30 16:13 ` [PATCH v2 2/2] regulator: of: state who owns the array from of_regulator_bulk_get_all() Alexey Charkov
2026-10-04 16:29 ` [PATCH v2 0/2] regulator: of: Fixes to of_regulator_bulk_get_all() Mark Brown

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

all inboxes | Powered by JetHome®