mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-24 23:00:11 +01:00
linux: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.
Fixes the getclient test and dritest -c.
This commit is contained in:
parent
7e6d08f670
commit
03e932e32b
1 changed files with 11 additions and 14 deletions
|
|
@ -229,26 +229,23 @@ 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;
|
||||
client->magic = pt->magic;
|
||||
client->iocs = pt->ioctl_count;
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
||||
client->auth = pt->authenticated;
|
||||
client->pid = pt->pid;
|
||||
client->uid = pt->uid;
|
||||
client->magic = pt->magic;
|
||||
client->iocs = pt->ioctl_count;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
||||
return 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue