Skip to contentSkip to conversation

drm/amdgpu: Free ras cmd input buffer properly

PATCH In review Hawking Zhang 2 participants 3 messages Aug 29, 2023

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

PATCH 1/1 drm/amdgpu: Free ras cmd input buffer properly

Do not access the pointer for ras input cmd buffer if it is even not allocated.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -3
index e47600a8e88e..16c5fe487ea0 100644
@@ -804,13 +804,13 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 				amdgpu_ras_is_poison_mode_supported(adev), ret);
 			goto out;
 		}
+
+		kfree(info);
 	}
 
 	/* setup the obj */
 	__amdgpu_ras_feature_enable(adev, head, enable);
-out:
-	if (head->block == AMDGPU_RAS_BLOCK__GFX)
-		kfree(info);
+
 	return ret;
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Stanley

Quoted 41 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Tuesday, August 29, 2023 10:55 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amdgpu: Free ras cmd input buffer properly

Do not access the pointer for ras input cmd buffer if it is even not allocated.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -3
index e47600a8e88e..16c5fe487ea0 100644
@@ -804,13 +804,13 @@ int amdgpu_ras_feature_enable(struct
 amdgpu_device *adev,
 
      amdgpu_ras_is_poison_mode_supported(adev), ret);
                      goto out;
              }
+
+             kfree(info);
      }
 
      /* setup the obj */
      __amdgpu_ras_feature_enable(adev, head, enable);
-out:
-     if (head->block == AMDGPU_RAS_BLOCK__GFX)
-             kfree(info);
+
      return ret;

}

--
2.17.1

author Reviewed-by Stanley.Yang
#2 lore raw

[AMD Official Use Only - General]

Sorry about that, will send it out a clean up version.

Regards,
Hawking

-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Tuesday, August 29, 2023 23:00
To: Zhang, Hawking <[email protected]>; [email protected]; Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Free ras cmd input buffer properly

[AMD Official Use Only - General]

Regards,
Stanley

Quoted 41 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Tuesday, August 29, 2023 10:55 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amdgpu: Free ras cmd input buffer properly

Do not access the pointer for ras input cmd buffer if it is even not allocated.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -3
index e47600a8e88e..16c5fe487ea0 100644
@@ -804,13 +804,13 @@ int amdgpu_ras_feature_enable(struct
 amdgpu_device *adev,
 
      amdgpu_ras_is_poison_mode_supported(adev), ret);
                      goto out;
              }
+
+             kfree(info);
      }
 
      /* setup the obj */
      __amdgpu_ras_feature_enable(adev, head, enable);
-out:
-     if (head->block == AMDGPU_RAS_BLOCK__GFX)
-             kfree(info);
+
      return ret;

}

--
2.17.1