drm/ttm: fix bulk_move corruption when adding a entry
authorYunxiang Li <Yunxiang.Li@amd.com>
Thu, 22 Jun 2023 14:18:03 +0000 (10:18 -0400)
committerChristian König <christian.koenig@amd.com>
Thu, 22 Jun 2023 14:46:42 +0000 (16:46 +0200)
commit4481913607e58196c48a4fef5e6f45350684ec3c
treeb43da3392f7c086977990363d42fdfca48dab7f3
parent98703e4e061fb8715c7613cd227e32cdfd136b23
drm/ttm: fix bulk_move corruption when adding a entry

When the resource is the first in the bulk_move range, adding it again
(thus moving it to the tail) will corrupt the list since the first
pointer is not moved. This eventually lead to null pointer deref in
ttm_lru_bulk_move_del()

Fixes: fee2ede15542 ("drm/ttm: rework bulk move handling v5")
Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20230622141902.28718-3-Yunxiang.Li@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/ttm/ttm_resource.c