diff options
author | YueHaibing <yuehaibing@huawei.com> | 2019-03-12 08:06:53 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-05-12 19:11:35 +0200 |
commit | df0bfe7501e9319546ea380d39674a4179e059c3 (patch) | |
tree | d2525506a8657631ca828173406ff0a5704b2136 /drivers/virtio | |
parent | Linux 5.1 (diff) | |
download | linux-df0bfe7501e9319546ea380d39674a4179e059c3.tar.xz linux-df0bfe7501e9319546ea380d39674a4179e059c3.zip |
virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed
'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
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 5df92c308286..021010424fa5 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1004,6 +1004,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; } |