From nobody Mon Feb 9 16:19:51 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 1E1AF44D6B3 for ; Wed, 21 Jan 2026 23:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769037486; cv=none; b=gjNucRT7/1DEY81mlK5hUaZBfHww0nYAc8mqn21JjHvQXI6xYN3brouWHPTO6kyhjozL7h8u77YkPqNQP1s4/5YCk1cHCG5x3UF9NQwNOJFhTlqU5zVDqG2XZaZPWSsqKdWPdPJjUE6xH4eSVC/QTc6oNgbrfpRUOpNU+CsuZYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769037486; c=relaxed/simple; bh=dpoYWqd1QmnsLx6bOVdrexg1n+TySTa7C5ZjTOClS1o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L/RHrXnKBF4lTkMz+2shIiyEN2luH5MqzrgLdMNg5Mj9WTTBKtF/mUm2MBUYmEBT6Ietw9ib9Pg7QjNfVzJH70XrtrmRejBpJ6hvT/NWPi6v9c0cnPRd7Dp1Bfsqix2SiRqPNsuptLsgmSli8B2lbYqC8Rm4ahdbNJo38GrG67s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=WmkOCjlm; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="WmkOCjlm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1769037478; bh=dpoYWqd1QmnsLx6bOVdrexg1n+TySTa7C5ZjTOClS1o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WmkOCjlmRtLu+l8Km1N1C2KS7UYRCQ5tK4kqWH1VIyahTF1slmQOsO24HtsXeZjhi 2x3mzkXhN01byqHSVVJI2y79y63qxIpiYPJc8+FKpUyvXsoYp9Ch1zeXl+6HkVYf4g Rp6hzYcueD758rI/cx4HSOviiQNVRsKvZe7d0grpqRacx6UlktRHD7l4pIbN9n/x/p Gs8fG579QoHbKHwlmLtWNBz1MJut0imOSvho0jpvOmZtSR666WH+QIK3/VAHV+oUCA Kr6ElGZWWOh3bQIJS8oZ7UMmOcPmqOS+SgeiS5VMATX3+23VusB0fQWeMuuBxzNidk qySt14u09YTLg== Received: from localhost (unknown [82.79.138.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 442B117E1389; Thu, 22 Jan 2026 00:17:58 +0100 (CET) From: Cristian Ciocaltea Date: Thu, 22 Jan 2026 01:17:34 +0200 Subject: [PATCH 1/6] drm/rockchip: inno-hdmi: Switch to drmm_kzalloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260122-drm-rk-fixes-v1-1-3942f185750e@collabora.com> References: <20260122-drm-rk-fixes-v1-0-3942f185750e@collabora.com> In-Reply-To: <20260122-drm-rk-fixes-v1-0-3942f185750e@collabora.com> To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.3 Driver makes use of drmm_encoder_init() to initialize the encoder and automatically handle the cleanup by registering drm_encoder_cleanup() with drmm_add_action(). However, the internal structure containing the encoder part gets allocated with devm_kzalloc(), which happens while component_bind_all() is being called from Rockchip DRM driver. The component framework further ensures it is deallocated as part of releasing all the resources claimed during bind, which is triggered from component_unbind_all(). When the reference to the DRM device gets eventually dropped via drm_dev_put() in rockchip_drm_unbind(), drmm_encoder_alloc_release() attempts to access the now released encoder structure, leading to use-after-free. Ensure driver's internal structure is still reachable on encoder cleanup by switching from a device-managed allocation to a drm-managed one. Fixes: 969325a2597e ("drm/rockchip: inno-hdmi: Convert to drm bridge") Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c b/drivers/gpu/dr= m/rockchip/inno_hdmi-rockchip.c index 97c20500f790..28e6fb09aae7 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c @@ -14,6 +14,7 @@ =20 #include #include +#include #include =20 #include "rockchip_drm_drv.h" @@ -90,7 +91,7 @@ static int inno_hdmi_rockchip_bind(struct device *dev, st= ruct device *master, vo const struct inno_hdmi_plat_data *plat_data; int ret; =20 - hdmi =3D devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); + hdmi =3D drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; =20 --=20 2.52.0