Skip to content

Commit 55cfaa7

Browse files
committed
drm/vmwgfx: Remove vmwgfx_hashtab
jira VULN-8161 cve CVE-2023-5633 commit-author Maaz Mombasawala <mombasawalam@vmware.com> commit 9da30cd The vmwgfx driver has migrated from using the hashtable in vmwgfx_hashtab to the linux/hashtable implementation. Remove the vmwgfx_hashtab from the driver. Signed-off-by: Maaz Mombasawala <mombasawalam@vmware.com> Reviewed-by: Martin Krastev <krastevm@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com> Signed-off-by: Zack Rusin <zackr@vmware.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221022040236.616490-12-zack@kde.org (cherry picked from commit 9da30cd) Signed-off-by: Sultan Alsawaf <sultan@ciq.com>
1 parent 1c208ab commit 55cfaa7

File tree

7 files changed

+12
-292
lines changed

7 files changed

+12
-292
lines changed

drivers/gpu/drm/vmwgfx/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_hashtab.o vmwgfx_kms.o vmwgfx_drv.o \
2+
vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
33
vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_ttm_buffer.o \
44
vmwgfx_cmd.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
55
vmwgfx_overlay.o vmwgfx_gmrid_manager.o vmwgfx_fence.o \

drivers/gpu/drm/vmwgfx/ttm_object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint64_t key)
284284
}
285285

286286
__release(RCU);
287-
return drm_hash_entry(hash, struct ttm_ref_object, hash)->obj;
287+
return hlist_entry(hash, struct ttm_ref_object, hash)->obj;
288288
}
289289
EXPORT_SYMBOL(ttm_base_object_noref_lookup);
290290

@@ -299,7 +299,7 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
299299
ret = ttm_tfile_find_ref_rcu(tfile, key, &hash);
300300

301301
if (likely(ret == 0)) {
302-
base = drm_hash_entry(hash, struct ttm_ref_object, hash)->obj;
302+
base = hlist_entry(hash, struct ttm_ref_object, hash)->obj;
303303
if (!kref_get_unless_zero(&base->refcount))
304304
base = NULL;
305305
}
@@ -343,7 +343,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
343343
ret = ttm_tfile_find_ref_rcu(tfile, base->handle, &hash);
344344

345345
if (ret == 0) {
346-
ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
346+
ref = hlist_entry(hash, struct ttm_ref_object, hash);
347347
if (kref_get_unless_zero(&ref->kref)) {
348348
rcu_read_unlock();
349349
break;
@@ -407,7 +407,7 @@ int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
407407
spin_unlock(&tfile->lock);
408408
return -EINVAL;
409409
}
410-
ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
410+
ref = hlist_entry(hash, struct ttm_ref_object, hash);
411411
kref_put(&ref->kref, ttm_ref_object_release);
412412
spin_unlock(&tfile->lock);
413413
return 0;

drivers/gpu/drm/vmwgfx/ttm_object.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#include <linux/list.h>
4343
#include <linux/rcupdate.h>
4444

45-
#include "vmwgfx_hashtab.h"
46-
4745
/**
4846
* enum ttm_object_type
4947
*

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ vmw_cmdbuf_res_lookup(struct vmw_cmdbuf_res_manager *man,
8888

8989
hash_for_each_possible_rcu(man->resources, hash, head, key) {
9090
if (hash->key == key)
91-
return drm_hash_entry(hash, struct vmw_cmdbuf_res, hash)->res;
91+
return hlist_entry(hash, struct vmw_cmdbuf_res, hash)->res;
9292
}
9393
return ERR_PTR(-EINVAL);
9494
}
@@ -243,7 +243,7 @@ int vmw_cmdbuf_res_remove(struct vmw_cmdbuf_res_manager *man,
243243

244244
hash_for_each_possible_rcu(man->resources, hash, head, key) {
245245
if (hash->key == key) {
246-
entry = drm_hash_entry(hash, struct vmw_cmdbuf_res, hash);
246+
entry = hlist_entry(hash, struct vmw_cmdbuf_res, hash);
247247
break;
248248
}
249249
}

drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "ttm_object.h"
4444

4545
#include "vmwgfx_fence.h"
46-
#include "vmwgfx_hashtab.h"
4746
#include "vmwgfx_reg.h"
4847
#include "vmwgfx_validation.h"
4948

@@ -104,6 +103,11 @@ struct vmw_fpriv {
104103
bool gb_aware; /* user-space is guest-backed aware */
105104
};
106105

106+
struct vmwgfx_hash_item {
107+
struct hlist_node head;
108+
unsigned long key;
109+
};
110+
107111
/**
108112
* struct vmw_buffer_object - TTM buffer object with vmwgfx additions
109113
* @base: The TTM buffer object

drivers/gpu/drm/vmwgfx/vmwgfx_hashtab.c

Lines changed: 0 additions & 199 deletions
This file was deleted.

drivers/gpu/drm/vmwgfx/vmwgfx_hashtab.h

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)