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 49154253F20; Mon, 23 Jun 2025 13:35:52 +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=1750685752; cv=none; b=QS6PS/oI5BT3dRt/RwQlHpAGsfGAPOE/kWgwnEt7LRIjzmhbg4nyDPXFm5Vbw3DBo3s0H69dcRBuEsQMg6+zcxbV/XxIx0LuL9VtHsT4bi81Ner3Q+K9PaEjqqoftU03katYyZMtfACgbdqO6KJkgXfkeXhDZPZgWszeY94xz5M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750685752; c=relaxed/simple; bh=W5O5+1+J3OWzmHmw1ZEMNlF/sBKNSHkEyTdyxzpDxQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AXZBTtv6vpWpo01qATVgKkLB3zTi+aGd7GlNKzue3+M2tJFDXRKIKdf513Li+KTMYUtaVTEImKHcaUt34ufDq22MFy+4VdaIYe7bk7PeJ1EUzQiYV+/aUeRO44vVb+REZOQ/fhETTi16Q6owPbSoYPeqpLEJ9MrY3Bth2xzyKRU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nBjsK94r; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nBjsK94r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2A24C4CEEA; Mon, 23 Jun 2025 13:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750685752; bh=W5O5+1+J3OWzmHmw1ZEMNlF/sBKNSHkEyTdyxzpDxQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBjsK94req1+X0qlvBzf9n8TBXtYBLk9Tbeoc6unFPa7B5REZXFSRqgM6J3Lm7sEd 5Zlcf7zFWKMLhp9HhpF0Hlk1jK5825H8s9gmqoAc/9OeUo75Q6DvXm7cq7YyGc8Iog MBIehPyat+Z3PU52mODOLfOhNW9zIB8iQSQfwlA8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Biju Das , Thierry Reding , Sasha Levin Subject: [PATCH 6.1 050/508] drm/tegra: rgb: Fix the unbound reference count Date: Mon, 23 Jun 2025 15:01:35 +0200 Message-ID: <20250623130646.477698409@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130645.255320792@linuxfoundation.org> References: <20250623130645.255320792@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Biju Das [ Upstream commit 3c3642335065c3bde0742b0edc505b6ea8fdc2b3 ] The of_get_child_by_name() increments the refcount in tegra_dc_rgb_probe, but the driver does not decrement the refcount during unbind. Fix the unbound reference count using devm_add_action_or_reset() helper. Fixes: d8f4a9eda006 ("drm: Add NVIDIA Tegra20 support") Signed-off-by: Biju Das Signed-off-by: Thierry Reding Link: https://lore.kernel.org/r/20250205112137.36055-1-biju.das.jz@bp.renesas.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/rgb.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 86e55e5d12b39..20ac30673ed53 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -189,6 +189,11 @@ static const struct drm_encoder_helper_funcs tegra_rgb_encoder_helper_funcs = { .atomic_check = tegra_rgb_encoder_atomic_check, }; +static void tegra_dc_of_node_put(void *data) +{ + of_node_put(data); +} + int tegra_dc_rgb_probe(struct tegra_dc *dc) { struct device_node *np; @@ -196,7 +201,14 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc) int err; np = of_get_child_by_name(dc->dev->of_node, "rgb"); - if (!np || !of_device_is_available(np)) + if (!np) + return -ENODEV; + + err = devm_add_action_or_reset(dc->dev, tegra_dc_of_node_put, np); + if (err < 0) + return err; + + if (!of_device_is_available(np)) return -ENODEV; rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL); -- 2.39.5