From cfa1a918b6d6b2d0fd9ae0f58f5b86a15c443dcb Mon Sep 17 00:00:00 2001 From: Michel Daenzer Date: Sat, 21 Sep 2002 23:18:54 +0000 Subject: make sure we never oops because the hardware lock pointer in the sigdata structure is out of date --- linux-core/drm_bufs.c | 1 + linux-core/drm_drv.c | 4 ++-- linux-core/drm_lock.c | 2 +- linux/drm_bufs.h | 1 + linux/drm_drv.h | 4 ++-- linux/drm_lock.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index 3ff3527f..9ce7cfff 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -137,6 +137,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, } map->offset = (unsigned long)map->handle; if ( map->flags & _DRM_CONTAINS_LOCK ) { + dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 81bd7894..7e2cfd8c 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -306,7 +306,7 @@ static int DRM(setup)( drm_device_t *dev ) dev->map_count = 0; dev->vmalist = NULL; - dev->lock.hw_lock = NULL; + dev->sigdata.lock = dev->lock.hw_lock = NULL; init_waitqueue_head( &dev->lock.lock_queue ); dev->queue_count = 0; dev->queue_reserved = 0; @@ -491,7 +491,7 @@ static int DRM(takedown)( drm_device_t *dev ) DRM(dma_takedown)( dev ); #endif if ( dev->lock.hw_lock ) { - dev->lock.hw_lock = NULL; /* SHM removed */ + dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; wake_up_interruptible( &dev->lock.lock_queue ); } diff --git a/linux-core/drm_lock.c b/linux-core/drm_lock.c index c10cfe2c..c887d1f6 100644 --- a/linux-core/drm_lock.c +++ b/linux-core/drm_lock.c @@ -237,7 +237,7 @@ int DRM(notifier)(void *priv) /* Allow signal delivery if lock isn't held */ - if (!_DRM_LOCK_IS_HELD(s->lock->lock) + if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; /* Otherwise, set flag to force call to diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index 3ff3527f..9ce7cfff 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -137,6 +137,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, } map->offset = (unsigned long)map->handle; if ( map->flags & _DRM_CONTAINS_LOCK ) { + dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 81bd7894..7e2cfd8c 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -306,7 +306,7 @@ static int DRM(setup)( drm_device_t *dev ) dev->map_count = 0; dev->vmalist = NULL; - dev->lock.hw_lock = NULL; + dev->sigdata.lock = dev->lock.hw_lock = NULL; init_waitqueue_head( &dev->lock.lock_queue ); dev->queue_count = 0; dev->queue_reserved = 0; @@ -491,7 +491,7 @@ static int DRM(takedown)( drm_device_t *dev ) DRM(dma_takedown)( dev ); #endif if ( dev->lock.hw_lock ) { - dev->lock.hw_lock = NULL; /* SHM removed */ + dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; wake_up_interruptible( &dev->lock.lock_queue ); } diff --git a/linux/drm_lock.h b/linux/drm_lock.h index c10cfe2c..c887d1f6 100644 --- a/linux/drm_lock.h +++ b/linux/drm_lock.h @@ -237,7 +237,7 @@ int DRM(notifier)(void *priv) /* Allow signal delivery if lock isn't held */ - if (!_DRM_LOCK_IS_HELD(s->lock->lock) + if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; /* Otherwise, set flag to force call to -- cgit v1.2.3