]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/tegra: dc: Fix reference leak in tegra_dc_couple()
authorMa Ke <make24@iscas.ac.cn>
Wed, 22 Oct 2025 11:47:20 +0000 (19:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:12:38 +0000 (06:12 +0900)
commit 4c5376b4b143c4834ebd392aef2215847752b16a upstream.

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>
Acked-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20251022114720.24937-1-make24@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/tegra/dc.c

index 557eaaaab1c33fd58da9b8dc9e15940f50b44fb1..35a1371fb10e2dbac9b0acce272bdc9fb3617ed4 100644 (file)
@@ -3141,6 +3141,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;