[PATCH] drm/kmb: Fix potential invalid free of plane objects

From: Guangshuo Li

Date: Wed Nov 18 2026 - 09:15:40 EST


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@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
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