mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Alexey Charkov <alchark@flipper.net>
Cc: "Bartosz Golaszewski" <brgl@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] PCI/pwrctrl: generic: Fix leaking array from of_regulator_bulk_get_all()
Date: Thu, 1 Oct 2026 11:50:30 -0500	[thread overview]
Message-ID: <20261001165030.GA2699569@bhelgaas> (raw)
In-Reply-To: <20260930-pci-pwrctrl-kfree-v1-1-f09bbffd8da3@flipper.net>

On Wed, Sep 30, 2026 at 08:07:45PM +0400, Alexey Charkov wrote:
> of_regulator_bulk_get_all() allocates the consumers array and hands 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.
> 
> Cc: stable@vger.kernel.org
> Fixes: 75996c92f4de ("PCI/pwrctrl: Add pwrctrl driver for PCI slots")
> Signed-off-by: Alexey Charkov <alchark@flipper.net>

Applied to pci/pwrctrl for v7.4, thanks!

> ---
> Split out from [1] for easier application per Mark's feedback
> 
> [1] https://lore.kernel.org/all/20260929-regulator-get-all-v1-0-e887c66a47f1@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 d56171e0ee24..4b6cbbb52248 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)
> 
> ---
> base-commit: 6c2cb8b8b843d216ab549b678a0d8831c43153e0
> change-id: 20260930-pci-pwrctrl-kfree-b58621738902
> 
> Best regards,
> --  
> Alexey Charkov <alchark@flipper.net>
> 

      parent reply	other threads:[~2026-10-01 16:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 16:07 Alexey Charkov
2026-10-01 14:41 ` Bartosz Golaszewski
2026-10-01 16:50 ` Bjorn Helgaas [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=20261001165030.GA2699569@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alchark@flipper.net \
    --cc=bhelgaas@google.com \
    --cc=brgl@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --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

all inboxes | Powered by JetHome®