summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-01-09 13:48:37 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-01-09 13:48:37 +0000
commit762f64c401e8c81020cf5fe93c9d3eb6666f5d9f (patch)
tree0f4b5272d900f2626edc764e98bf37e03a2a16bd /sys/dev/pci
parent5151fb35ae04d7b5f666d1a8d1fc477dab57194d (diff)
Work around a problem with ww_mutexes in the drm modeset lock.
Screen blanks often result in a NULL dereference in __ww_mutex_lock with lock->acquired being non zero and lock->ctx NULL. mpi@ also reported it occuring when switching from Xorg to a virtual terminal. ok mpi@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/linux_ww_mutex.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/linux_ww_mutex.h b/sys/dev/pci/drm/linux_ww_mutex.h
index 69d50d4c669..fb1b26791f6 100644
--- a/sys/dev/pci/drm/linux_ww_mutex.h
+++ b/sys/dev/pci/drm/linux_ww_mutex.h
@@ -163,7 +163,8 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx, bool slow, bo
* the `younger` process gives up all it's
* resources.
*/
- if (slow || ctx == NULL || ctx->stamp < lock->ctx->stamp) {
+ if (slow || ctx == NULL ||
+ (lock->ctx != NULL && ctx->stamp < lock->ctx->stamp)) {
int s = msleep(lock, &lock->lock,
intr ? PCATCH : 0,
ctx ? ctx->ww_class->name : "ww_mutex_lock", 0);