aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs2015-05-05 23:34:22 -0500
committerBen Skeggs2015-05-05 23:50:07 -0500
commit812e8fe6ce46d733c30207ee26c788c61f546294 (patch)
tree8e31fc01e79dbb167d08da1cb67dd3c23eb177fc /nouveau
parentb4defea65fac690aefbe5348ff6ac2976e0ee090 (diff)
downloadexternal-libdrm-812e8fe6ce46d733c30207ee26c788c61f546294.tar.gz
external-libdrm-812e8fe6ce46d733c30207ee26c788c61f546294.tar.xz
external-libdrm-812e8fe6ce46d733c30207ee26c788c61f546294.zip
nouveau: restore check that avoids multiple user bos per kernel bo
Lost in 5ea6f1c32628887c9df0c53bc8c199eb12633fec, triggering fdo#89842. Unlike the PRIME fd->handle interfaces, the GEM_OPEN interface doesn't do anything at the kernel level to prevent this situation occuring, and we end up with multiple GEM handles for a single kernel buffer. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nouveau')
-rw-r--r--nouveau/nouveau.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 0071249e..7393474d 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -480,10 +480,20 @@ nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
480 struct nouveau_bo **pbo) 480 struct nouveau_bo **pbo)
481{ 481{
482 struct nouveau_device_priv *nvdev = nouveau_device(dev); 482 struct nouveau_device_priv *nvdev = nouveau_device(dev);
483 struct nouveau_bo_priv *nvbo;
483 struct drm_gem_open req = { .name = name }; 484 struct drm_gem_open req = { .name = name };
484 int ret; 485 int ret;
485 486
486 pthread_mutex_lock(&nvdev->lock); 487 pthread_mutex_lock(&nvdev->lock);
488 DRMLISTFOREACHENTRY(nvbo, &nvdev->bo_list, head) {
489 if (nvbo->name == name) {
490 ret = nouveau_bo_wrap_locked(dev, nvbo->base.handle,
491 pbo, name);
492 pthread_mutex_unlock(&nvdev->lock);
493 return ret;
494 }
495 }
496
487 ret = drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req); 497 ret = drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req);
488 if (ret == 0) { 498 if (ret == 0) {
489 ret = nouveau_bo_wrap_locked(dev, req.handle, pbo, name); 499 ret = nouveau_bo_wrap_locked(dev, req.handle, pbo, name);