From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1014E253356; Thu, 9 Oct 2025 08:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759998478; cv=none; b=iGUZOj4zv1llAD0xbKX58Jm6U5eSiyArfn4o19wsJeaTH95FmYX0vwvKlFaXzY3DccJlUMThceOAXztKot6IcpfLBHbytqiG8WWgDV8phDIEhhOMiwnyuq+WYhgv0uZsLDMi4Tc5BQamoppTKRDU495s99vhnOZ3J2/ebWcnAgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759998478; c=relaxed/simple; bh=rZSSjMlfyp1/DY/FUZFefqXE1tJXo2iaAfShYMGP5t8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JrJeTmpHyeqJDfAzXGP53NtETLsncx27008gnGP2FCbPy+U2mfqC1NfM0+wjrPqMCEAjMLyuW/rQqaF55jrdGuS+gvDVSN6kQuEsW/gqLhP1pBBa/buQIvE4n8f4qryhTFENodI9gSZoYX7JJF0Pyn4ASAel+SzTVPnFCipx9tI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DdA+a5pI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DdA+a5pI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6564FC4CEE7; Thu, 9 Oct 2025 08:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759998477; bh=rZSSjMlfyp1/DY/FUZFefqXE1tJXo2iaAfShYMGP5t8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DdA+a5pIqIR7UM7ITP9VqMbrQ/uGA1V12t1LNQDOuPyrLQEoJKE5WKh2NSlGCFcFH uGV+H0pwp2yawTthgjn/F2Z0S6P2suSREhU47mceABhSQ+lsz4NACjbsay/R1WY6xl 63eVDxL1HjTFsgs/K4KbrMpb8/bYp4irws9z33gqhrlUwxHverez29c2Tz9ErOzkD4 lI3+p6SBzsx9lFVrFr5mtC7WR+54NC05PADE4DaHpGWvtVsMpKmDKEi7ct0qWmaPC0 Ke7yKxdzEgNBLhs2Eb1NQka8ViQMV9K4MiwFR6XhqnCVW6ZTKG2vr0HUAKxlQ2nSl/ qu7Zcvd+NNQBA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1v6m0B-000000001lE-3wvQ; Thu, 09 Oct 2025 10:27:55 +0200 Date: Thu, 9 Oct 2025 10:27:55 +0200 From: Johan Hovold To: Thierry Reding Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sven Peter , Janne Grunau , Rob Clark , Marek Szyprowski , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Chen-Yu Tsai , Krishna Reddy , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Thierry Reding , Miaoqian Lin Subject: Re: [PATCH v2 14/14] iommu/tegra: fix device leak on probe_device() Message-ID: References: <20251007094327.11734-1-johan@kernel.org> <20251007094327.11734-15-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KFWfMBBEp9y0HjZa" Content-Disposition: inline In-Reply-To: --KFWfMBBEp9y0HjZa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 d= evice_node *np) > > return NULL; > > =20 > > mc =3D platform_get_drvdata(pdev); > > - if (!mc) { > > - put_device(&pdev->dev); > > + put_device(&pdev->dev); > > + if (!mc) > > return NULL; > > - } > > =20 > > return mc->smmu; >=20 > 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 --KFWfMBBEp9y0HjZa Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQHbPq+cpGvN/peuzMLxc3C7H1lCAUCaOdyBwAKCRALxc3C7H1l CEs2AP0RtypMzHwKSdgb+1LkzszK9dEi+yrUUVVJnU4HXJHGcQD/W3QAlXRFlmAR 1c8Lq3vdjCx4jKS7G127MmgisGSECgw= =inx4 -----END PGP SIGNATURE----- --KFWfMBBEp9y0HjZa--