提交 d4e7b898 编写于 作者: E Eric Anholt 提交者: Dave Airlie

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

Signed-off-by: NEric Anholt <eric@anholt.net>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 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 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -259,8 +259,9 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册