[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190309042450.4188-1-kjlu@umn.edu>
Date: Fri, 8 Mar 2019 22:24:50 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] gpu: i915: fix a missing check of get_free_page
If the allocation fails, return false to avoid potential
NULL pointer dereference
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9a65341fec09..ad54fc3551df 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -227,8 +227,11 @@ static bool compress_init(struct compress *c)
}
c->tmp = NULL;
- if (i915_has_memcpy_from_wc())
+ if (i915_has_memcpy_from_wc()) {
c->tmp = (void *)__get_free_page(GFP_ATOMIC | __GFP_NOWARN);
+ if (!c->tmp)
+ return false;
+ }
return true;
}
--
2.17.1
Powered by blists - more mailing lists