diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-26 15:50:13 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-27 16:14:18 +0200 |
commit | c7eae62666ade1c8c9960085911e420227144d5a (patch) | |
tree | 0013d1212a78270d4d112911ace94bdcbfe1a3bf /drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c | |
parent | b1d05b4fc6b8f2bf5d802cb08c87d96802c4c7ba (diff) | |
download | talos-obmc-linux-c7eae62666ade1c8c9960085911e420227144d5a.tar.gz talos-obmc-linux-c7eae62666ade1c8c9960085911e420227144d5a.zip |
drm/vmwgfx: Make the object handles idr-generated
Instead of generating user-space object handles based on a, possibly
processed, hash of the kernel address of the object, use idr to generate
and lookup those handles. This might improve somewhat on security since
we loose all connections to the object's kernel address. Also idr is
designed to do just this.
As a todo-item, since user-space handles are now generated in sequence,
we can probably use a much simpler hash function to hash them.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c index 3bd60f7a9d6d..6a6865384e91 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c @@ -159,7 +159,8 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data, alloc_size = offsetof(struct vmw_user_simple_resource, simple) + func->size; - account_size = ttm_round_pot(alloc_size) + VMW_IDA_ACC_SIZE; + account_size = ttm_round_pot(alloc_size) + VMW_IDA_ACC_SIZE + + TTM_OBJ_EXTRA_SIZE; ret = ttm_read_lock(&dev_priv->reservation_sem, true); if (ret) @@ -208,7 +209,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data, goto out_err; } - func->set_arg_handle(data, usimple->base.hash.key); + func->set_arg_handle(data, usimple->base.handle); out_err: vmw_resource_unreference(&res); out_ret: |