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: Dave Airlie <airlied@linux.ie>
This commit is contained in:
@@ -235,17 +235,9 @@ int drm_getclient(struct drm_device *dev, void *data,
|
|||||||
idx = client->idx;
|
idx = client->idx;
|
||||||
mutex_lock(&dev->struct_mutex);
|
mutex_lock(&dev->struct_mutex);
|
||||||
|
|
||||||
if (list_empty(&dev->filelist)) {
|
|
||||||
mutex_unlock(&dev->struct_mutex);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
list_for_each_entry(pt, &dev->filelist, lhead) {
|
list_for_each_entry(pt, &dev->filelist, lhead) {
|
||||||
if (i++ >= idx)
|
if (i++ >= idx) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
client->auth = pt->authenticated;
|
client->auth = pt->authenticated;
|
||||||
client->pid = pt->pid;
|
client->pid = pt->pid;
|
||||||
client->uid = pt->uid;
|
client->uid = pt->uid;
|
||||||
@@ -255,6 +247,11 @@ int drm_getclient(struct drm_device *dev, void *data,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get statistics information.
|
* Get statistics information.
|
||||||
|
Reference in New Issue
Block a user