diff mbox series

drm/client: Fix error code in drm_client_buffer_vmap_local()

Message ID 89d13df3-747c-4c5d-b122-d081aef5110a@stanley.mountain (mailing list archive)
State New, archived
Headers show
Series drm/client: Fix error code in drm_client_buffer_vmap_local() | expand

Commit Message

Dan Carpenter July 24, 2024, 4:09 p.m. UTC
This function accidentally returns zero/success on the failure path.
It leads to locking issues and an uninitialized *map_copy in the
caller.

Fixes: b4b0193e83cb ("drm/fbdev-generic: Fix locking with drm_client_buffer_vmap_local()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/drm_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Osipenko July 27, 2024, 3:20 p.m. UTC | #1
On 7/24/24 19:09, Dan Carpenter wrote:
> This function accidentally returns zero/success on the failure path.
> It leads to locking issues and an uninitialized *map_copy in the
> caller.
> 
> Fixes: b4b0193e83cb ("drm/fbdev-generic: Fix locking with drm_client_buffer_vmap_local()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/gpu/drm/drm_client.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> index 2803ac111bbd..bfedcbf516db 100644
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -355,7 +355,7 @@ int drm_client_buffer_vmap_local(struct drm_client_buffer *buffer,
>  
>  err_drm_gem_vmap_unlocked:
>  	drm_gem_unlock(gem);
> -	return 0;
> +	return ret;
>  }
>  EXPORT_SYMBOL(drm_client_buffer_vmap_local);
>  

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Thomas Zimmermann July 29, 2024, 6:48 a.m. UTC | #2
Am 24.07.24 um 18:09 schrieb Dan Carpenter:
> This function accidentally returns zero/success on the failure path.
> It leads to locking issues and an uninitialized *map_copy in the
> caller.
>
> Fixes: b4b0193e83cb ("drm/fbdev-generic: Fix locking with drm_client_buffer_vmap_local()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/drm_client.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> index 2803ac111bbd..bfedcbf516db 100644
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -355,7 +355,7 @@ int drm_client_buffer_vmap_local(struct drm_client_buffer *buffer,
>   
>   err_drm_gem_vmap_unlocked:
>   	drm_gem_unlock(gem);
> -	return 0;
> +	return ret;
>   }
>   EXPORT_SYMBOL(drm_client_buffer_vmap_local);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 2803ac111bbd..bfedcbf516db 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -355,7 +355,7 @@  int drm_client_buffer_vmap_local(struct drm_client_buffer *buffer,
 
 err_drm_gem_vmap_unlocked:
 	drm_gem_unlock(gem);
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(drm_client_buffer_vmap_local);