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.
main
Eric Anholt 2003-11-06 04:48:06 +00:00
parent 2c1172a317
commit 1f7598245a
4 changed files with 32 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -161,6 +161,12 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
}
map->offset = (unsigned long)map->handle;
if ( map->flags & _DRM_CONTAINS_LOCK ) {
/* Prevent a 2nd X Server from creating a 2nd lock */
if (dev->lock.hw_lock != NULL) {
vfree( map->handle );
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
return -EBUSY;
}
dev->sigdata.lock =
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}

View File

@ -161,6 +161,12 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
}
map->offset = (unsigned long)map->handle;
if ( map->flags & _DRM_CONTAINS_LOCK ) {
/* Prevent a 2nd X Server from creating a 2nd lock */
if (dev->lock.hw_lock != NULL) {
vfree( map->handle );
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
return -EBUSY;
}
dev->sigdata.lock =
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}