From: jsg Date: Tue, 9 Jan 2018 13:48:36 +0000 (+0000) Subject: Work around a problem with ww_mutexes in the drm modeset lock. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=564211fc8324e1aa1b07f1b6aef22d3c83ada672;p=openbsd 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@ --- 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);