Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143303
b: refs/heads/master
c: 2bc43b5
h: refs/heads/master
i:
  143301: a52553f
  143299: 00bf115
  143295: 9531f4c
v: v3
  • Loading branch information
Florian Mickler authored and Eric Anholt committed Apr 8, 2009
1 parent bd159fb commit ffeebb7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b40f871158da7aaccff442645dae8b97c2e4d50
refs/heads/master: 2bc43b5cf5158a26fa1328234795abed2dff5275
34 changes: 22 additions & 12 deletions trunk/drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,18 @@ fast_shmem_read(struct page **pages,
int length)
{
char __iomem *vaddr;
int ret;
int unwritten;

vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT], KM_USER0);
if (vaddr == NULL)
return -ENOMEM;
ret = __copy_to_user_inatomic(data, vaddr + page_offset, length);
unwritten = __copy_to_user_inatomic(data, vaddr + page_offset, length);
kunmap_atomic(vaddr, KM_USER0);

return ret;
if (unwritten)
return -EFAULT;

return 0;
}

static inline int
Expand Down Expand Up @@ -3000,13 +3003,13 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list,
drm_free(*relocs, reloc_count * sizeof(**relocs),
DRM_MEM_DRIVER);
*relocs = NULL;
return ret;
return -EFAULT;
}

reloc_index += exec_list[i].relocation_count;
}

return ret;
return 0;
}

static int
Expand All @@ -3015,23 +3018,28 @@ i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object *exec_list,
struct drm_i915_gem_relocation_entry *relocs)
{
uint32_t reloc_count = 0, i;
int ret;
int ret = 0;

for (i = 0; i < buffer_count; i++) {
struct drm_i915_gem_relocation_entry __user *user_relocs;
int unwritten;

user_relocs = (void __user *)(uintptr_t)exec_list[i].relocs_ptr;

if (ret == 0) {
ret = copy_to_user(user_relocs,
&relocs[reloc_count],
exec_list[i].relocation_count *
sizeof(*relocs));
unwritten = copy_to_user(user_relocs,
&relocs[reloc_count],
exec_list[i].relocation_count *
sizeof(*relocs));

if (unwritten) {
ret = -EFAULT;
goto err;
}

reloc_count += exec_list[i].relocation_count;
}

err:
drm_free(relocs, reloc_count * sizeof(*relocs), DRM_MEM_DRIVER);

return ret;
Expand Down Expand Up @@ -3306,10 +3314,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
(uintptr_t) args->buffers_ptr,
exec_list,
sizeof(*exec_list) * args->buffer_count);
if (ret)
if (ret) {
ret = -EFAULT;
DRM_ERROR("failed to copy %d exec entries "
"back to user (%d)\n",
args->buffer_count, ret);
}
}

/* Copy the updated relocations out regardless of current error
Expand Down

0 comments on commit ffeebb7

Please sign in to comment.