Staging: atomisp: fix locking in alloc_user_pages()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 20 Mar 2017 14:40:32 +0000 (14:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Mar 2017 07:04:32 +0000 (08:04 +0100)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c

index e2aa94991aee62a32cdea7ef43dd2b5559c80831..82593ef35b2dcffade5af83e40c9c7099d6f495a 100644 (file)
@@ -1011,6 +1011,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);