aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/vhost.c
diff options
context:
space:
mode:
authorMatthias Lange <matthias.lange@kernkonzept.com>2019-09-06 16:59:01 +0200
committerMichael S. Tsirkin <mst@redhat.com>2019-09-09 10:43:15 -0400
commitcf8f1696709ad5bb3138ed8c771c2eb98950cd8a (patch)
tree1bcd78442f26804d5b15643a44eedfdb9c984332 /drivers/vhost/vhost.c
parentmm/balloon_compaction: suppress allocation warnings (diff)
downloadlinux-dev-cf8f1696709ad5bb3138ed8c771c2eb98950cd8a.tar.xz
linux-dev-cf8f1696709ad5bb3138ed8c771c2eb98950cd8a.zip
virtio_ring: fix unmap of indirect descriptors
The function virtqueue_add_split() DMA-maps the scatterlist buffers. In case a mapping error occurs the already mapped buffers must be unmapped. This happens by jumping to the 'unmap_release' label. In case of indirect descriptors the release is wrong and may leak kernel memory. Because the implementation assumes that the head descriptor is already mapped it starts iterating over the descriptor list starting from the head descriptor. However for indirect descriptors the head descriptor is never mapped in case of an error. The fix is to initialize the start index with zero in case of indirect descriptors and use the 'desc' pointer directly for iterating over the descriptor chain. Signed-off-by: Matthias Lange <matthias.lange@kernkonzept.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.c')
0 files changed, 0 insertions, 0 deletions