[PATCH] drm/ttm: Fix a regression causing kernel oops'es
Martin Krastev (VMware)
martinkrastev768 at gmail.com
Wed Jan 11 21:04:15 UTC 2023
From: Martin Krastev <krastevm at vmware.com>
LGTM!
Reviewed-by: Martin Krastev <krastevm at vmware.com>
Regards,
Martin
On 11.01.23 г. 19:50 ч., Zack Rusin wrote:
> From: Zack Rusin <zackr at vmware.com>
>
> The branch is explicitly taken if ttm == NULL which means that to avoid
> a null pointer reference the ttm object can not be used inside. Switch
> back to dst_mem to avoid kernel oops'es.
>
> This fixes kernel oops'es with any buffer objects which don't have ttm_tt,
> e.g. with vram based screen objects on vmwgfx.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> Fixes: e3c92eb4a84f ("drm/ttm: rework on ttm_resource to use size_t type")
> Cc: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index fee7c20775c0..12017ec24d9f 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -183,7 +183,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
>
> clear = src_iter->ops->maps_tt && (!ttm || !ttm_tt_is_populated(ttm));
> if (!(clear && ttm && !(ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC)))
> - ttm_move_memcpy(clear, ttm->num_pages, dst_iter, src_iter);
> + ttm_move_memcpy(clear, PFN_UP(dst_mem->size), dst_iter, src_iter);
>
> if (!src_iter->ops->maps_tt)
> ttm_kmap_iter_linear_io_fini(&_src_iter.io, bdev, src_mem);
More information about the dri-devel
mailing list