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

drm: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.

Fixes the getclient test and dritest -c.
Signed-off-by: NDave Airlie <airlied@linux.ie>
上级 3260f9fd
......@@ -235,17 +235,9 @@ int drm_getclient(struct drm_device *dev, void *data,
idx = client->idx;
mutex_lock(&dev->struct_mutex);
if (list_empty(&dev->filelist)) {
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
i = 0;
list_for_each_entry(pt, &dev->filelist, lhead) {
if (i++ >= idx)
break;
}
if (i++ >= idx) {
client->auth = pt->authenticated;
client->pid = pt->pid;
client->uid = pt->uid;
......@@ -254,6 +246,11 @@ int drm_getclient(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex);
return 0;
}
}
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册