linux/drivers/gpu/drm/amd/amdkfd
Guangshuo Li b240f792ae drm/amdkfd: free MQD managers on DQM init failures
The change referenced by the Fixes tag releases the HIQ SDMA MQD trunk
buffer when device_queue_manager_init() fails after it has been
allocated.

However, the same failure path can also be reached after
init_mqd_managers() has succeeded. At that point dqm->mqd_mgrs[] contains
per-type MQD manager objects owned by the device queue manager. The
normal teardown path frees those objects from uninitialize(), but the
initialization error path only frees dqm itself.

Free the MQD managers from the initialization error path as well. This is
safe for earlier failures because dqm is zeroed when allocated and
init_mqd_managers() clears the entries it rolls back internally.

Fixes: b7cccc8286 ("drm/amdkfd: fix a memory leak in device_queue_manager_init()")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 1fff2e07b6670bc5b8f7344a8708c136259cb176)
Cc: stable@vger.kernel.org
2026-07-17 17:41:06 -04:00
..
cik_event_interrupt.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
cik_int.h
cik_regs.h
cwsr_trap_handler_gfx8.asm
cwsr_trap_handler_gfx9.asm
cwsr_trap_handler_gfx10.asm
cwsr_trap_handler_gfx12.asm drm/amdkfd: fix CWSR trap handler 2026-02-26 11:20:10 -05:00
cwsr_trap_handler.h drm/amdkfd: gfx12.1 trap handler instruction fixup for VOP3PX 2026-01-28 16:21:21 -05:00
Kconfig dma-buf: Always build with DMABUF_MOVE_NOTIFY 2026-01-27 10:45:11 +01:00
kfd_chardev.c drm/amdkfd: Use kvcalloc to allocate arrays 2026-07-01 13:01:50 -04:00
kfd_crat.c drm/amdgpu: add support for GC IP version 11.7.1 2026-07-01 13:01:48 -04:00
kfd_crat.h
kfd_debug.c drm/amdkfd: Unwind debug trap enable on copy_to_user failure 2026-06-04 15:25:55 -04:00
kfd_debug.h drm/amdkfd: fix gfx11 restrictions on debugging cooperative launch 2026-01-20 21:50:12 -05:00
kfd_debugfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_device_queue_manager_cik.c
kfd_device_queue_manager_v9.c
kfd_device_queue_manager_v10.c
kfd_device_queue_manager_v11.c
kfd_device_queue_manager_v12_1.c drm/amdkfd: Limit per-process xnack support for GFX12.1 2026-04-24 10:57:31 -04:00
kfd_device_queue_manager_v12.c
kfd_device_queue_manager_vi.c
kfd_device_queue_manager.c drm/amdkfd: free MQD managers on DQM init failures 2026-07-17 17:41:06 -04:00
kfd_device_queue_manager.h drm/amdkfd: Check bounds on CRIU restore queue type and mqd size 2026-07-08 16:46:53 -04:00
kfd_device.c drm/amdgpu: add support for GC IP version 11.7.1 2026-07-01 13:01:48 -04:00
kfd_doorbell.c drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap 2026-06-17 18:24:47 -04:00
kfd_events.c drm/amdkfd: Check bounds in allocate_event_notification_slot 2026-07-08 16:45:48 -04:00
kfd_events.h drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_flat_memory.c drm/amdgpu: GFX12.1 scratch memory limit up to 57-bit 2026-03-04 11:42:26 -05:00
kfd_int_process_v9.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v10.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v11.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v12_1.c drm/amdkfd: Switch to dev_* printk stuff in kfd_int_process_v12_1.c 2026-03-30 15:13:14 -04:00
kfd_interrupt.c
kfd_kernel_queue.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_kernel_queue.h
kfd_migrate.c drm/amdgpu: Fix AMDGPU_GTT_MAX_TRANSFER_SIZE for non-4K systems 2026-07-01 13:02:00 -04:00
kfd_migrate.h drm/amdgpu: update the functions to use amdgpu version of hmm 2025-10-13 14:14:36 -04:00
kfd_module.c drm/amdkfd: Destroy KFD debugfs after destroy KFD wq 2025-08-06 16:52:08 -04:00
kfd_mqd_manager_cik.c drm/amdkfd: Removed commented line for MQD queue priority 2026-02-25 16:28:10 -05:00
kfd_mqd_manager_v9.c drm/amdkfd: clamp v9 CRIU control stack checkpoint copy to BO size 2026-07-01 12:59:39 -04:00
kfd_mqd_manager_v10.c drm/amdkfd: Guard m->cp_hqd_eop_control setting by q->eop_ring_buffer_size 2026-07-01 12:58:33 -04:00
kfd_mqd_manager_v11.c drm/amdkfd: Guard m->cp_hqd_eop_control setting by q->eop_ring_buffer_size 2026-07-01 12:58:33 -04:00
kfd_mqd_manager_v12_1.c drm/amdkfd: Guard m->cp_hqd_eop_control setting by q->eop_ring_buffer_size 2026-07-01 12:58:33 -04:00
kfd_mqd_manager_v12.c drm/amdkfd: Guard m->cp_hqd_eop_control setting by q->eop_ring_buffer_size 2026-07-01 12:58:33 -04:00
kfd_mqd_manager_vi.c drm/amdkfd: Guard m->cp_hqd_eop_control setting by q->eop_ring_buffer_size 2026-07-01 12:58:33 -04:00
kfd_mqd_manager.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_mqd_manager.h drm/amdkfd: clamp v9 CRIU control stack checkpoint copy to BO size 2026-07-01 12:59:39 -04:00
kfd_packet_manager_v9.c amdkfd: remove DIQ support 2025-12-08 13:56:42 -05:00
kfd_packet_manager_vi.c amdkfd: remove DIQ support 2025-12-08 13:56:42 -05:00
kfd_packet_manager.c drm/amdkfd: Support chain runlists of XNACK+/XNACK- 2025-05-16 13:37:29 -04:00
kfd_pm4_headers_ai.h drm/amdkfd: Support chain runlists of XNACK+/XNACK- 2025-05-16 13:37:29 -04:00
kfd_pm4_headers_aldebaran.h
kfd_pm4_headers_vi.h
kfd_pm4_headers.h
kfd_pm4_opcodes.h
kfd_priv.h drm/amdkfd: Check bounds on CRIU restore queue type and mqd size 2026-07-08 16:46:53 -04:00
kfd_process_queue_manager.c drm/amdkfd: Check bounds on CRIU restore queue type and mqd size 2026-07-08 16:46:53 -04:00
kfd_process.c amdkfd: properly free secondary context id 2026-07-08 16:45:41 -04:00
kfd_queue.c drm/amdkfd: fix 32-bit overflow in CWSR total size calculation 2026-07-17 17:37:12 -04:00
kfd_smi_events.c drm/amdkfd: Fix SMI event PID reporting for containers 2026-06-17 18:12:00 -04:00
kfd_smi_events.h drm/amdkfd: Fix SMI event PID reporting for containers 2026-06-17 18:12:00 -04:00
kfd_svm.c drm/amdkfd: Use exclusive bounds for SVM split alignment checks 2026-06-17 18:35:32 -04:00
kfd_svm.h drm/amdgpu: update the functions to use amdgpu version of hmm 2025-10-13 14:14:36 -04:00
kfd_topology.c drm/amdkfd: fix sysfs topology prop length on buffer truncation 2026-06-04 15:27:37 -04:00
kfd_topology.h drm/amdgpu: reduce the full gpu access time in amdgpu_device_init. 2025-12-08 13:56:38 -05:00
Makefile drm/amdkfd: Add interrupt handling for GFX 12.1.0 2025-12-08 14:13:11 -05:00
soc15_int.h