Guchun Chen
2dedcf414b
drm/ttm: check null pointer before accessing when swapping
Add a check to avoid null pointer dereference as below:
[ 90.002283] general protection fault, probably for non-canonical
address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
[ 90.002292] KASAN: null-ptr-deref in range
[0x0000000000000000-0x0000000000000007]
[ 90.002346] ? exc_general_protection+0x159/0x240
[ 90.002352] ? asm_exc_general_protection+0x26/0x30
[ 90.002357] ? ttm_bo_evict_swapout_allowable+0x322/0x5e0 [ttm]
[ 90.002365] ? ttm_bo_evict_swapout_allowable+0x42e/0x5e0 [ttm]
[ 90.002373] ttm_bo_swapout+0x134/0x7f0 [ttm]
[ 90.002383] ? __pfx_ttm_bo_swapout+0x10/0x10 [ttm]
[ 90.002391] ? lock_acquire+0x44d/0x4f0
[ 90.002398] ? ttm_device_swapout+0xa5/0x260 [ttm]
[ 90.002412] ? lock_acquired+0x355/0xa00
[ 90.002416] ? do_raw_spin_trylock+0xb6/0x190
[ 90.002421] ? __pfx_lock_acquired+0x10/0x10
[ 90.002426] ? ttm_global_swapout+0x25/0x210 [ttm]
[ 90.002442] ttm_device_swapout+0x198/0x260 [ttm]
[ 90.002456] ? __pfx_ttm_device_swapout+0x10/0x10 [ttm]
[ 90.002472] ttm_global_swapout+0x75/0x210 [ttm]
[ 90.002486] ttm_tt_populate+0x187/0x3f0 [ttm]
[ 90.002501] ttm_bo_handle_move_mem+0x437/0x590 [ttm]
[ 90.002517] ttm_bo_validate+0x275/0x430 [ttm]
[ 90.002530] ? __pfx_ttm_bo_validate+0x10/0x10 [ttm]
[ 90.002544] ? kasan_save_stack+0x33/0x60
[ 90.002550] ? kasan_set_track+0x25/0x30
[ 90.002554] ? __kasan_kmalloc+0x8f/0xa0
[ 90.002558] ? amdgpu_gtt_mgr_new+0x81/0x420 [amdgpu]
[ 90.003023] ? ttm_resource_alloc+0xf6/0x220 [ttm]
[ 90.003038] amdgpu_bo_pin_restricted+0x2dd/0x8b0 [amdgpu]
[ 90.003210] ? __x64_sys_ioctl+0x131/0x1a0
[ 90.003210] ? do_syscall_64+0x60/0x90
Fixes: a2848d0874 ("drm/ttm: never consider pinned BOs for eviction&swap")
Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20230724024229.1118444-1-guchun.chen@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
2023-07-27 09:51:51 +02:00
..
2023-07-14 10:14:58 -06:00
2023-07-06 22:25:06 -07:00
2023-07-03 12:56:23 -07:00
2023-06-29 11:00:17 -07:00
2023-07-03 12:56:23 -07:00
2023-06-28 16:43:10 -07:00
2023-07-05 15:44:45 -07:00
2023-07-06 09:56:53 -07:00
2023-06-29 08:09:31 -06:00
2023-06-15 13:42:16 +02:00
2023-07-03 15:38:26 -07:00
2023-07-04 11:07:45 -07:00
2023-06-30 09:37:26 -07:00
2023-06-23 10:29:02 +02:00
2023-06-15 13:07:59 +02:00
2023-07-04 11:22:50 -07:00
2023-07-06 13:18:30 -07:00
2023-06-29 16:03:58 -07:00
2023-06-26 07:54:23 -06:00
2023-07-06 09:48:31 -07:00
2023-07-15 13:57:30 +02:00
2023-06-26 15:09:18 -07:00
2023-06-24 14:03:46 +09:00
2023-07-03 12:46:47 -07:00
2023-07-03 12:46:47 -07:00
2023-06-30 14:57:19 -07:00
2023-07-27 09:51:51 +02:00
2023-06-29 11:00:17 -07:00
2023-06-17 23:09:47 +00:00
2023-07-03 12:56:23 -07:00
2023-06-14 08:15:24 -07:00
2023-07-03 12:46:47 -07:00
2023-07-08 12:28:00 -07:00
2023-06-28 19:09:55 +02:00
2023-07-03 12:56:23 -07:00
2023-06-29 21:01:17 -07:00
2023-06-29 15:28:33 -07:00
2023-06-29 20:57:27 -07:00
2023-06-30 09:37:26 -07:00
2023-07-03 11:26:05 -07:00
2023-06-21 14:08:54 +10:00
2023-06-30 17:35:45 -05:00
2023-07-08 12:08:39 -07:00
2023-07-05 10:42:32 -07:00
2023-07-06 10:06:04 -07:00
2023-07-03 10:55:04 -07:00
2023-07-03 12:46:47 -07:00
2023-06-30 14:06:51 +02:00
2023-06-28 14:02:03 -07:00
2023-06-15 13:42:18 +02:00
2023-07-09 09:35:51 -07:00
2023-06-22 18:40:38 -07:00
2023-07-08 13:55:44 -04:00
2023-06-26 07:54:23 -06:00
2023-07-05 15:44:45 -07:00
2023-06-15 13:42:18 +02:00
2023-06-29 14:58:26 -07:00
2023-06-27 07:35:14 +05:30
2023-06-30 17:14:15 +02:00
2023-07-03 12:46:47 -07:00
2023-07-09 09:35:51 -07:00
2023-06-15 13:42:18 +02:00
2023-07-01 08:58:41 -07:00
2023-07-05 21:38:13 -07:00
2023-06-30 14:57:19 -07:00
2023-07-03 13:23:10 -07:00
2023-07-03 17:23:16 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 13:17:25 -07:00
2023-07-05 12:55:06 -07:00
2023-07-06 19:20:23 -07:00
2023-07-03 17:03:05 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 10:43:10 -07:00
2023-07-06 13:18:30 -07:00
2023-06-23 10:27:02 +02:00
2023-07-08 12:35:18 -07:00
2023-07-03 13:23:10 -07:00
2023-06-21 16:31:45 +05:30
2023-07-06 19:24:11 -07:00
2023-07-05 10:42:32 -07:00
2023-07-08 12:35:18 -07:00
2023-06-29 15:22:19 -07:00
2023-06-26 19:41:26 -07:00
2023-06-16 09:53:29 +03:00
2023-07-03 13:14:58 -07:00
2023-07-08 12:35:18 -07:00
2023-07-03 13:23:10 -07:00
2023-07-03 15:38:26 -07:00
2023-06-30 15:22:09 -07:00
2023-07-03 15:38:26 -07:00
2023-07-03 11:31:01 -07:00
2023-06-27 16:46:06 -07:00
2023-06-27 10:47:08 -04:00
2023-06-26 14:30:07 +02:00
2023-06-28 10:28:11 -07:00