diff options
| author | Sunil Khatri <sunilkh@codeaurora.org> | 2017-07-06 15:09:35 +0530 |
|---|---|---|
| committer | Sunil Khatri <sunilkh@codeaurora.org> | 2017-07-06 15:09:35 +0530 |
| commit | f0b50a87b491d730e3e295f92814d8f665b30568 (patch) | |
| tree | cdb76fea3e22d370573563e251fee4f5d3e8e1b0 /drivers/gpu/msm | |
| parent | 0f6cf457b2bdcd335b710a5c5f27f234da076696 (diff) | |
msm: kgsl: Use vma_area_struct with proper locks
Make sure to use proper locks when using the
vma_struct_area. This will avoid the race condition
in a scenario where one thread gets a vma_struct_area
and other thread is unmapping the vma from the process.
Change-Id: I6c7837d1a8dd24fc6955ab5be8b1917a42f2cb53
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
Diffstat (limited to 'drivers/gpu/msm')
| -rw-r--r-- | drivers/gpu/msm/kgsl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index 990c9bca5127..afb489f10172 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -2210,21 +2210,23 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device, if (fd != 0) dmabuf = dma_buf_get(fd - 1); } - up_read(¤t->mm->mmap_sem); - if (IS_ERR_OR_NULL(dmabuf)) + if (IS_ERR_OR_NULL(dmabuf)) { + up_read(¤t->mm->mmap_sem); return dmabuf ? PTR_ERR(dmabuf) : -ENODEV; + } ret = kgsl_setup_dma_buf(device, pagetable, entry, dmabuf); if (ret) { dma_buf_put(dmabuf); + up_read(¤t->mm->mmap_sem); return ret; } /* Setup the user addr/cache mode for cache operations */ entry->memdesc.useraddr = hostptr; _setup_cache_mode(entry, vma); - + up_read(¤t->mm->mmap_sem); return 0; } #else |
