diff mbox

drm/msm: unlock on error in msm_gem_get_iova()

Message ID 20170710072042.fs7ovvp5ufyg5hn3@mwanda (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Dan Carpenter July 10, 2017, 7:20 a.m. UTC
We recently added locking to this function but there was a direct return
that was overlooked where we need to unlock.

Fixes: 0e08270a1f01 ("drm/msm: Separate locking of buffer resources from struct_mutex")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sushmita Susheelendra July 10, 2017, 5:51 p.m. UTC | #1
Thanks for the catch!

-Sushmita

On 2017-07-10 01:20, Dan Carpenter wrote:
> We recently added locking to this function but there was a direct 
> return
> that was overlooked where we need to unlock.
> 
> Fixes: 0e08270a1f01 ("drm/msm: Separate locking of buffer resources
> from struct_mutex")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem.c 
> b/drivers/gpu/drm/msm/msm_gem.c
> index 65f35544c1ec..065d933df2c3 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -383,8 +383,10 @@ int msm_gem_get_iova(struct drm_gem_object *obj,
>  		struct page **pages;
> 
>  		vma = add_vma(obj, aspace);
> -		if (IS_ERR(vma))
> -			return PTR_ERR(vma);
> +		if (IS_ERR(vma)) {
> +			ret = PTR_ERR(vma);
> +			goto unlock;
> +		}
> 
>  		pages = get_pages(obj);
>  		if (IS_ERR(pages)) {
> @@ -405,7 +407,7 @@ int msm_gem_get_iova(struct drm_gem_object *obj,
> 
>  fail:
>  	del_vma(vma);
> -
> +unlock:
>  	mutex_unlock(&msm_obj->lock);
>  	return ret;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 65f35544c1ec..065d933df2c3 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -383,8 +383,10 @@  int msm_gem_get_iova(struct drm_gem_object *obj,
 		struct page **pages;
 
 		vma = add_vma(obj, aspace);
-		if (IS_ERR(vma))
-			return PTR_ERR(vma);
+		if (IS_ERR(vma)) {
+			ret = PTR_ERR(vma);
+			goto unlock;
+		}
 
 		pages = get_pages(obj);
 		if (IS_ERR(pages)) {
@@ -405,7 +407,7 @@  int msm_gem_get_iova(struct drm_gem_object *obj,
 
 fail:
 	del_vma(vma);
-
+unlock:
 	mutex_unlock(&msm_obj->lock);
 	return ret;
 }