From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Alexey Charkov <alchark@flipper.net>,
Bjorn Helgaas <bhelgaas@google.com>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/2] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()
Date: Wed, 11 Nov 2026 17:00:31 -0500 [thread overview]
Message-ID: <20261111220022.4081244-2-sashal@kernel.org> (raw)
In-Reply-To: <20261111220022.4081244-1-sashal@kernel.org>
From: Alexey Charkov <alchark@flipper.net>
[ Upstream commit ee450e3a2d334c7e6383d8a55ad2d53b3822bacc ]
of_regulator_bulk_get_all() allocates the consumers array and returns it to
the caller, who is expected to free it at an appropriate time. PCI pwrctrl
never did, leading to a memory leak.
Add an explicit kfree() for the consumers array.
Fixes: 75996c92f4de ("PCI/pwrctrl: Add pwrctrl driver for PCI slots")
Signed-off-by: Alexey Charkov <alchark@flipper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260930-pci-pwrctrl-kfree-v1-1-f09bbffd8da3@flipper.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/pci/pwrctrl/slot.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c
index 51de1eecdb26b..35bbf8a380415 100644
--- a/drivers/pci/pwrctrl/slot.c
+++ b/drivers/pci/pwrctrl/slot.c
@@ -25,6 +25,7 @@ static void devm_slot_pwrctrl_power_off(void *data)
regulator_bulk_disable(slot->num_supplies, slot->supplies);
regulator_bulk_free(slot->num_supplies, slot->supplies);
+ kfree(slot->supplies);
}
static int slot_pwrctrl_probe(struct platform_device *pdev)
--
2.53.0
prev parent reply other threads:[~2026-11-11 22:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:13 FAILED: patch "[PATCH] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()" failed to apply to 6.18-stable tree Sasha Levin
2026-11-11 22:00 ` [PATCH 6.18.y 1/2] PCI/pwrctrl: slot: Rename private struct and pointers for consistency Sasha Levin
2026-11-11 22:00 ` Sasha Levin [this message]
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=20261111220022.4081244-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alchark@flipper.net \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=bhelgaas@google.com \
--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