diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-08-11 16:16:06 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-08-16 09:21:18 -0400 |
commit | 2419672f4c96ca678a95d0f733f44d3ee036b5c8 (patch) | |
tree | 12f127f22ffad39fd641287d68b4f7ff8b90faf5 /drivers/gpu/drm/omapdrm/omap_crtc.c | |
parent | 4161f200ff380b0703c7bfa8df9615cc7fd76ba7 (diff) |
drm/omap: Potential NULL deref in omap_crtc_duplicate_state()
If the kmalloc() fails then we dereference "state" when we set
"state->zpos".
Fixes: 3dfeb631a15d ("drm/omap: Rework the rotation-on-crtc hack")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 400d0d2f6790..cc85c16cbc2a 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -589,8 +589,10 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc) | |||
589 | current_state = to_omap_crtc_state(crtc->state); | 589 | current_state = to_omap_crtc_state(crtc->state); |
590 | 590 | ||
591 | state = kmalloc(sizeof(*state), GFP_KERNEL); | 591 | state = kmalloc(sizeof(*state), GFP_KERNEL); |
592 | if (state) | 592 | if (!state) |
593 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); | 593 | return NULL; |
594 | |||
595 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); | ||
594 | 596 | ||
595 | state->zpos = current_state->zpos; | 597 | state->zpos = current_state->zpos; |
596 | state->rotation = current_state->rotation; | 598 | state->rotation = current_state->rotation; |