Commit 166108aa authored by Dave Airlie's avatar Dave Airlie

Merge branch 'msm-fixes-4.7-rc3' of git://people.freedesktop.org/~robclark/linux into drm-fixes

* 'msm-fixes-4.7-rc3' of git://people.freedesktop.org/~robclark/linux:
  drm/msm: fix potential submit error path issue
  drm/msm: fix some crashes in submit fail path
  drm/msm: deal with exhausted vmap space better
parents 170fba30 a9e26cab
...@@ -408,7 +408,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, ...@@ -408,7 +408,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
} }
adreno_gpu->memptrs = msm_gem_vaddr(adreno_gpu->memptrs_bo); adreno_gpu->memptrs = msm_gem_vaddr(adreno_gpu->memptrs_bo);
if (!adreno_gpu->memptrs) { if (IS_ERR(adreno_gpu->memptrs)) {
dev_err(drm->dev, "could not vmap memptrs\n"); dev_err(drm->dev, "could not vmap memptrs\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -159,6 +159,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, ...@@ -159,6 +159,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
dev->mode_config.fb_base = paddr; dev->mode_config.fb_base = paddr;
fbi->screen_base = msm_gem_vaddr_locked(fbdev->bo); fbi->screen_base = msm_gem_vaddr_locked(fbdev->bo);
if (IS_ERR(fbi->screen_base)) {
ret = PTR_ERR(fbi->screen_base);
goto fail_unlock;
}
fbi->screen_size = fbdev->bo->size; fbi->screen_size = fbdev->bo->size;
fbi->fix.smem_start = paddr; fbi->fix.smem_start = paddr;
fbi->fix.smem_len = fbdev->bo->size; fbi->fix.smem_len = fbdev->bo->size;
......
...@@ -398,6 +398,8 @@ void *msm_gem_vaddr_locked(struct drm_gem_object *obj) ...@@ -398,6 +398,8 @@ void *msm_gem_vaddr_locked(struct drm_gem_object *obj)
return ERR_CAST(pages); return ERR_CAST(pages);
msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT, msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
VM_MAP, pgprot_writecombine(PAGE_KERNEL)); VM_MAP, pgprot_writecombine(PAGE_KERNEL));
if (msm_obj->vaddr == NULL)
return ERR_PTR(-ENOMEM);
} }
return msm_obj->vaddr; return msm_obj->vaddr;
} }
......
...@@ -40,12 +40,14 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev, ...@@ -40,12 +40,14 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
submit->dev = dev; submit->dev = dev;
submit->gpu = gpu; submit->gpu = gpu;
submit->fence = NULL;
submit->pid = get_pid(task_pid(current)); submit->pid = get_pid(task_pid(current));
/* initially, until copy_from_user() and bo lookup succeeds: */ /* initially, until copy_from_user() and bo lookup succeeds: */
submit->nr_bos = 0; submit->nr_bos = 0;
submit->nr_cmds = 0; submit->nr_cmds = 0;
INIT_LIST_HEAD(&submit->node);
INIT_LIST_HEAD(&submit->bo_list); INIT_LIST_HEAD(&submit->bo_list);
ww_acquire_init(&submit->ticket, &reservation_ww_class); ww_acquire_init(&submit->ticket, &reservation_ww_class);
...@@ -75,6 +77,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, ...@@ -75,6 +77,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
void __user *userptr = void __user *userptr =
u64_to_user_ptr(args->bos + (i * sizeof(submit_bo))); u64_to_user_ptr(args->bos + (i * sizeof(submit_bo)));
/* make sure we don't have garbage flags, in case we hit
* error path before flags is initialized:
*/
submit->bos[i].flags = 0;
ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo)); ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo));
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
......
...@@ -312,6 +312,9 @@ void msm_rd_dump_submit(struct msm_gem_submit *submit) ...@@ -312,6 +312,9 @@ void msm_rd_dump_submit(struct msm_gem_submit *submit)
struct msm_gem_object *obj = submit->bos[idx].obj; struct msm_gem_object *obj = submit->bos[idx].obj;
const char *buf = msm_gem_vaddr_locked(&obj->base); const char *buf = msm_gem_vaddr_locked(&obj->base);
if (IS_ERR(buf))
continue;
buf += iova - submit->bos[idx].iova; buf += iova - submit->bos[idx].iova;
rd_write_section(rd, RD_GPUADDR, rd_write_section(rd, RD_GPUADDR,
......
...@@ -40,6 +40,10 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size) ...@@ -40,6 +40,10 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size)
} }
ring->start = msm_gem_vaddr_locked(ring->bo); ring->start = msm_gem_vaddr_locked(ring->bo);
if (IS_ERR(ring->start)) {
ret = PTR_ERR(ring->start);
goto fail;
}
ring->end = ring->start + (size / 4); ring->end = ring->start + (size / 4);
ring->cur = ring->start; ring->cur = ring->start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment