* FAILED: patch "[PATCH] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()" failed to apply to 6.18-stable tree
@ 2026-11-07 10:13 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
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-11-07 10:13 UTC (permalink / raw)
To: alchark, bhelgaas, bartosz.golaszewski; +Cc: stable
The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x ee450e3a2d334c7e6383d8a55ad2d53b3822bacc
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107051332-failed-6.18-ee450e3a2d33@kernel.org' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From ee450e3a2d334c7e6383d8a55ad2d53b3822bacc Mon Sep 17 00:00:00 2001
From: Alexey Charkov <alchark@flipper.net>
Date: Wed, 30 Sep 2026 20:07:45 +0400
Subject: [PATCH] PCI/pwrctrl: generic: Fix leaking array from
of_regulator_bulk_get_all()
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
---
drivers/pci/pwrctrl/generic.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c
index d56171e0ee244..4b6cbbb522480 100644
--- a/drivers/pci/pwrctrl/generic.c
+++ b/drivers/pci/pwrctrl/generic.c
@@ -63,6 +63,7 @@ static void devm_slot_pwrctrl_release(void *data)
struct slot_pwrctrl *slot = data;
regulator_bulk_free(slot->num_supplies, slot->supplies);
+ kfree(slot->supplies);
}
static int slot_pwrctrl_probe(struct platform_device *pdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 6.18.y 1/2] PCI/pwrctrl: slot: Rename private struct and pointers for consistency 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 ` Sasha Levin 2026-11-11 22:00 ` [PATCH 6.18.y 2/2] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all() Sasha Levin 0 siblings, 1 reply; 3+ messages in thread From: Sasha Levin @ 2026-11-11 22:00 UTC (permalink / raw) To: stable Cc: Bjorn Helgaas, Manivannan Sadhasivam, Bartosz Golaszewski, Sasha Levin From: Bjorn Helgaas <bhelgaas@google.com> [ Upstream commit e40d16e6c23994b28894179b87f9747edd63062a ] Previously the pwrseq, tc9563, and slot pwrctrl drivers used different naming conventions for their private data structs and pointers to them, which makes patches hard to read. Rename structs, variables, and functions to reduce boiler-plate and start with "slot": struct pci_pwrctrl_slot_data -> struct slot_pwrctrl struct pci_pwrctrl ctx -> struct pci_pwrctrl pwrctrl pci_pwrctrl_slot_probe() -> slot_pwrctrl_probe() pci_pwrctrl_slot_of_match[] -> slot_pwrctrl_of_match[] pci_pwrctrl_slot_driver -> slot_pwrctrl_driver devm_pci_pwrctrl_slot_power_off() -> devm_slot_pwrctrl_power_off() No functional change intended. [bhelgaas: move "slot" to beginning, also rename functions, etc] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Link: https://patch.msgid.link/20260115-pci-pwrctrl-rework-v5-2-9d26da3ce903@oss.qualcomm.com Stable-dep-of: ee450e3a2d33 ("PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()") Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/pci/pwrctrl/slot.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c index 3320494b62d89..51de1eecdb26b 100644 --- a/drivers/pci/pwrctrl/slot.c +++ b/drivers/pci/pwrctrl/slot.c @@ -13,23 +13,23 @@ #include <linux/regulator/consumer.h> #include <linux/slab.h> -struct pci_pwrctrl_slot_data { - struct pci_pwrctrl ctx; +struct slot_pwrctrl { + struct pci_pwrctrl pwrctrl; struct regulator_bulk_data *supplies; int num_supplies; }; -static void devm_pci_pwrctrl_slot_power_off(void *data) +static void devm_slot_pwrctrl_power_off(void *data) { - struct pci_pwrctrl_slot_data *slot = data; + struct slot_pwrctrl *slot = data; regulator_bulk_disable(slot->num_supplies, slot->supplies); regulator_bulk_free(slot->num_supplies, slot->supplies); } -static int pci_pwrctrl_slot_probe(struct platform_device *pdev) +static int slot_pwrctrl_probe(struct platform_device *pdev) { - struct pci_pwrctrl_slot_data *slot; + struct slot_pwrctrl *slot; struct device *dev = &pdev->dev; struct clk *clk; int ret; @@ -53,7 +53,7 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev) return ret; } - ret = devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_power_off, + ret = devm_add_action_or_reset(dev, devm_slot_pwrctrl_power_off, slot); if (ret) return ret; @@ -64,31 +64,31 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev) "Failed to enable slot clock\n"); } - pci_pwrctrl_init(&slot->ctx, dev); + pci_pwrctrl_init(&slot->pwrctrl, dev); - ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->ctx); + ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->pwrctrl); if (ret) return dev_err_probe(dev, ret, "Failed to register pwrctrl driver\n"); return 0; } -static const struct of_device_id pci_pwrctrl_slot_of_match[] = { +static const struct of_device_id slot_pwrctrl_of_match[] = { { .compatible = "pciclass,0604", }, { } }; -MODULE_DEVICE_TABLE(of, pci_pwrctrl_slot_of_match); +MODULE_DEVICE_TABLE(of, slot_pwrctrl_of_match); -static struct platform_driver pci_pwrctrl_slot_driver = { +static struct platform_driver slot_pwrctrl_driver = { .driver = { .name = "pci-pwrctrl-slot", - .of_match_table = pci_pwrctrl_slot_of_match, + .of_match_table = slot_pwrctrl_of_match, }, - .probe = pci_pwrctrl_slot_probe, + .probe = slot_pwrctrl_probe, }; -module_platform_driver(pci_pwrctrl_slot_driver); +module_platform_driver(slot_pwrctrl_driver); MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>"); MODULE_DESCRIPTION("Generic PCI Power Control driver for PCI Slots"); -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.18.y 2/2] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all() 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 0 siblings, 0 replies; 3+ messages in thread From: Sasha Levin @ 2026-11-11 22:00 UTC (permalink / raw) To: stable; +Cc: Alexey Charkov, Bjorn Helgaas, Bartosz Golaszewski, Sasha Levin 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-11 22:00 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH 6.18.y 2/2] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all() Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox