FAILED: patch "[PATCH] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
maintainerThe 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 <[email protected]>.
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 '<[email protected]>' --in-reply-to '[email protected]' --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 <[email protected]>
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.
--- drivers/pci/pwrctrl/generic.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pwrctrl/generic.c +1 -0
@@ -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)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/2 PCI/pwrctrl: slot: Rename private struct and pointers for consistency
From: Bjorn Helgaas <[email protected]>
[ 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.
Stable-dep-of: ee450e3a2d33 ("PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()")
--- drivers/pci/pwrctrl/slot.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/pci/pwrctrl/slot.c +15 -15
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Generic PCI Power Control driver for PCI Slots" );
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()
From: Alexey Charkov <[email protected]>
[ 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.
--- drivers/pci/pwrctrl/slot.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pwrctrl/slot.c +1 -0
@@ -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)
Signature · 1 line
2.53.0