drm/amdgpu: Fix size validation for non-exclusive domains (v4)
authorLuben Tuikov <luben.tuikov@amd.com>
Sat, 10 Dec 2022 07:51:19 +0000 (02:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:37 +0000 (12:02 +0100)
commit8ba7c55e112f4ffd2a95b99be1cb1c891ef08ba1
treebe95ccc898a3ac0e3e82f93422a8f1b4b3a840ff
parentb48f8c9a81bea30892f793639a0884a2bd3e15da
drm/amdgpu: Fix size validation for non-exclusive domains (v4)

[ Upstream commit 7554886daa31eacc8e7fac9e15bbce67d10b8f1f ]

Fix amdgpu_bo_validate_size() to check whether the TTM domain manager for the
requested memory exists, else we get a kernel oops when dereferencing "man".

v2: Make the patch standalone, i.e. not dependent on local patches.
v3: Preserve old behaviour and just check that the manager pointer is not
    NULL.
v4: Complain if GTT domain requested and it is uninitialized--most likely a
    bug.

Cc: Alex Deucher <Alexander.Deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: AMD Graphics <amd-gfx@lists.freedesktop.org>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c