Last active
September 30, 2017 11:38
-
-
Save lategoodbye/73f489adacb2e689ccc7017397c90a73 to your computer and use it in GitHub Desktop.
Possible fix NULL pointer dereference during VC4 binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 88bffea2fd7a573f7e9659b188a125cd9842f79b Mon Sep 17 00:00:00 2001 | |
From: Stefan Wahren <[email protected]> | |
Date: Sat, 30 Sep 2017 13:28:40 +0200 | |
Subject: [PATCH] drm: vc4: Fix race during binding | |
This fixes the race between vc4_overflow_mem_work and the init of the | |
job lock. Otherwise we could trigger a NULL pointer dereference | |
during binding. | |
Signed-off-by: Stefan Wahren <[email protected]> | |
--- | |
drivers/gpu/drm/vc4/vc4_gem.c | 1 - | |
drivers/gpu/drm/vc4/vc4_irq.c | 1 + | |
2 files changed, 1 insertion(+), 1 deletion(-) | |
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c | |
index 994295f..c869ad0 100644 | |
--- a/drivers/gpu/drm/vc4/vc4_gem.c | |
+++ b/drivers/gpu/drm/vc4/vc4_gem.c | |
@@ -934,7 +934,6 @@ vc4_gem_init(struct drm_device *dev) | |
INIT_LIST_HEAD(&vc4->render_job_list); | |
INIT_LIST_HEAD(&vc4->job_done_list); | |
INIT_LIST_HEAD(&vc4->seqno_cb_list); | |
- spin_lock_init(&vc4->job_lock); | |
INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); | |
setup_timer(&vc4->hangcheck.timer, | |
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c | |
index c43ee1e..2a0a7a7 100644 | |
--- a/drivers/gpu/drm/vc4/vc4_irq.c | |
+++ b/drivers/gpu/drm/vc4/vc4_irq.c | |
@@ -190,6 +190,7 @@ vc4_irq_preinstall(struct drm_device *dev) | |
struct vc4_dev *vc4 = to_vc4_dev(dev); | |
init_waitqueue_head(&vc4->job_wait_queue); | |
+ spin_lock_init(&vc4->job_lock); | |
INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); | |
/* Clear any pending interrupts someone might have left around | |
-- | |
2.7.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment