[Freedreno] [PATCH RFC 1/6] drm/msm: fix null pointer dereference in msm_atomic_prepare_fb()
Brian Masney
masneyb at onstation.org
Sun May 5 13:04:08 UTC 2019
_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 at onstation.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
More information about the Freedreno
mailing list