Skip to contentSkip to conversation

drm/amdgpu: fix double free err_addr pointer warnings

PATCH In review Bob Zhou 2 participants 3 messages Apr 23, 2024 – Apr 24, 2024

Subsystems (2)
lore
Share & tools
lore

Bob Zhou

author
#0 lore raw

PATCH 1/2 drm/amdgpu: fix double free err_addr pointer warnings

In amdgpu_umc_bad_page_polling_timeout, the amdgpu_umc_handle_bad_pages will be run many times so that double free err_addr in some special case. So set the err_addr to NULL to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +1 -0
index f486510fc94c..32e818d182fe 100644
@@ -170,6 +170,7 @@ static void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
 	}
 
 	kfree(err_data->err_addr);
+	err_data->err_addr = NULL;
 
 	mutex_unlock(&con->page_retirement_lock);
 }
Signature · 1 line
2.34.1
author
#1 lore raw

[Public]

Ping

Regards,
Bob

-----Original Message-----
From: Bob Zhou <[email protected]>
Sent: 2024年4月23日 13:33
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: fix double free err_addr pointer warnings

In amdgpu_umc_bad_page_polling_timeout, the amdgpu_umc_handle_bad_pages will be run many times so that double free err_addr in some special case. So set the err_addr to NULL to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +1 -0
index f486510fc94c..32e818d182fe 100644
@@ -170,6 +170,7 @@ static void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
        }
 
        kfree(err_data->err_addr);
+       err_data->err_addr = NULL;
 
        mutex_unlock(&con->page_retirement_lock);
 }

--
2.34.1

maintainer Acked-by on v1 1/2
#2 lore raw
In reply to Bob Zhou

[AMD Official Use Only - General]

________________________________
From: Bob Zhou <[email protected]>
Sent: Tuesday, April 23, 2024 1:32 AM
To: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: fix double free err_addr pointer warnings

In amdgpu_umc_bad_page_polling_timeout, the amdgpu_umc_handle_bad_pages will be run many times so that double free err_addr in some special case. So set the err_addr to NULL to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +1 -0
index f486510fc94c..32e818d182fe 100644
@@ -170,6 +170,7 @@ static void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
         }
 
         kfree(err_data->err_addr);
+       err_data->err_addr = NULL;
 
         mutex_unlock(&con->page_retirement_lock);
 }

--
2.34.1