drm: fix null pointer dereference on null state pointer
authorColin Ian King <colin.king@canonical.com>
Sat, 22 Dec 2018 13:00:46 +0000 (13:00 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 24 Dec 2018 10:52:43 +0000 (11:52 +0100)
commitcbdd2663f4c801ad93f7111f93d9846589a0d530
treece2800348f3c1c9a83a792a49b692dd924565096
parent221b35fedee1b38b9cee99320f0c60263d229e14
drm: fix null pointer dereference on null state pointer

In the case where state cannot be allocated, the current exit path via
label 'out' will dereference the null state pointer when calling
drm_atomic_state_put. Fix this by adding a new error exit label and
jumping to this to avoid the drm_atomic_state_put.

Detected by CoverityScan, CID#1476034 ("Dereference after null check")

Fixes: b9fc5e01d1ce ("drm: Add helper to implement legacy dirtyfb")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181222130046.14083-1-colin.king@canonical.com
drivers/gpu/drm/drm_damage_helper.c