Commit 4c5376b4 authored by Ma Ke's avatar Ma Ke Committed by Thierry Reding
Browse files

drm/tegra: dc: Fix reference leak in tegra_dc_couple()



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: a31500fe ("drm/tegra: dc: Restore coupling of display controllers")
Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Acked-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20251022114720.24937-1-make24@iscas.ac.cn
parent 0a4a18e8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;