summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>2026-01-13 15:52:54 +0530
committerMaarten Lankhorst <dev@lankhorst.se>2026-01-22 10:26:55 +0100
commit0a095b64fa5b4b1edfeb2e9b1751e044230c5d73 (patch)
tree50754373805eaeca5f9d769fd80750db84a8d269 /drivers/gpu/drm
parentcce30b8311e8a342f97cee60a72c2d921605adbd (diff)
drm/i915/display: Fix color pipeline enum name leak
intel_color_pipeline_plane_init() allocates enum names for color pipelines, which are copied by drm_property_create_enum(). The temporary strings were not freed, resulting in a memory leak. Allocate enum names only after successful pipeline construction and free them on all exit paths. Fixes: ef105316819d ("drm/i915/color: Create a transfer function color pipeline") Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Uma Shankar <uma.shankar@intel.com> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se> Acked-by: Jani Nikula <jani.nikula@intel.com> Link: https://patch.msgid.link/20260113102303.724205-5-chaitanya.kumar.borah@intel.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/display/intel_color_pipeline.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
index 684641c8323b..04af552b3648 100644
--- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
+++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
@@ -34,7 +34,6 @@ int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_en
return ret;
list->type = colorop->base.base.id;
- list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", colorop->base.base.id);
/* TODO: handle failures and clean up */
prev_op = &colorop->base;
@@ -74,6 +73,8 @@ int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_en
drm_colorop_set_next_property(prev_op, &colorop->base);
+ list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", list->type);
+
return 0;
}
@@ -81,9 +82,10 @@ int intel_color_pipeline_plane_init(struct drm_plane *plane, enum pipe pipe)
{
struct drm_device *dev = plane->dev;
struct intel_display *display = to_intel_display(dev);
- struct drm_prop_enum_list pipelines[MAX_COLOR_PIPELINES];
+ struct drm_prop_enum_list pipelines[MAX_COLOR_PIPELINES] = {};
int len = 0;
- int ret;
+ int ret = 0;
+ int i;
/* Currently expose pipeline only for HDR planes */
if (!icl_is_hdr_plane(display, to_intel_plane(plane)->id))
@@ -92,8 +94,14 @@ int intel_color_pipeline_plane_init(struct drm_plane *plane, enum pipe pipe)
/* Add pipeline consisting of transfer functions */
ret = _intel_color_pipeline_plane_init(plane, &pipelines[len], pipe);
if (ret)
- return ret;
+ goto out;
len++;
- return drm_plane_create_color_pipeline_property(plane, pipelines, len);
+ ret = drm_plane_create_color_pipeline_property(plane, pipelines, len);
+
+ for (i = 0; i < len; i++)
+ kfree(pipelines[i].name);
+
+out:
+ return ret;
}