diff mbox

[10/24] Staging: atomisp: fix locking in alloc_user_pages()

Message ID 149002082825.17109.10471955862860977004.stgit@acox1-desk1.ger.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alan Cox March 20, 2017, 2:40 p.m. UTC
From: Dan Carpenter <dan.carpenter@oracle.com>

We call this function with the lock held and should also return with the
lock held as well.  This one error path is not-consistent because we
should return without the lock held.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c        |    1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index fd3bd5c..d1a609d2 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -1012,6 +1012,7 @@  static int alloc_user_pages(struct hmm_buffer_object *bo,
 		dev_err(atomisp_dev, "find_vma failed\n");
 		atomisp_kernel_free(bo->page_obj);
 		atomisp_kernel_free(pages);
+		mutex_lock(&bo->mutex);
 		return -EFAULT;
 	}
 	mutex_lock(&bo->mutex);