vhost-user-gpu: reorder free calls.
PATCH 1/1 vhost-user-gpu: reorder free calls.
Free in correct order to avoid use-after-free.
Resolves: CID 1453812
Signed-off-by Gerd Hoffmann <[email protected]>
--- contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/vhost-user-gpu/vhost-user-gpu.c +1 -1
@@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,if (!res->image) {g_critical ("%s: resource creation failed %d %d %d" , __func__, c2d.resource_id, c2d.width, c2d.height); -g_free (res);vugbm_buffer_destroy (&res->buffer); +g_free (res); cmd->error =VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY ;return ; }
Signature · 1 line
2.31.1
Quoted 5 lines · Gerd Hoffmann
Free in correct order to avoid use-after-free.
Resolves: CID 1453812
Signed-off-by Gerd Hoffmann <[email protected]>
Reviewed-by Marc-André Lureau <[email protected]>
---
Quoted 23 lines
contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)contrib/vhost-user-gpu/vhost-user-gpu.c +1
-2@@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,if (!res->image) {g_critical ("%s: resource creation failed %d %d %d" , __func__, c2d.resource_id, c2d.width, c2d.height); -g_free (res);vugbm_buffer_destroy (&res->buffer); +g_free (res); cmd->error =VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY ;return ; } --2.31.1
Signature · 1 line
Marc-André Lureau
Quoted 7 lines · Gerd Hoffmann
Free in correct order to avoid use-after-free.
Resolves: CID 1453812
Signed-off-by Gerd Hoffmann <[email protected]>--- contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 5 lines · Gerd Hoffmann <[email protected]> 于2021年6月4日周五 下午6:37写道:
Free in correct order to avoid use-after-free.
Resolves: CID 1453812
Signed-off-by Gerd Hoffmann <[email protected]>
Sorry, my fault.
Reviewed-by Li Qiang <[email protected]>
Quoted 22 lines
--- contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)contrib/vhost-user-gpu/vhost-user-gpu.c +1
-2@@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,if (!res->image) {g_critical ("%s: resource creation failed %d %d %d" , __func__, c2d.resource_id, c2d.width, c2d.height); -g_free (res);vugbm_buffer_destroy (&res->buffer); +g_free (res); cmd->error =VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY ;return ; } --2.31.1