diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-05 11:07:19 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-05 11:07:19 +0000 |
commit | a9e7ae962a47fa3c556b03f0f8b81373b37d6296 (patch) | |
tree | f831406d2af67ab7159c6f25bde8fada8e343198 /sys/dev/pci | |
parent | 7f5bfff5a5ade8f6398a33394a8b3b8856130beb (diff) |
drm: hold gem reference until object is no longer accessed
From Steve Cohen
5aa4eb5a6d915cf00bf104ddd76e1adbc3dabdc4 in linux 5.7.y/5.7.13
8490d6a7e0a0a6fab5c2d82d57a3937306660864 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/drm_gem.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/drm_gem.c b/sys/dev/pci/drm/drm_gem.c index eb579d1f605..9c0d54cb299 100644 --- a/sys/dev/pci/drm/drm_gem.c +++ b/sys/dev/pci/drm/drm_gem.c @@ -1065,9 +1065,6 @@ err: * @file_priv: drm file-private structure * * Open an object using the global name, returning a handle and the size. - * - * This handle (of course) holds a reference to the object, so the object - * will not go away until the handle is deleted. */ int drm_gem_open_ioctl(struct drm_device *dev, void *data, @@ -1092,14 +1089,15 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data, /* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ ret = drm_gem_handle_create_tail(file_priv, obj, &handle); - drm_gem_object_put_unlocked(obj); if (ret) - return ret; + goto err; args->handle = handle; args->size = obj->size; - return 0; +err: + drm_gem_object_put_unlocked(obj); + return ret; } /** |