Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-03-12 15:06:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 19:40:30 +0200
commit7f9572e798ea8c7a6a7b846c8fb577905e3d4a6c (patch)
treeeda15261083cfef366b09dda76e65b072bb39946
parentba81b50090a42542d48ba3395e5429ce689d6a59 (diff)
virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed
commit df0bfe7501e9319546ea380d39674a4179e059c3 upstream. 'desc' should be freed before leaving from err handing path. Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/virtio/virtio_ring.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index a38b65b97be0..a659e52cf79c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -993,6 +993,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
if (unlikely(vq->vq.num_free < 1)) {
pr_debug("Can't add buf len 1 - avail = 0\n");
+ kfree(desc);
END_USE(vq);
return -ENOSPC;
}