aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/drm/drm_ioctl.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index b4d86a3343c..16829fb3089 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/**