[PATCH] drm/tegra: dsi: fix device leak on probe

Johan Hovold posted 1 patch 2 months, 2 weeks ago
drivers/gpu/drm/tegra/dsi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[PATCH] drm/tegra: dsi: fix device leak on probe
Posted by Johan Hovold 2 months, 2 weeks ago
Make sure to drop the reference taken when looking up the companion
(ganged) device and its driver data during probe().

Note that holding a reference to a device does not prevent its driver
data from going away so there is no point in keeping the reference.

Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support")
Fixes: 221e3638feb8 ("drm/tegra: Fix reference leak in tegra_dsi_ganged_probe")
Cc: stable@vger.kernel.org	# 3.19: 221e3638feb8
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/tegra/dsi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index b5089b772267..b53038eb9699 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1549,11 +1549,9 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi)
 			return -EPROBE_DEFER;
 
 		dsi->slave = platform_get_drvdata(gangster);
-
-		if (!dsi->slave) {
-			put_device(&gangster->dev);
+		put_device(&gangster->dev);
+		if (!dsi->slave)
 			return -EPROBE_DEFER;
-		}
 
 		dsi->slave->master = dsi;
 	}
-- 
2.51.2
Re: [PATCH] drm/tegra: dsi: fix device leak on probe
Posted by Johan Hovold 3 weeks, 3 days ago
On Fri, Nov 21, 2025 at 05:42:01PM +0100, Johan Hovold wrote:
> Make sure to drop the reference taken when looking up the companion
> (ganged) device and its driver data during probe().
> 
> Note that holding a reference to a device does not prevent its driver
> data from going away so there is no point in keeping the reference.
> 
> Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support")
> Fixes: 221e3638feb8 ("drm/tegra: Fix reference leak in tegra_dsi_ganged_probe")
> Cc: stable@vger.kernel.org	# 3.19: 221e3638feb8
> Cc: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Can this one be picked up now?

Johan
Re: [PATCH] drm/tegra: dsi: fix device leak on probe
Posted by Thierry Reding 3 weeks, 1 day ago
On Wed, Jan 14, 2026 at 12:01:28PM +0100, Johan Hovold wrote:
> On Fri, Nov 21, 2025 at 05:42:01PM +0100, Johan Hovold wrote:
> > Make sure to drop the reference taken when looking up the companion
> > (ganged) device and its driver data during probe().
> > 
> > Note that holding a reference to a device does not prevent its driver
> > data from going away so there is no point in keeping the reference.
> > 
> > Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support")
> > Fixes: 221e3638feb8 ("drm/tegra: Fix reference leak in tegra_dsi_ganged_probe")
> > Cc: stable@vger.kernel.org	# 3.19: 221e3638feb8
> > Cc: Thierry Reding <treding@nvidia.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> 
> Can this one be picked up now?

Sorry, forgot to notify you earlier that I've picked this up into
drm-misc-next.

Thierry
Re: [PATCH] drm/tegra: dsi: fix device leak on probe
Posted by Johan Hovold 3 weeks, 1 day ago
On Fri, Jan 16, 2026 at 01:14:19PM +0100, Thierry Reding wrote:
> On Wed, Jan 14, 2026 at 12:01:28PM +0100, Johan Hovold wrote:
> > On Fri, Nov 21, 2025 at 05:42:01PM +0100, Johan Hovold wrote:
> > > Make sure to drop the reference taken when looking up the companion
> > > (ganged) device and its driver data during probe().
> > > 
> > > Note that holding a reference to a device does not prevent its driver
> > > data from going away so there is no point in keeping the reference.
> > > 
> > > Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support")
> > > Fixes: 221e3638feb8 ("drm/tegra: Fix reference leak in tegra_dsi_ganged_probe")
> > > Cc: stable@vger.kernel.org	# 3.19: 221e3638feb8
> > > Cc: Thierry Reding <treding@nvidia.com>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > 
> > Can this one be picked up now?
> 
> Sorry, forgot to notify you earlier that I've picked this up into
> drm-misc-next.

No worries, I noticed this morning when looking at linux-next.

Thanks!

Johan