diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2017-03-27 05:21:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-12 06:41:10 -0400 |
commit | b116797b81e55c6ac9ddcbf92bcd662648273045 (patch) | |
tree | 418aa088397a8777f558bc9ce994da7e5467cdc6 /drivers/gpu/drm/ttm/ttm_object.c | |
parent | 604d2eac67cb3518aa6a236ec505fbe7c60947af (diff) |
drm/ttm, drm/vmwgfx: Relax permission checking when opening surfaces
commit fe25deb7737ce6c0879ccf79c99fa1221d428bf2 upstream.
Previously, when a surface was opened using a legacy (non prime) handle,
it was verified to have been created by a client in the same master realm.
Relax this so that opening is also allowed recursively if the client
already has the surface open.
This works around a regression in svga mesa where opening of a shared
surface is used recursively to obtain surface information.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_object.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_object.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index 4f5fa8d65fe9..144367c0c28f 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
@@ -179,7 +179,7 @@ int ttm_base_object_init(struct ttm_object_file *tfile, | |||
179 | if (unlikely(ret != 0)) | 179 | if (unlikely(ret != 0)) |
180 | goto out_err0; | 180 | goto out_err0; |
181 | 181 | ||
182 | ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL); | 182 | ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false); |
183 | if (unlikely(ret != 0)) | 183 | if (unlikely(ret != 0)) |
184 | goto out_err1; | 184 | goto out_err1; |
185 | 185 | ||
@@ -318,7 +318,8 @@ EXPORT_SYMBOL(ttm_ref_object_exists); | |||
318 | 318 | ||
319 | int ttm_ref_object_add(struct ttm_object_file *tfile, | 319 | int ttm_ref_object_add(struct ttm_object_file *tfile, |
320 | struct ttm_base_object *base, | 320 | struct ttm_base_object *base, |
321 | enum ttm_ref_type ref_type, bool *existed) | 321 | enum ttm_ref_type ref_type, bool *existed, |
322 | bool require_existed) | ||
322 | { | 323 | { |
323 | struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; | 324 | struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; |
324 | struct ttm_ref_object *ref; | 325 | struct ttm_ref_object *ref; |
@@ -345,6 +346,9 @@ int ttm_ref_object_add(struct ttm_object_file *tfile, | |||
345 | } | 346 | } |
346 | 347 | ||
347 | rcu_read_unlock(); | 348 | rcu_read_unlock(); |
349 | if (require_existed) | ||
350 | return -EPERM; | ||
351 | |||
348 | ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref), | 352 | ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref), |
349 | false, false); | 353 | false, false); |
350 | if (unlikely(ret != 0)) | 354 | if (unlikely(ret != 0)) |
@@ -635,7 +639,7 @@ int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, | |||
635 | prime = (struct ttm_prime_object *) dma_buf->priv; | 639 | prime = (struct ttm_prime_object *) dma_buf->priv; |
636 | base = &prime->base; | 640 | base = &prime->base; |
637 | *handle = base->hash.key; | 641 | *handle = base->hash.key; |
638 | ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL); | 642 | ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false); |
639 | 643 | ||
640 | dma_buf_put(dma_buf); | 644 | dma_buf_put(dma_buf); |
641 | 645 | ||