drm/ttm: Fix an invalid freeing on already freed page in error path
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 21 Feb 2024 07:33:24 +0000 (08:33 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 22 Feb 2024 09:57:41 +0000 (10:57 +0100)
commit40510a941d27d405a82dc3320823d875f94625df
treede76e9c61b8f44fda639e12b9367f641f07b528f
parented683b9bb91fc274383e222ba5873a9ee9033462
drm/ttm: Fix an invalid freeing on already freed page in error path

If caching mode change fails due to, for example, OOM we
free the allocated pages in a two-step process. First the pages
for which the caching change has already succeeded. Secondly
the pages for which a caching change did not succeed.

However the second step was incorrectly freeing the pages already
freed in the first step.

Fix.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Fixes: 379989e7cbdc ("drm/ttm/pool: Fix ttm_pool_alloc error path")
Cc: Christian König <christian.koenig@amd.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.4+
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240221073324.3303-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/ttm/ttm_pool.c