diff options
| author | Eric Anholt <anholt@freebsd.org> | 2003-11-06 04:48:06 +0000 | 
|---|---|---|
| committer | Eric Anholt <anholt@freebsd.org> | 2003-11-06 04:48:06 +0000 | 
| commit | 1f7598245af7e73b34130a44fbaac230e29d7aad (patch) | |
| tree | 050abd77d041309e17a37649ed41e2e3cc2d03ae /bsd | |
| parent | 2c1172a31794e20f7ba1a2ab234d4dab2f84005b (diff) | |
Return EBUSY when attempting to addmap a DRM_SHM area with a lock in it if
    dev->lock.hw_lock is already set. This fixes the case of two X Servers
    running on the same head on different VTs with interface 1.1, by making
    the 2nd head fail to inizialize like before.
Diffstat (limited to 'bsd')
| -rw-r--r-- | bsd/drm_bufs.h | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h index 0dc923d7..0915da84 100644 --- a/bsd/drm_bufs.h +++ b/bsd/drm_bufs.h @@ -136,6 +136,16 @@ int DRM(addmap)( DRM_IOCTL_ARGS )  		}  		map->offset = (unsigned long)map->handle;  		if ( map->flags & _DRM_CONTAINS_LOCK ) { +			/* Prevent a 2nd X Server from creating a 2nd lock */ +			DRM_LOCK(); +			if (dev->lock.hw_lock != NULL) { +				DRM_UNLOCK(); +				DRM(free)(map->handle, map->size, +				    DRM_MEM_SAREA); +				DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); +				return DRM_ERR(EBUSY); +			} +			DRM_UNLOCK();  			dev->lock.hw_lock = map->handle; /* Pointer to lock */  		}  		break;  | 
