Skip to contentSkip to conversation

drm/amdgpu: Fix runtime PM leak in amdgpu_securedisplay_debugfs_write()

PATCH In review Wentao Liang 2 participants 2 messages Sep 16

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

PATCH 1/1 drm/amdgpu: Fix runtime PM leak in amdgpu_securedisplay_debugfs_write()

amdgpu_securedisplay_debugfs_write() resumes the device with pm_runtime_get_sync() before parsing the debugfs input. In the SECUREDISPLAY send ROI CRC case, an invalid user input, i.e. a missing or out of range phy_id, makes the function return -EINVAL without calling pm_runtime_put_autosuspend(), leaking the runtime PM reference and keeping the GPU awake.

Drop the runtime PM reference on the invalid input error path before returning.

Fixes 7e39d7ec3588 ("drm/amdgpu: Fix the uninitialized variable warning")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +1 -0
index 3739be1b71e0..fdb05f5857d3 100644
@@ -137,6 +137,7 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
 	case 2:
 		if (size < 3 || phy_id >= TA_SECUREDISPLAY_MAX_PHY) {
 			dev_err(adev->dev, "Invalid input: %s\n", str);
+			pm_runtime_put_autosuspend(dev->dev);
 			return -EINVAL;
 		}
 		mutex_lock(&psp->securedisplay_context.mutex);
Signature · 1 line
2.34.1
#1 lore raw

Public

Quoted 19 lines

-----Original Message-----
From: Wentao Liang <[email protected]>
Sent: Wednesday, September 16, 2026 5:59 AM
To: Ma, Jun <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; [email protected]; Koenig, Christian <[email protected]>; [email protected]; linux- [email protected]; [email protected]; Wentao Liang <[email protected]>; [email protected]
Subject: [PATCH] drm/amdgpu: Fix runtime PM leak in amdgpu_securedisplay_debugfs_write()

amdgpu_securedisplay_debugfs_write() resumes the device with pm_runtime_get_sync() before parsing the debugfs input. In the SECUREDISPLAY send ROI CRC case, an invalid user input, i.e. a missing or out of range phy_id, makes the function return -EINVAL without calling pm_runtime_put_autosuspend(), leaking the runtime PM reference and keeping the GPU awake.

Quoted 6 lines

Drop the runtime PM reference on the invalid input error path before returning.

Fixes 7e39d7ec3588 ("drm/amdgpu: Fix the uninitialized variable warning")

This was already fixed.

Thanks,

Alex

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +0 -0
index 3739be1b71e0..fdb05f5857d3 100644
@@ -137,6 +137,7 @@ static ssize_t

amdgpu_securedisplay_debugfs_write(struct file *f, const char __u

      case 2:
              if (size < 3 || phy_id >= TA_SECUREDISPLAY_MAX_PHY) {
                      dev_err(adev->dev, "Invalid input: %s\n", str);
+                     pm_runtime_put_autosuspend(dev->dev);
                      return -EINVAL;
              }
              mutex_lock(&psp->securedisplay_context.mutex);

--
2.34.1