[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190505130413.32253-2-masneyb@onstation.org>
Date: Sun, 5 May 2019 09:04:08 -0400
From: Brian Masney <masneyb@...tation.org>
To: robdclark@...il.com, sean@...rly.run,
dri-devel@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
freedreno@...ts.freedesktop.org, airlied@...ux.ie, daniel@...ll.ch,
linux-kernel@...r.kernel.org, linus.walleij@...aro.org
Subject: [PATCH RFC 1/6] drm/msm: fix null pointer dereference in msm_atomic_prepare_fb()
_msm_gem_new() calls msm_gem_new_impl() with a NULL reservation_object
struct. msm_atomic_prepare_fb() assumes that the reservation_object is
always set, and attempts to reference a NULL pointer. Correct this by
checking to see if this value is NULL.
Signed-off-by: Brian Masney <masneyb@...tation.org>
---
drivers/gpu/drm/msm/msm_atomic.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index f5b1256e32b6..0da80a93876a 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -56,10 +56,12 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,
return 0;
obj = msm_framebuffer_bo(new_state->fb, 0);
- msm_obj = to_msm_bo(obj);
- fence = reservation_object_get_excl_rcu(msm_obj->resv);
- drm_atomic_set_fence_for_plane(new_state, fence);
+ msm_obj = to_msm_bo(obj);
+ if (msm_obj->resv) {
+ fence = reservation_object_get_excl_rcu(msm_obj->resv);
+ drm_atomic_set_fence_for_plane(new_state, fence);
+ }
return msm_framebuffer_prepare(new_state->fb, kms->aspace);
}
--
2.20.1
Powered by blists - more mailing lists