Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/virtio: Fix a double free in virtio_gpu_cmd_map()

This is freed both here and in the caller (virtio_gpu_vram_map()) so
it's a double free. The correct place is only in the caller.

Fixes: 16845c5d5409 ("drm/virtio: implement blob resources: implement vram object")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20201030114808.GD3251003@mwanda
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Dan Carpenter and committed by
Gerd Hoffmann
44510939 2f62f499

+1 -3
+1 -3
drivers/gpu/drm/virtio/virtgpu_vq.c
··· 1211 1211 struct virtio_gpu_resp_map_info *resp_buf; 1212 1212 1213 1213 resp_buf = kzalloc(sizeof(*resp_buf), GFP_KERNEL); 1214 - if (!resp_buf) { 1215 - virtio_gpu_array_put_free(objs); 1214 + if (!resp_buf) 1216 1215 return -ENOMEM; 1217 - } 1218 1216 1219 1217 cmd_p = virtio_gpu_alloc_cmd_resp 1220 1218 (vgdev, virtio_gpu_cmd_resource_map_cb, &vbuf, sizeof(*cmd_p),