projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6862965
)
drm/virtio: fix memory leak of vfpriv on error return path
author
Colin Ian King
<colin.king@canonical.com>
Wed, 7 Nov 2018 20:31:22 +0000
(20:31 +0000)
committer
Gerd Hoffmann
<kraxel@redhat.com>
Wed, 14 Nov 2018 13:21:03 +0000
(14:21 +0100)
The allocation for vfpriv is being leaked on an error return path,
fix this by kfree'ing it before returning.
Detected by CoverityScan, CID#
1475380
("Resource Leak")
Fixes: 6a37c49a94a9 ("drm/virtio: Handle context ID allocation errors")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link:
http://patchwork.freedesktop.org/patch/msgid/20181107203122.6861-1-colin.king@canonical.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_kms.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/virtio/virtgpu_kms.c
b/drivers/gpu/drm/virtio/virtgpu_kms.c
index 8118f10fde4a59c6e7000a8280970b923c17dac9..691b842d5f3a4ed6f374953f857894b952f8c324 100644
(file)
--- a/
drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/
drivers/gpu/drm/virtio/virtgpu_kms.c
@@
-267,8
+267,10
@@
int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file)
get_task_comm(dbgname, current);
id = virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname);
- if (id < 0)
+ if (id < 0) {
+ kfree(vfpriv);
return id;
+ }
vfpriv->ctx_id = id;
file->driver_priv = vfpriv;