summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2019-01-10 19:19:31 +0900
committerHoegeun Kwon <hoegeun.kwon@samsung.com>2019-02-28 15:22:51 +0900
commit071ededc197a4a867abecb0bba308585b33fb5b9 (patch)
treee27a20b87e7c0a94bd9c0305d1f2b166863b3b9f /drivers
parent5d2758ed3d090a90860ccc53e6c5bd61307c611c (diff)
downloadlinux-exynos-071ededc197a4a867abecb0bba308585b33fb5b9.tar.gz
linux-exynos-071ededc197a4a867abecb0bba308585b33fb5b9.tar.bz2
linux-exynos-071ededc197a4a867abecb0bba308585b33fb5b9.zip
gpu/drm: Fix lock held when returning to user space.
We need to call drm_modeset_acquire_fini() when drm_atomic_state_alloc() failed or call drm_modeset_acquire_init() after drm_atomic_state_alloc() succeeded. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: syzbot <syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/1547115571-21219-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp [hoegeun.kwon: this patch from the mainline 4089e272ac61 and it has been modified to be able to backport linux-v4.14.] Change-Id: Iaa0d6e104054abc11181c43bdb6283a8bd30eb19 Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_atomic.c3
-rw-r--r--drivers/gpu/drm/drm_mode_object.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index bb5cc15fa0b9..8bb5088af5b1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -2247,12 +2247,11 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
(arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
return -EINVAL;
- drm_modeset_acquire_init(&ctx, 0);
-
state = drm_atomic_state_alloc(dev);
if (!state)
return -ENOMEM;
+ drm_modeset_acquire_init(&ctx, 0);
state->acquire_ctx = &ctx;
state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index 1055533792f3..4177ee270de5 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -432,11 +432,11 @@ static int set_property_atomic(struct drm_mode_object *obj,
struct drm_modeset_acquire_ctx ctx;
int ret;
- drm_modeset_acquire_init(&ctx, 0);
-
state = drm_atomic_state_alloc(dev);
if (!state)
return -ENOMEM;
+
+ drm_modeset_acquire_init(&ctx, 0);
state->acquire_ctx = &ctx;
retry:
if (prop == state->dev->mode_config.dpms_property) {