drm/ttm: Fix a regression causing kernel oops'es
Subsystems (3)
PATCH 1/1 drm/ttm: Fix a regression causing kernel oops'es
From: Zack Rusin <[email protected]>
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.
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -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);
Signature · 1 line
2.37.2
From: Martin Krastev <[email protected]>
LGTM!
Regards,
Martin
Quoted 30 lines · Zack Rusin
From: Zack Rusin <[email protected]>
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_memto 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 <[email protected]>Fixes e3c92eb4a84f ("drm/ttm: rework on ttm_resource to use size_t type")Cc Somalapuram Amaranath <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -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);
Am 11.01.23 um 18:50 schrieb Zack Rusin:
Quoted 6 lines
From: Zack Rusin <[email protected]>
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_memto avoid kernel oops'es.
Quoted 7 lines
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 <[email protected]>Fixes e3c92eb4a84f ("drm/ttm: rework on ttm_resource to use size_t type")Cc Somalapuram Amaranath <[email protected]>Cc Christian König <[email protected]>
Should I push it to drm-misc-fixes?
Thanks,
Christian.
Quoted 17 lines
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -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);
Quoted 12 lines · Christian König
!! External Email
Am 11.01.23 um 18:50 schrieb Zack Rusin:
Quoted 9 lines
From: Zack Rusin <[email protected]>
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_memto 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.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Zack Rusin <[email protected]>Fixes e3c92eb4a84f ("drm/ttm: rework on ttm_resource to use size_t type")Cc Somalapuram Amaranath <[email protected]>Cc Christian König <[email protected]>Reviewed-by Christian König <[email protected]>Should I push it to drm-misc-fixes?
If you're not too busy that'd be great. Otherwise I can do it tomorrow.
z
Am 12.01.23 um 13:11 schrieb Zack Rusin:
Quoted 13 lines · Christian König
Quoted 12 lines
!! External Email
Am 11.01.23 um 18:50 schrieb Zack Rusin:
Quoted 9 lines
From: Zack Rusin <[email protected]>
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_memto 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.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Signed-off-by Zack Rusin <[email protected]>Fixes e3c92eb4a84f ("drm/ttm: rework on ttm_resource to use size_t type")Cc Somalapuram Amaranath <[email protected]>Cc Christian König <[email protected]>Reviewed-by Christian König <[email protected]>Should I push it to drm-misc-fixes?
If you're not too busy that'd be great. Otherwise I can do it tomorrow.
Done.
Quoted 2 lines
z