All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/amdgpu: fix TTM device_list use-after-free on failed probe
@ 2026-11-13 14:41 Mario Limonciello
  2026-11-13 14:41 ` [PATCH 1/3] drm/amdgpu: unwind TTM on amdgpu_ttm_init() failure Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mario Limonciello @ 2026-11-13 14:41 UTC (permalink / raw)
  To: Alex Deucher, Christian König; +Cc: amd-gfx, Mario Limonciello

When amdgpu probe fails after ttm_device_init() has succeeded, the freed
amdgpu_device stays linked on ttm_glob.device_list. The next
ttm_device_init() or ttm_global_swapout() then touches freed memory
(list_add corruption on the following bind).

Failure points are any error return in amdgpu_ttm_init() after
ttm_device_init(), and gmc_v*_sw_init() failing after amdgpu_bo_init().
In the latter case GMC's status.sw stays false, so amdgpu_device_ip_fini()
skips its sw_fini, which is the only path to amdgpu_bo_fini() ->
amdgpu_ttm_fini() -> ttm_device_fini(). The leaked MMIO_REMAP BO also
shows up as "Memory manager not clean" on the next bind.

Patch 1 unwinds amdgpu_ttm_init() through amdgpu_ttm_fini() and makes
that function safe on a partially initialized device.
Patch 2 unwinds amdgpu_bo_init() in the GMC sw_init paths (v6-v12).
Patch 3 releases the WC memtype and MTRR when amdgpu_bo_init() fails
after reserving them.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Mario Limonciello (3):
      drm/amdgpu: unwind TTM on amdgpu_ttm_init() failure
      drm/amdgpu: unwind bo_init on GMC sw_init failure
      drm/amdgpu: release WC memtype and MTRR when amdgpu_bo_init() fails

 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 43 ++++++++++++++++++------------
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c     | 10 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c     | 10 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c     | 10 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      |  6 ++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      | 14 +++++++---
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      | 14 +++++++---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 10 +++++--
 9 files changed, 102 insertions(+), 35 deletions(-)
---
base-commit: 71830abced88ee7665010e79b51f0789b033cc3a
change-id: 20261113-superm1-amdgpu-memory-leak-a2a6b2a93efb

Best regards,
--  
Mario Limonciello <mario.limonciello@amd.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-13 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 14:41 [PATCH 0/3] drm/amdgpu: fix TTM device_list use-after-free on failed probe Mario Limonciello
2026-11-13 14:41 ` [PATCH 1/3] drm/amdgpu: unwind TTM on amdgpu_ttm_init() failure Mario Limonciello
2026-11-13 14:41 ` [PATCH 2/3] drm/amdgpu: unwind bo_init on GMC sw_init failure Mario Limonciello
2026-11-13 14:56   ` sashiko-bot
2026-11-13 15:47     ` Mario Limonciello
2026-11-13 14:41 ` [PATCH 3/3] drm/amdgpu: release WC memtype and MTRR when amdgpu_bo_init() fails Mario Limonciello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.