From: Johan Hovold <johan@kernel.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>, Sven Peter <sven@kernel.org>,
Janne Grunau <j@jannau.net>,
Rob Clark <robin.clark@oss.qualcomm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Yong Wu <yong.wu@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Chen-Yu Tsai <wens@csie.org>, Krishna Reddy <vdumpa@nvidia.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Thierry Reding <treding@nvidia.com>,
Miaoqian Lin <linmq006@gmail.com>
Subject: Re: [PATCH v2 14/14] iommu/tegra: fix device leak on probe_device()
Date: Thu, 9 Oct 2025 10:27:55 +0200 [thread overview]
Message-ID: <aOdyC1toHHIeE4i5@hovoldconsulting.com> (raw)
In-Reply-To: <rp2yiradenf3twznebagx7tgsruwh66exiikal37c4fwo75t4t@4breto65stqt>
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
On Thu, Oct 09, 2025 at 09:56:18AM +0200, Thierry Reding wrote:
> On Tue, Oct 07, 2025 at 11:43:27AM +0200, Johan Hovold wrote:
> > @@ -830,10 +830,9 @@ static struct tegra_smmu *tegra_smmu_find(struct device_node *np)
> > return NULL;
> >
> > mc = platform_get_drvdata(pdev);
> > - if (!mc) {
> > - put_device(&pdev->dev);
> > + put_device(&pdev->dev);
> > + if (!mc)
> > return NULL;
> > - }
> >
> > return mc->smmu;
>
> pdev->dev is what's backing mc, so if we use put_device() here, then the
> MC could go away at any time, right?
Holding a reference to a device does not prevent its driver data from
going away so there is no point in keeping the reference.
But from what I can tell, you don't need to worry about that anyway
since it's the memory controller driver that registers the iommu (and
the driver can't be unbound).
Johan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-10-09 8:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251007094327.11734-1-johan@kernel.org>
2025-10-07 9:43 ` [PATCH v2 01/14] iommu/apple-dart: fix device leak on of_xlate() Johan Hovold
2025-10-07 9:43 ` [PATCH v2 02/14] iommu/qcom: " Johan Hovold
2025-10-07 9:43 ` [PATCH v2 03/14] iommu/exynos: " Johan Hovold
2025-10-07 9:49 ` Marek Szyprowski
2025-10-07 9:43 ` [PATCH v2 04/14] iommu/ipmmu-vmsa: " Johan Hovold
2025-10-07 9:43 ` [PATCH v2 05/14] iommu/mediatek: " Johan Hovold
2025-10-18 6:50 ` Yong Wu (吴勇)
2025-10-07 9:43 ` [PATCH v2 06/14] iommu/mediatek: fix device leaks on probe() Johan Hovold
2025-10-18 6:54 ` Yong Wu (吴勇)
2025-10-20 5:02 ` Johan Hovold
2025-10-07 9:43 ` [PATCH v2 08/14] iommu/mediatek-v1: fix device leak on probe_device() Johan Hovold
2025-10-18 6:51 ` Yong Wu (吴勇)
2025-10-07 9:43 ` [PATCH v2 09/14] iommu/mediatek-v1: fix device leaks on probe() Johan Hovold
2025-10-07 9:43 ` [PATCH v2 11/14] iommu/omap: fix device leaks on probe_device() Johan Hovold
2025-10-07 9:43 ` [PATCH v2 13/14] iommu/sun50i: fix device leak on of_xlate() Johan Hovold
2025-10-07 9:43 ` [PATCH v2 14/14] iommu/tegra: fix device leak on probe_device() Johan Hovold
2025-10-09 7:56 ` Thierry Reding
2025-10-09 8:27 ` Johan Hovold [this message]
2025-10-09 10:15 ` Thierry Reding
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=aOdyC1toHHIeE4i5@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=iommu@lists.linux.dev \
--cc=j@jannau.net \
--cc=joro@8bytes.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=matthias.bgg@gmail.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=sven@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=treding@nvidia.com \
--cc=vdumpa@nvidia.com \
--cc=wens@csie.org \
--cc=will@kernel.org \
--cc=yong.wu@mediatek.com \
/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