aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch
new file mode 100644
index 00000000..1dc1f2fd
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2688-amdgpu-dc-handle-allocation-failures-in-dc_commit_pl.patch
@@ -0,0 +1,41 @@
+From 880c5561dbab85020f1c9df8be711fc1c9a519ff Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Tue, 7 Nov 2017 05:21:18 +1000
+Subject: [PATCH 2688/4131] amdgpu/dc: handle allocation failures in
+ dc_commit_planes_to_stream.
+
+Reported-by smatch:
+drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:966 dc_commit_planes_to_stream() error: potential null dereference 'flip_addr'. (kcalloc returns null)
+drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:968 dc_commit_planes_to_stream() error: potential null dereference 'plane_info'. (kcalloc returns null)
+drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:978 dc_commit_planes_to_stream() error: potential null dereference 'scaling_info'. (kcalloc returns null)
+
+Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
+Reviewed-by: Harry Wentland <harry.wentland@amd.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
+index a8a3ca4..4118a34 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
+@@ -946,6 +946,14 @@ bool dc_commit_planes_to_stream(
+ scaling_info = kcalloc(MAX_SURFACES, sizeof(struct dc_scaling_info),
+ GFP_KERNEL);
+
++ if (!flip_addr || !plane_info || !scaling_info) {
++ kfree(flip_addr);
++ kfree(plane_info);
++ kfree(scaling_info);
++ kfree(stream_update);
++ return false;
++ }
++
+ memset(updates, 0, sizeof(updates));
+
+ stream_update->src = dc_stream->src;
+--
+2.7.4
+