Skip to content

Commit f2dd492

Browse files
committed
drm/vmwgfx: Cleanup the vmw bo usage in the cursor paths
jira VULN-8161 cve CVE-2023-5633 commit-author Zack Rusin <zackr@vmware.com> commit cb8097a Base mapped count is useless because the ttm unmap functions handle null maps just fine so completely remove all the code related to it. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Martin Krastev <krastevm@vmware.com> Reviewed-by: Maaz Mombasawala <mombasawalam@vmware.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230131033542.953249-6-zack@kde.org (cherry picked from commit cb8097a) Signed-off-by: Sultan Alsawaf <sultan@ciq.com>
1 parent 1e1e1b5 commit f2dd492

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_bo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ struct vmw_resource;
4444
* struct vmw_bo - TTM buffer object with vmwgfx additions
4545
* @base: The TTM buffer object
4646
* @res_tree: RB tree of resources using this buffer object as a backing MOB
47-
* @base_mapped_count: ttm BO mapping count; used by KMS atomic helpers.
4847
* @cpu_writers: Number of synccpu write grabs. Protected by reservation when
4948
* increased. May be decreased without reservation.
5049
* @dx_query_ctx: DX context if this buffer object is used as a DX query MOB
@@ -55,8 +54,6 @@ struct vmw_resource;
5554
struct vmw_bo {
5655
struct ttm_buffer_object base;
5756
struct rb_root res_tree;
58-
/* For KMS atomic helpers: ttm bo mapping count */
59-
atomic_t base_mapped_count;
6057

6158
atomic_t cpu_writers;
6259
/* Not ref-counted. Protected by binding_mutex */

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,7 @@ vmw_du_cursor_plane_cleanup_fb(struct drm_plane *plane,
669669
const int ret = ttm_bo_reserve(&vps->bo->base, true, false, NULL);
670670

671671
if (likely(ret == 0)) {
672-
if (atomic_read(&vps->bo->base_mapped_count) == 0)
673-
ttm_bo_kunmap(&vps->bo->map);
672+
ttm_bo_kunmap(&vps->bo->map);
674673
ttm_bo_unreserve(&vps->bo->base);
675674
}
676675
}
@@ -744,9 +743,6 @@ vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane,
744743

745744
ret = ttm_bo_kmap(&vps->bo->base, 0, PFN_UP(size), &vps->bo->map);
746745

747-
if (likely(ret == 0))
748-
atomic_inc(&vps->bo->base_mapped_count);
749-
750746
ttm_bo_unreserve(&vps->bo->base);
751747

752748
if (unlikely(ret != 0))
@@ -786,7 +782,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
786782
struct vmw_plane_state *vps = vmw_plane_state_to_vps(new_state);
787783
struct vmw_plane_state *old_vps = vmw_plane_state_to_vps(old_state);
788784
s32 hotspot_x, hotspot_y;
789-
bool dummy;
790785

791786
hotspot_x = du->hotspot_x;
792787
hotspot_y = du->hotspot_y;
@@ -828,11 +823,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
828823
hotspot_x, hotspot_y);
829824
}
830825

831-
if (vps->bo) {
832-
if (ttm_kmap_obj_virtual(&vps->bo->map, &dummy))
833-
atomic_dec(&vps->bo->base_mapped_count);
834-
}
835-
836826
du->cursor_x = new_state->crtc_x + du->set_gui_x;
837827
du->cursor_y = new_state->crtc_y + du->set_gui_y;
838828

0 commit comments

Comments
 (0)