mirror of https://gitee.com/openkylin/linux.git
drm/omap: Potential NULL deref in omap_crtc_duplicate_state()
If the kmalloc() fails then we dereference "state" when we set
"state->zpos".
Fixes: 3dfeb631a1
("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>
This commit is contained in:
parent
4161f200ff
commit
2419672f4c
|
@ -589,8 +589,10 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc)
|
|||
current_state = to_omap_crtc_state(crtc->state);
|
||||
|
||||
state = kmalloc(sizeof(*state), GFP_KERNEL);
|
||||
if (state)
|
||||
__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
|
||||
if (!state)
|
||||
return NULL;
|
||||
|
||||
__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
|
||||
|
||||
state->zpos = current_state->zpos;
|
||||
state->rotation = current_state->rotation;
|
||||
|
|
Loading…
Reference in New Issue