Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b018fcdaa5e8b4eabb8cffda687d00004a3c4785 Commit: b018fcdaa5e8b4eabb8cffda687d00004a3c4785 Parent: 3260f9fdfee9d5b4135f40943dc0bd0733b7394e Author: Eric Anholt <[EMAIL PROTECTED]> AuthorDate: Thu Nov 22 18:46:54 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED]> CommitDate: Thu Feb 7 15:09:39 2008 +1000
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 <[EMAIL PROTECTED]> --- 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 b4d86a3..16829fb 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, 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; } /** - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html