drm/amdgpu: fix use after free during BO move
authorChristian König <christian.koenig@amd.com>
Tue, 7 Sep 2021 07:37:52 +0000 (09:37 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Sep 2021 17:30:49 +0000 (13:30 -0400)
commit101ba90ff0339f02591ea141ea5cf09f4377d31a
tree58b93d1bc08351d4cbddfd136738f1fb4f431e3b
parentac1509d19e2e44d1ea13753cfc265c4693f12ef5
drm/amdgpu: fix use after free during BO move

The memory backing old_mem is already freed at that point, move the
check a bit more up.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: bfa3357ef9ab ("drm/ttm: allocate resource object instead of embedding it v2")
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1699
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c