]> git.baikalelectronics.ru Git - kernel.git/commit
drm/ttm: fix use-after-free races in vm fault handling
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sat, 18 Feb 2017 21:59:56 +0000 (22:59 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Feb 2017 21:48:45 +0000 (16:48 -0500)
commit2fe8d5378d8f8e4efeacc14ab4f98c5f29e6260f
treedfcf8846b214b4b340ed5eac64cc1810219d4ecb
parent174283c70e8db335475b9858b63a433ef3e1efa2
drm/ttm: fix use-after-free races in vm fault handling

The vm fault handler relies on the fact that the VMA owns a reference
to the BO. However, once mmap_sem is released, other tasks are free to
destroy the VMA, which can lead to the BO being freed. Fix two code
paths where that can happen, both related to vm fault retries.

Found via a lock debugging warning which flagged &bo->wu_mutex as
locked while being destroyed.

Fixes: eb131ee58860 ("drm/ttm: Allow vm fault retries")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo_vm.c