OSDN Git Service

drm/ttm: Always and only destroy bo->ttm_resv in ttm_bo_release_list
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 3 Nov 2017 15:00:35 +0000 (16:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Dec 2017 10:26:35 +0000 (11:26 +0100)
commit6cd3e4a3e697cca84f27a0af68ba59a6ab00892f
tree70bb17bf7f23c2ab6340baea99a177b4d17b1803
parent99b0ea0391d1b49ed4a944a07ad57ee448b0541c
drm/ttm: Always and only destroy bo->ttm_resv in ttm_bo_release_list

commit e1fc12c5d9ad06a2a74e97a91f1b0c5f4c723b50 upstream.

Fixes a use-after-free due to a race condition in
ttm_bo_cleanup_refs_and_unlock, which allows one task to reserve a BO
and destroy its ttm_resv while another task is waiting for it to signal
in reservation_object_wait_timeout_rcu.

v2:
* Always initialize bo->ttm_resv in ttm_bo_init_reserved
 (Christian König)

Fixes: 0d2bd2ae045d "drm/ttm: fix memory leak while individualizing BOs"
Reviewed-by: Chunming Zhou <david1.zhou@amd.com> # v1
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/ttm/ttm_bo.c