Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:43 +0200
committerJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:53 +0200
commita4ff3f0eed766da2549e0597fc46e9d30231d63a (patch)
treea3ccef1e65c2f8327121991d42880b42814c3c16
parent9e0d11f77f505937001de6c388bdd13816019ee0 (diff)
virtio_ring: Fix potential mem leak in
virtqueue_add_indirect_packed (bnc#1012628).
-rw-r--r--patches.kernel.org/5.1.3-039-virtio_ring-Fix-potential-mem-leak-in-virtqueue.patch38
-rw-r--r--series.conf1
2 files changed, 39 insertions, 0 deletions
diff --git a/patches.kernel.org/5.1.3-039-virtio_ring-Fix-potential-mem-leak-in-virtqueue.patch b/patches.kernel.org/5.1.3-039-virtio_ring-Fix-potential-mem-leak-in-virtqueue.patch
new file mode 100644
index 0000000000..a6645bb617
--- /dev/null
+++ b/patches.kernel.org/5.1.3-039-virtio_ring-Fix-potential-mem-leak-in-virtqueue.patch
@@ -0,0 +1,38 @@
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Tue, 12 Mar 2019 15:06:53 +0800
+Subject: [PATCH] virtio_ring: Fix potential mem leak in
+ virtqueue_add_indirect_packed
+References: bnc#1012628
+Patch-mainline: 5.1.3
+Git-commit: df0bfe7501e9319546ea380d39674a4179e059c3
+
+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>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/virtio/virtio_ring.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+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;
+ }
+--
+2.21.0
+
diff --git a/series.conf b/series.conf
index b7f1e0fa0b..750da05d29 100644
--- a/series.conf
+++ b/series.conf
@@ -124,6 +124,7 @@
patches.kernel.org/5.1.3-036-powerpc-book3s-64-check-for-NULL-pointer-in-pgd.patch
patches.kernel.org/5.1.3-037-powerpc-powernv-idle-Restore-IAMR-after-idle.patch
patches.kernel.org/5.1.3-038-powerpc-booke64-set-RI-in-default-MSR.patch
+ patches.kernel.org/5.1.3-039-virtio_ring-Fix-potential-mem-leak-in-virtqueue.patch
########################################################
# Build fixes that apply to the vanilla kernel too.