Hi,
On 14-03-19 16:21, Sidong Yang wrote:
In function vbox_dumb_create() of vbox_main.c, It calls vbox_gem_create()
for creating drm_gem_object. and it calls vbox_gem_handle_create() for handle.
If handle creation fails only, drm_gem_object should be released by calling
drm_gem_object_put_unlocked().
Nack.
On success drm_gem_handle_create does a drm_gem_object_get on success, since
we forgot about the gem_object afterwards (we only keep track of the
gem_handle with its embedded reference), we should release our
gem_object_reference on success, so that when the gem_handle gets free-ed
the gem_object also gets free-ed.
So we should release out reference on the gem_object in both the
success and failure paths and the old code is correct.
Also for drm-drivers, you should always Cc the dri-devel list.
Regards,
Hans
p.s.
In drm-misc-next vboxvideo has been moved out of staging, please base any
further vboxvideo patches on top of drm-misc-next.
Signed-off-by: Sidong Yang <realwakka@xxxxxxxxx> > ---
drivers/staging/vboxvideo/vbox_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
index e1fb70a42d32..ca676ba37bb4 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -312,9 +312,10 @@ int vbox_dumb_create(struct drm_file *file,
return ret;
ret = drm_gem_handle_create(file, gobj, &handle);
- drm_gem_object_put_unlocked(gobj);
- if (ret)
+ if (ret) {
+ drm_gem_object_put_unlocked(gobj);
return ret;
+ }
args->handle = handle;
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel