diff options
author | Eric Anholt <eric@anholt.net> | 2007-11-22 03:46:54 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-02-07 00:09:39 -0500 |
commit | b018fcdaa5e8b4eabb8cffda687d00004a3c4785 (patch) | |
tree | 63772cad6f990cd3b0fb81e3329fa7b625dfa656 /drivers/char/drm/drm_ioctl.c | |
parent | 3260f9fdfee9d5b4135f40943dc0bd0733b7394e (diff) |
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>
Diffstat (limited to 'drivers/char/drm/drm_ioctl.c')
-rw-r--r-- | drivers/char/drm/drm_ioctl.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index b4d86a3343c6..16829fb3089d 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -235,25 +235,22 @@ int drm_getclient(struct drm_device *dev, void *data, | |||
235 | idx = client->idx; | 235 | idx = client->idx; |
236 | mutex_lock(&dev->struct_mutex); | 236 | mutex_lock(&dev->struct_mutex); |
237 | 237 | ||
238 | if (list_empty(&dev->filelist)) { | ||
239 | mutex_unlock(&dev->struct_mutex); | ||
240 | return -EINVAL; | ||
241 | } | ||
242 | |||
243 | i = 0; | 238 | i = 0; |
244 | list_for_each_entry(pt, &dev->filelist, lhead) { | 239 | list_for_each_entry(pt, &dev->filelist, lhead) { |
245 | if (i++ >= idx) | 240 | if (i++ >= idx) { |
246 | break; | 241 | client->auth = pt->authenticated; |
242 | client->pid = pt->pid; | ||
243 | client->uid = pt->uid; | ||
244 | client->magic = pt->magic; | ||
245 | client->iocs = pt->ioctl_count; | ||
246 | mutex_unlock(&dev->struct_mutex); | ||
247 | |||
248 | return 0; | ||
249 | } | ||
247 | } | 250 | } |
248 | |||
249 | client->auth = pt->authenticated; | ||
250 | client->pid = pt->pid; | ||
251 | client->uid = pt->uid; | ||
252 | client->magic = pt->magic; | ||
253 | client->iocs = pt->ioctl_count; | ||
254 | mutex_unlock(&dev->struct_mutex); | 251 | mutex_unlock(&dev->struct_mutex); |
255 | 252 | ||
256 | return 0; | 253 | return -EINVAL; |
257 | } | 254 | } |
258 | 255 | ||
259 | /** | 256 | /** |