Commit 2419672f authored by Dan Carpenter's avatar Dan Carpenter Committed by Tomi Valkeinen

drm/omap: Potential NULL deref in omap_crtc_duplicate_state()

If the kmalloc() fails then we dereference "state" when we set
"state->zpos".

Fixes: 3dfeb631 ("drm/omap: Rework the rotation-on-crtc hack")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4161f200
...@@ -589,8 +589,10 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc) ...@@ -589,8 +589,10 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc)
current_state = to_omap_crtc_state(crtc->state); current_state = to_omap_crtc_state(crtc->state);
state = kmalloc(sizeof(*state), GFP_KERNEL); state = kmalloc(sizeof(*state), GFP_KERNEL);
if (state) if (!state)
__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); return NULL;
__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
state->zpos = current_state->zpos; state->zpos = current_state->zpos;
state->rotation = current_state->rotation; state->rotation = current_state->rotation;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment