Skip to contentSkip to conversation

drm/virtio: fix the missed drm_gem_object_put() in virtio_gpu_user_framebuffer_create()

PATCH Applied Jing Xiangfeng 2 participants 2 messages Oct 9, 2021 – Oct 11, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/virtio: fix the missed drm_gem_object_put() in virtio_gpu_user_framebuffer_create()

virtio_gpu_user_framebuffer_create() misses to call drm_gem_object_put() in an error path. Add the missed function call to fix it.

---
 drivers/gpu/drm/virtio/virtgpu_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +3 -1
index a6caebd4a0dd..5b00310ac4cd 100644
@@ -308,8 +308,10 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
 		return ERR_PTR(-EINVAL);
 
 	virtio_gpu_fb = kzalloc(sizeof(*virtio_gpu_fb), GFP_KERNEL);
-	if (virtio_gpu_fb == NULL)
+	if (virtio_gpu_fb == NULL) {
+		drm_gem_object_put(obj);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj);
 	if (ret) {
Signature · 1 line
2.26.0.106.g9fadedd
maintainer Applied
#1 lore raw
Quoted 2 lines · Jing Xiangfeng

virtio_gpu_user_framebuffer_create() misses to call drm_gem_object_put() in an error path. Add the missed function call to fix it.

Pushed to drm-misc-next.

thanks,
Gerd