[PATCH] drm/amd/powerplay: Fix buffer overflow in arcturus_get_unique_id()

Quan, Evan Evan.Quan at amd.com
Tue Jun 9 03:56:42 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

adev->serial which is used to hold the final serial number may need to be enlarged also.
Since it comes with 16 bytes also.

BR,
Evan
-----Original Message-----
From: Dan Carpenter <dan.carpenter at oracle.com>
Sent: Monday, June 8, 2020 10:18 PM
To: Quan, Evan <Evan.Quan at amd.com>; Russell, Kent <Kent.Russell at amd.com>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; David Airlie <airlied at linux.ie>; Daniel Vetter <daniel at ffwll.ch>; amd-gfx at lists.freedesktop.org; kernel-janitors at vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: Fix buffer overflow in arcturus_get_unique_id()

The comments say that the "sn" buffer is used to hold a 16-digit HEX string so the buffer needs to be at least 17 characters to hold the NUL terminator.

Fixes: 81a16241114b ("drm/amdgpu: Add unique_id and serial_number for Arcturus v3")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index df7b408319f76..a575cb9d1574c 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2266,7 +2266,7 @@ static void arcturus_get_unique_id(struct smu_context *smu)  {
 struct amdgpu_device *adev = smu->adev;
 uint32_t top32, bottom32, smu_version, size;
-char sn[16];
+char sn[20];
 uint64_t id;

 if (smu_get_smc_version(smu, NULL, &smu_version)) {
--
2.26.2



More information about the amd-gfx mailing list