linux/drivers/gpu/drm/ttm
Zheyu Ma 5c3d753b87 drm/ttm: add a check against null pointer dereference
[ Upstream commit 9e5c772954 ]

When calling ttm_range_man_fini(), 'man' may be uninitialized, which may
cause a null pointer dereference bug.

Fix this by checking if it is a null pointer.

This log reveals it:

[    7.902580 ] BUG: kernel NULL pointer dereference, address: 0000000000000058
[    7.905721 ] RIP: 0010:ttm_range_man_fini+0x40/0x160
[    7.911826 ] Call Trace:
[    7.911826 ]  radeon_ttm_fini+0x167/0x210
[    7.911826 ]  radeon_bo_fini+0x15/0x40
[    7.913767 ]  rs400_fini+0x55/0x80
[    7.914358 ]  radeon_device_fini+0x3c/0x140
[    7.914358 ]  radeon_driver_unload_kms+0x5c/0xe0
[    7.914358 ]  radeon_driver_load_kms+0x13a/0x200
[    7.914358 ]  ? radeon_driver_unload_kms+0xe0/0xe0
[    7.914358 ]  drm_dev_register+0x1db/0x290
[    7.914358 ]  radeon_pci_probe+0x16a/0x230
[    7.914358 ]  local_pci_probe+0x4a/0xb0

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1626274459-8148-1-git-send-email-zheyuma97@gmail.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-31 08:16:12 +02:00
..
Makefile drm/ttm: give resource functions their own [ch] files 2020-08-12 15:51:03 +02:00
ttm_agp_backend.c drm/ttm: protect against reentrant bind in the drivers 2020-09-18 06:14:00 +10:00
ttm_bo_util.c drm/ttm: drop special pipeline accel cleanup function. 2020-09-18 06:23:06 +10:00
ttm_bo_vm.c Merge drm/drm-next into drm-misc-next 2020-09-14 18:11:40 +02:00
ttm_bo.c drm/ttm: fix eviction valuable range check. 2020-10-21 06:59:07 +10:00
ttm_execbuf_util.c drm/ttm/amdgpu: consolidate ttm reserve paths 2020-08-06 12:16:31 +10:00
ttm_memory.c drm/ttm: update kernel-doc line comments 2020-09-21 11:20:13 +02:00
ttm_module.c Add SPDX idenitifier and clarify license 2018-05-15 13:44:27 -05:00
ttm_page_alloc_dma.c drm/ttm/tt: add wrappers to set tt state. 2020-09-16 09:33:24 +10:00
ttm_page_alloc.c drm/ttm/tt: add wrappers to set tt state. 2020-09-16 09:33:24 +10:00
ttm_range_manager.c drm/ttm: add a check against null pointer dereference 2021-07-31 08:16:12 +02:00
ttm_resource.c drm/ttm: remove available_caching 2020-09-15 16:05:19 +02:00
ttm_tt.c drm/ttm: flip tt destroy ordering. 2020-09-18 06:14:41 +10:00