summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2018-01-09 13:48:36 +0000
committerjsg <jsg@openbsd.org>2018-01-09 13:48:36 +0000
commit564211fc8324e1aa1b07f1b6aef22d3c83ada672 (patch)
treece38c98686dec488fc0068419198f5008a55447d
parentDo not truncate 64bit integers when pretty-printing types. (diff)
downloadwireguard-openbsd-564211fc8324e1aa1b07f1b6aef22d3c83ada672.tar.xz
wireguard-openbsd-564211fc8324e1aa1b07f1b6aef22d3c83ada672.zip
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@
-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);