Commit d4e7b898 authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie

DRM: Return -EBADF on bad object in flink, and return curent name if it exists.

Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent dbb19d30
...@@ -251,7 +251,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -251,7 +251,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EINVAL; return -EBADF;
again: again:
if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0)
...@@ -259,8 +259,9 @@ again: ...@@ -259,8 +259,9 @@ again:
spin_lock(&dev->object_name_lock); spin_lock(&dev->object_name_lock);
if (obj->name) { if (obj->name) {
args->name = obj->name;
spin_unlock(&dev->object_name_lock); spin_unlock(&dev->object_name_lock);
return -EEXIST; return 0;
} }
ret = idr_get_new_above(&dev->object_name_idr, obj, 1, ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
&obj->name); &obj->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment