aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch
new file mode 100644
index 00000000..6ed2fc2c
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1085-drm-amd-display-Check-for-NULL-when-creating-gamma-s.patch
@@ -0,0 +1,44 @@
+From 007bc14a0412afb0ef3823dc11465e77b20ab7c1 Mon Sep 17 00:00:00 2001
+From: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
+Date: Wed, 2 Jan 2019 14:12:53 -0500
+Subject: [PATCH 1085/2940] drm/amd/display: Check for NULL when creating gamma
+ struct
+
+[Wjy&How] Some stress test is causing unexpected memory allocation
+failure. This prevents null dereference but there will likely be problems
+later, hard to gracefully handle memalloc fail for critical objects.
+
+Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
+Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
+Acked-by: Leo Li <sunpeng.li@amd.com>
+Acked-by: Reza Amini <Reza.Amini@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+index c60c9b4c3075..ee6bd50f60b8 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+@@ -40,11 +40,14 @@ static void construct(struct dc_context *ctx, struct dc_plane_state *plane_state
+ plane_state->ctx = ctx;
+
+ plane_state->gamma_correction = dc_create_gamma();
+- plane_state->gamma_correction->is_identity = true;
++ if (plane_state->gamma_correction != NULL)
++ plane_state->gamma_correction->is_identity = true;
+
+ plane_state->in_transfer_func = dc_create_transfer_func();
+- plane_state->in_transfer_func->type = TF_TYPE_BYPASS;
+- plane_state->in_transfer_func->ctx = ctx;
++ if (plane_state->in_transfer_func != NULL) {
++ plane_state->in_transfer_func->type = TF_TYPE_BYPASS;
++ plane_state->in_transfer_func->ctx = ctx;
++ }
+ }
+
+ static void destruct(struct dc_plane_state *plane_state)
+--
+2.17.1
+