All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, imx@lists.linux.dev,
	Frank.Li@kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 01/23] mfd: tps6586x: fix OF node refcount
Date: Sat, 30 May 2026 00:45:39 +0000	[thread overview]
Message-ID: <20260530004539.C4AE91F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260521-pdev-fwnode-ref-v1-1-88c324a1b8d2@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The IRQ domain and descriptors allocated in `tps6586x_irq_init()` are never freed, leading to a memory leak and potential use-after-free.
--

commit e8eb8e919be10c86b0019b03f67b4c7e8f91a6b2
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

mfd: tps6586x: fix OF node refcount

This commit fixes an OF node reference count issue for sub-devices
created with the split platform_device_alloc() and platform_device_add()
approach. It adds a missing of_node_get() to prevent a premature
of_node_put() during device release.

> diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
> index 8d5fe2b60bfa5..f5f8054466033 100644
> --- a/drivers/mfd/tps6586x.c
> +++ b/drivers/mfd/tps6586x.c
> @@ -397,7 +397,7 @@ static int tps6586x_add_subdevs(struct tps6586x *tps6586x,
>  
>  		pdev->dev.parent = tps6586x->dev;
>  		pdev->dev.platform_data = subdev->platform_data;
> -		pdev->dev.of_node = subdev->of_node;
> +		pdev->dev.of_node = of_node_get(subdev->of_node);
>  
>  		ret = platform_device_add(pdev);
>  		if (ret) {

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file I
noticed the IRQ domain and descriptors allocated in tps6586x_irq_init() are
never freed.

Does this driver leak the IRQ domain and descriptors on driver unbind
(tps6586x_i2c_remove()) or probe error paths?

tps6586x_irq_init() allocates descriptors using irq_alloc_descs() and creates
an IRQ domain via irq_domain_create_simple(). The driver lacks matching calls
to irq_domain_remove() and irq_free_descs(), and these allocations are not
managed by devm_ variants.

Since tps6586x is allocated via devm_kzalloc(), it is automatically freed
when the device unbinds or probe fails. If the leaked irq_domain remains
linked in the global irq_domain_list with its host_data pointing to the
freed tps6586x structure, can a subsequent traversal of the IRQ domains
(e.g., via /sys/kernel/debug/irq/domains) cause a use-after-free?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com?part=1

  parent reply	other threads:[~2026-05-30  0:45 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  8:36 [PATCH 00/23] driver core: count references of the platform device's fwnode, not OF node Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 01/23] mfd: tps6586x: fix OF node refcount Bartosz Golaszewski
2026-05-27 15:36   ` (subset) " Lee Jones
2026-05-30  0:45   ` sashiko-bot [this message]
2026-05-21  8:36 ` [PATCH 02/23] net: mv643xx: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 03/23] slimbus: qcom-ngd-ctrl: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 04/23] pmdomain: imx: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-06-03 10:15   ` Ulf Hansson
2026-05-21  8:36 ` [PATCH 05/23] powerpc/powermac: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 06/23] driver core: platform: provide platform_device_set_of_node() Bartosz Golaszewski
2026-06-02 21:40   ` Andy Shevchenko
2026-05-21  8:36 ` [PATCH 07/23] driver core: platform: provide platform_device_set_fwnode() Bartosz Golaszewski
2026-06-02 21:41   ` Andy Shevchenko
2026-06-04 12:32     ` Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 08/23] driver core: platform: provide platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-06-02 21:44   ` Andy Shevchenko
2026-06-04 12:33     ` Bartosz Golaszewski
2026-06-05 12:16     ` Johan Hovold
2026-06-05 14:53       ` Andy Shevchenko
2026-05-21  8:36 ` [PATCH 09/23] of: platform: use platform_device_set_of_node() Bartosz Golaszewski
2026-06-01 23:35   ` Rob Herring (Arm)
2026-05-21  8:36 ` [PATCH 10/23] powerpc/powermac: " Bartosz Golaszewski
2026-05-21  8:36 ` [PATCH 11/23] i2c: pxa-pci: " Bartosz Golaszewski
2026-05-21  9:13   ` Wolfram Sang
2026-05-30  0:45   ` sashiko-bot
2026-06-04 23:51   ` Andi Shyti
2026-05-21  8:36 ` [PATCH 12/23] iommu/fsl: " Bartosz Golaszewski
2026-05-21  9:44   ` Robin Murphy
2026-05-21  8:36 ` [PATCH 13/23] net: bcmgenet: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 14/23] pmdomain: imx: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 15/23] mfd: tps6586: " Bartosz Golaszewski
2026-05-27 15:31   ` Lee Jones
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 16/23] slimbus: qcom-ngd-ctrl: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 17/23] net: mv643xx: " Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 18/23] drm/xe/i2c: use platform_device_set_fwnode() Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-21  8:36 ` [PATCH 19/23] platform/surface: gpe: " Bartosz Golaszewski
2026-05-28 11:21   ` Ilpo Järvinen
2026-05-21  8:36 ` [PATCH 20/23] usb: chipidea: use platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-06-02 21:49   ` Andy Shevchenko
2026-06-04 12:34     ` Bartosz Golaszewski
2026-06-05  6:59       ` Peter Chen (CIX)
2026-06-05  7:31         ` Andy Shevchenko
2026-06-05  6:57   ` Peter Chen (CIX)
2026-05-21  8:36 ` [PATCH 21/23] usb: musb: " Bartosz Golaszewski
2026-06-02 21:50   ` Andy Shevchenko
2026-05-21  8:36 ` [PATCH 22/23] reset: rzg2l: " Bartosz Golaszewski
2026-06-02  8:24   ` Philipp Zabel
2026-06-02 21:52     ` Andy Shevchenko
2026-06-05 12:18       ` Johan Hovold
2026-06-05 14:54         ` Andy Shevchenko
2026-05-21  8:36 ` [PATCH 23/23] driver core: platform: count references to all kinds of firmware nodes Bartosz Golaszewski
2026-05-30  0:45   ` sashiko-bot
2026-05-29 12:55 ` (subset) [PATCH 00/23] driver core: count references of the platform device's fwnode, not OF node Srinivas Kandagatla

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=20260530004539.C4AE91F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.