diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-10-30 14:48:08 +0300 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-11-06 10:50:30 +0300 |
commit | 44510939b18dcb39b1d79ecd1240e2e65dbdf78b (patch) | |
tree | fa141bc96dc025597c95ae0b7294a8cc1eb0d0f4 /drivers/gpu/drm/virtio/virtgpu_vq.c | |
parent | 2f62f4990dca0e80b7f247b84d372f7a8c1b6aef (diff) | |
download | linux-44510939b18dcb39b1d79ecd1240e2e65dbdf78b.tar.xz |
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>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_vq.c')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_vq.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 857f730747b6..cf84d382dd41 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -1211,10 +1211,8 @@ int virtio_gpu_cmd_map(struct virtio_gpu_device *vgdev, struct virtio_gpu_resp_map_info *resp_buf; resp_buf = kzalloc(sizeof(*resp_buf), GFP_KERNEL); - if (!resp_buf) { - virtio_gpu_array_put_free(objs); + if (!resp_buf) return -ENOMEM; - } cmd_p = virtio_gpu_alloc_cmd_resp (vgdev, virtio_gpu_cmd_resource_map_cb, &vbuf, sizeof(*cmd_p), |