[PATCH next] drm/amdgpu: Fix a double lock bug

Dan Carpenter posted 1 patch 1 month, 1 week ago
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH next] drm/amdgpu: Fix a double lock bug
Posted by Dan Carpenter 1 month, 1 week ago
This was supposed to be an unlock instead of a lock.  The original
code will lead to a deadlock.

Fixes: ee52489d1210 ("drm/amdgpu: Place NPS mode request on unload")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
From static analysis, not testing.
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index fcdbcff57632..3be07bcfd117 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -1605,7 +1605,7 @@ int amdgpu_xgmi_request_nps_change(struct amdgpu_device *adev,
 					     gmc.xgmi.head)
 		adev->gmc.gmc_funcs->request_mem_partition_mode(tmp_adev,
 								cur_nps_mode);
-	mutex_lock(&hive->hive_lock);
+	mutex_unlock(&hive->hive_lock);
 
 	return r;
 }
-- 
2.45.2
Re: [PATCH next] drm/amdgpu: Fix a double lock bug
Posted by Lazar, Lijo 1 month, 1 week ago

On 10/18/2024 1:10 AM, Dan Carpenter wrote:
> This was supposed to be an unlock instead of a lock.  The original
> code will lead to a deadlock.
> 
> Fixes: ee52489d1210 ("drm/amdgpu: Place NPS mode request on unload")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks, this is being taken care with a follow-up patch -

https://patchwork.freedesktop.org/patch/620162/

Thanks,
Lijo

> ---
> From static analysis, not testing.
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index fcdbcff57632..3be07bcfd117 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -1605,7 +1605,7 @@ int amdgpu_xgmi_request_nps_change(struct amdgpu_device *adev,
>  					     gmc.xgmi.head)
>  		adev->gmc.gmc_funcs->request_mem_partition_mode(tmp_adev,
>  								cur_nps_mode);
> -	mutex_lock(&hive->hive_lock);
> +	mutex_unlock(&hive->hive_lock);
>  
>  	return r;
>  }