diff options
author | Eric Anholt <eric@anholt.net> | 2007-07-23 15:11:12 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-07-23 15:11:12 -0700 |
commit | 03e932e32be6ae3de6994c6893c813a34623ad7d (patch) | |
tree | 78e6afd5acab5378b527f48f7632697ead5ffc59 /linux-core | |
parent | 7e6d08f670a55d79ee037144aa29104e4e8fc700 (diff) |
linux: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.
Fixes the getclient test and dritest -c.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_ioctl.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c index f3f757da..9d52fd8a 100644 --- a/linux-core/drm_ioctl.c +++ b/linux-core/drm_ioctl.c @@ -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); + + return 0; + } } - - 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); - return 0; + return -EINVAL; } /** |