[PATCH 3/3] drm/amd/amdgpu: Fix NULL pointer OOPS during S3

Pratik Vishwakarma Pratik.Vishwakarma at amd.com
Wed Jun 6 09:25:42 UTC 2018


Fixes NULL pointer dereference in amdgpu_ttm_copy_mem_to_mem

BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
IP: amdgpu_ttm_copy_mem_to_mem+0x85/0x40c
Workqueue: events_unbound async_run_entry_fn
Call Trace:
? _raw_spin_unlock+0xe/0x20
? ttm_check_swapping+0x4e/0x72
? ttm_mem_global_reserve.constprop.4+0xb1/0xc0
amdgpu_move_blit+0x80/0xe2
amdgpu_bo_move+0x114/0x155
ttm_bo_handle_move_mem+0x1f7/0x34a
? ttm_bo_mem_space+0x162/0x38e
? dev_vprintk_emit+0x10a/0x1f2
ttm_bo_evict+0x13e/0x2e9
? do_wait_for_common+0x151/0x187
ttm_mem_evict_first+0x136/0x181
ttm_bo_force_list_clean+0x78/0x10f
amdgpu_device_suspend+0x167/0x210
pci_pm_suspend+0x12a/0x1a5
? pci_dev_driver+0x36/0x36
dpm_run_callback+0x59/0xbf
__device_suspend+0x215/0x33f
async_suspend+0x1f/0x5c
async_run_entry_fn+0x3d/0xd2
process_one_work+0x1b0/0x314
worker_thread+0x1cb/0x2c1
? create_worker+0x1da/0x1da
kthread+0x156/0x15e
? kthread_flush_work+0xea/0xea
ret_from_fork+0x22/0x40

Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 57d4da6..f9de429 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -414,12 +414,16 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
 		return -EINVAL;
 	}
 
+	if (!src->mem->mm_node)
+		return -EINVAL;
 	src_mm = amdgpu_find_mm_node(src->mem, &src->offset);
 	src_node_start = amdgpu_mm_node_addr(src->bo, src_mm, src->mem) +
 					     src->offset;
 	src_node_size = (src_mm->size << PAGE_SHIFT) - src->offset;
 	src_page_offset = src_node_start & (PAGE_SIZE - 1);
 
+	if (!dst->mem->mm_node)
+		return -EINVAL;
 	dst_mm = amdgpu_find_mm_node(dst->mem, &dst->offset);
 	dst_node_start = amdgpu_mm_node_addr(dst->bo, dst_mm, dst->mem) +
 					     dst->offset;
-- 
1.9.1



More information about the amd-gfx mailing list