All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/kmb: Fix potential invalid free of plane objects
@ 2026-11-18 14:15 Guangshuo Li
  2026-11-18 14:22 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-11-18 14:15 UTC (permalink / raw)
  To: Anitha Chrisanthus, David Airlie, Simona Vetter
  Cc: dri-devel, linux-kernel, stable

Plane objects use drmm_kzalloc() but their destroy callback frees them
with kfree(). The managed allocation can also be released before mode
configuration cleanup accesses the embedded plane.

Use ordinary allocations, matching the existing plane destroy callback.

This issue was found by our static analysis tool under development.

Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/gpu/drm/kmb/kmb_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
index 1742c2c6dfd8..7c908ca23e5b 100644
--- a/drivers/gpu/drm/kmb/kmb_plane.c
+++ b/drivers/gpu/drm/kmb/kmb_plane.c
@@ -581,7 +581,7 @@ struct kmb_plane *kmb_plane_init(struct drm_device *drm)
 				  BIT(DRM_MODE_BLEND_COVERAGE);
 
 	for (i = 0; i < KMB_MAX_PLANES; i++) {
-		plane = drmm_kzalloc(drm, sizeof(*plane), GFP_KERNEL);
+		plane = kzalloc_obj(*plane);
 
 		if (!plane) {
 			drm_err(drm, "Failed to allocate plane\n");
@@ -636,6 +636,6 @@ struct kmb_plane *kmb_plane_init(struct drm_device *drm)
 
 	return primary;
 cleanup:
-	drmm_kfree(drm, plane);
+	kfree(plane);
 	return ERR_PTR(ret);
 }
-- 
2.43.0


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

end of thread, other threads:[~2026-11-18 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 14:15 [PATCH] drm/kmb: Fix potential invalid free of plane objects Guangshuo Li
2026-11-18 14:22 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.