diff options
author | Eric Anholt <anholt@freebsd.org> | 2003-10-24 21:49:28 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2003-10-24 21:49:28 +0000 |
commit | 2423fedcc8d57d02ccf7aa1209a4b31f248792a7 (patch) | |
tree | f2e426fb4458cbb840f2902dd953af568e016ada | |
parent | e4a2a9c04024972f21cdf0620f6faa6de157686d (diff) |
Don't try to use dev->dma_lock unless dma is initialized (dev->dma != NULL)
in bufs_info sysctl handler. dev->dma and dev->dma_lock existence are
protected by DRM_LOCK(). Fixes panic on sysctl hw.dri when the device
is uninitialied (when you aren't in X).
-rw-r--r-- | bsd-core/drm_sysctl.c | 3 | ||||
-rw-r--r-- | bsd/drm_sysctl.h | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c index 905f4c24..4bb603f4 100644 --- a/bsd-core/drm_sysctl.c +++ b/bsd-core/drm_sysctl.c @@ -224,12 +224,11 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS * copy of the whole structure and the relevant data from buflist. */ DRM_LOCK(); - DRM_SPINLOCK(&dev->dma_lock); if (dma == NULL) { - DRM_SPINUNLOCK(&dev->dma_lock); DRM_UNLOCK(); return 0; } + DRM_SPINLOCK(&dev->dma_lock); tempdma = *dma; templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS); for (i = 0; i < dma->buf_count; i++) diff --git a/bsd/drm_sysctl.h b/bsd/drm_sysctl.h index 905f4c24..4bb603f4 100644 --- a/bsd/drm_sysctl.h +++ b/bsd/drm_sysctl.h @@ -224,12 +224,11 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS * copy of the whole structure and the relevant data from buflist. */ DRM_LOCK(); - DRM_SPINLOCK(&dev->dma_lock); if (dma == NULL) { - DRM_SPINUNLOCK(&dev->dma_lock); DRM_UNLOCK(); return 0; } + DRM_SPINLOCK(&dev->dma_lock); tempdma = *dma; templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS); for (i = 0; i < dma->buf_count; i++) |