diff options
Diffstat (limited to 'drivers/char/drm/drm_context.c')
-rw-r--r-- | drivers/char/drm/drm_context.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index a7cfabd1ca2e..f515567e5b6f 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -212,6 +212,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp, | |||
212 | drm_ctx_priv_map_t __user *argp = (void __user *)arg; | 212 | drm_ctx_priv_map_t __user *argp = (void __user *)arg; |
213 | drm_ctx_priv_map_t request; | 213 | drm_ctx_priv_map_t request; |
214 | drm_map_t *map; | 214 | drm_map_t *map; |
215 | drm_map_list_t *_entry; | ||
215 | 216 | ||
216 | if (copy_from_user(&request, argp, sizeof(request))) | 217 | if (copy_from_user(&request, argp, sizeof(request))) |
217 | return -EFAULT; | 218 | return -EFAULT; |
@@ -225,7 +226,17 @@ int drm_getsareactx(struct inode *inode, struct file *filp, | |||
225 | map = dev->context_sareas[request.ctx_id]; | 226 | map = dev->context_sareas[request.ctx_id]; |
226 | up(&dev->struct_sem); | 227 | up(&dev->struct_sem); |
227 | 228 | ||
228 | request.handle = (void *) map->offset; | 229 | request.handle = 0; |
230 | list_for_each_entry(_entry, &dev->maplist->head,head) { | ||
231 | if (_entry->map == map) { | ||
232 | request.handle = (void *)(unsigned long)_entry->user_token; | ||
233 | break; | ||
234 | } | ||
235 | } | ||
236 | if (request.handle == 0) | ||
237 | return -EINVAL; | ||
238 | |||
239 | |||
229 | if (copy_to_user(argp, &request, sizeof(request))) | 240 | if (copy_to_user(argp, &request, sizeof(request))) |
230 | return -EFAULT; | 241 | return -EFAULT; |
231 | return 0; | 242 | return 0; |
@@ -262,7 +273,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, | |||
262 | list_for_each(list, &dev->maplist->head) { | 273 | list_for_each(list, &dev->maplist->head) { |
263 | r_list = list_entry(list, drm_map_list_t, head); | 274 | r_list = list_entry(list, drm_map_list_t, head); |
264 | if (r_list->map | 275 | if (r_list->map |
265 | && r_list->map->offset == (unsigned long) request.handle) | 276 | && r_list->user_token == (unsigned long) request.handle) |
266 | goto found; | 277 | goto found; |
267 | } | 278 | } |
268 | bad: | 279 | bad: |
@@ -369,7 +380,7 @@ int drm_resctx( struct inode *inode, struct file *filp, | |||
369 | for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { | 380 | for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { |
370 | ctx.handle = i; | 381 | ctx.handle = i; |
371 | if ( copy_to_user( &res.contexts[i], | 382 | if ( copy_to_user( &res.contexts[i], |
372 | &i, sizeof(i) ) ) | 383 | &ctx, sizeof(ctx) ) ) |
373 | return -EFAULT; | 384 | return -EFAULT; |
374 | } | 385 | } |
375 | } | 386 | } |