public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/tegra: dc: fix reference leak in tegra_dc_couple()
@ 2025-09-27  9:47 Ma Ke
  2025-09-27 12:43 ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Ma Ke @ 2025-09-27  9:47 UTC (permalink / raw)
  To: thierry.reding, mperttunen, airlied, simona, jonathanh
  Cc: dri-devel, linux-tegra, linux-kernel, akpm, Ma Ke, stable

driver_find_device() calls get_device() to increment the reference
count once a matching device is found, but there is no put_device() to
balance the reference count. To avoid reference count leakage, add
put_device() to decrease the reference count.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: a31500fe7055 ("drm/tegra: dc: Restore coupling of display controllers")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
 drivers/gpu/drm/tegra/dc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 59d5c1ba145a..6c84bd69b11f 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -3148,6 +3148,7 @@ static int tegra_dc_couple(struct tegra_dc *dc)
 		dc->client.parent = &parent->client;
 
 		dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion));
+		put_device(companion);
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tegra: dc: fix reference leak in tegra_dc_couple()
  2025-09-27  9:47 [PATCH] drm/tegra: dc: fix reference leak in tegra_dc_couple() Ma Ke
@ 2025-09-27 12:43 ` Markus Elfring
  2025-09-27 18:09   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-09-27 12:43 UTC (permalink / raw)
  To: make24, linux-tegra, dri-devel, David Airlie, Jonathan Hunter,
	Mikko Perttunen, Simona Vetter, Thierry Reding
  Cc: stable, LKML, Andrew Morton

> driver_find_device() calls get_device() to increment the reference
> count once a matching device is found, but there is no put_device() to
> balance the reference count. To avoid reference count leakage, add
> put_device() to decrease the reference count.

How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tegra: dc: fix reference leak in tegra_dc_couple()
  2025-09-27 12:43 ` Markus Elfring
@ 2025-09-27 18:09   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-09-27 18:09 UTC (permalink / raw)
  To: Markus Elfring
  Cc: make24, linux-tegra, dri-devel, David Airlie, Jonathan Hunter,
	Mikko Perttunen, Simona Vetter, Thierry Reding, stable, LKML,
	Andrew Morton

On Sat, Sep 27, 2025 at 02:43:17PM +0200, Markus Elfring wrote:
> > driver_find_device() calls get_device() to increment the reference
> > count once a matching device is found, but there is no put_device() to
> > balance the reference count. To avoid reference count leakage, add
> > put_device() to decrease the reference count.
> 
> How do you think about to increase the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180


Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-27 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-27  9:47 [PATCH] drm/tegra: dc: fix reference leak in tegra_dc_couple() Ma Ke
2025-09-27 12:43 ` Markus Elfring
2025-09-27 18:09   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox