Skip to contentSkip to conversation

Staging: atomisp: fix locking in alloc_user_pages()

PATCH New Dan Carpenter 1 participant 1 message Mar 17, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: atomisp: fix locking in alloc_user_pages()

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.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +1 -0
index fd3bd5c48672..d1a609d25f18 100644
@@ -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);