All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] vhost: fix malloc in rte_vhost_get_mem_table
@ 2017-05-11 10:23 Dariusz Stojaczyk
  2017-05-11 10:23 ` [PATCH 2/3] vhost: free virtio_net::guest_pages in vhost_backend_cleanup() Dariusz Stojaczyk
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Dariusz Stojaczyk @ 2017-05-11 10:23 UTC (permalink / raw)
  To: dev; +Cc: Dariusz Stojaczyk

Amount of allocated memory was too small, causing buffer overflow.

Change-Id: I02293cd4bcddef14d2bbf314c79d8c65fc44e555
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
---
 lib/librte_vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 0b19d2e..1f565fb 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -369,7 +369,7 @@ rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem)
 		return -1;
 
 	size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region);
-	m = malloc(size);
+	m = malloc(sizeof(struct rte_vhost_memory) + size);
 	if (!m)
 		return -1;
 
-- 
2.7.4

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-05-26  8:40 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 10:23 [PATCH 1/3] vhost: fix malloc in rte_vhost_get_mem_table Dariusz Stojaczyk
2017-05-11 10:23 ` [PATCH 2/3] vhost: free virtio_net::guest_pages in vhost_backend_cleanup() Dariusz Stojaczyk
2017-05-11 10:23 ` [PATCH 3/3] vhost: access VhostUsrMsg via packed struct Dariusz Stojaczyk
2017-05-11 10:56 ` [PATCH v2 1/3] vhost: fix malloc in rte_vhost_get_mem_table Dariusz Stojaczyk
2017-05-11 10:56   ` [PATCH v2 2/3] vhost: free virtio_net::guest_pages in vhost_backend_cleanup() Dariusz Stojaczyk
2017-05-11 10:56   ` [PATCH v2 3/3] vhost: access VhostUsrMsg via packed struct Dariusz Stojaczyk
2017-05-11 11:42   ` [PATCH v2 1/3] vhost: fix malloc in rte_vhost_get_mem_table Jens Freimann
2017-05-11 12:32     ` Stojaczyk, DariuszX
2017-05-11 14:33   ` [PATCH v3 0/3] vhost undefined behavior fixes Dariusz Stojaczyk
2017-05-11 14:33     ` [PATCH v3 1/3] vhost: fix malloc in rte_vhost_get_mem_table() Dariusz Stojaczyk
2017-05-11 13:56       ` Jens Freimann
2017-05-11 14:33     ` [PATCH v3 2/3] vhost: free guest_pages in vhost_backend_cleanup() Dariusz Stojaczyk
2017-05-11 14:31       ` Jens Freimann
2017-05-11 14:33     ` [PATCH v3 3/3] vhost: access VhostUsrMsg via packed struct Dariusz Stojaczyk
2017-05-22  7:01       ` Yuanhan Liu
2017-05-24 13:12         ` Stojaczyk, DariuszX
2017-05-26  5:58           ` Yuanhan Liu
2017-05-26 11:59     ` [PATCH v4 0/3] vhost: undefined behavior fixes Dariusz Stojaczyk
2017-05-26  8:40       ` Yuanhan Liu
2017-05-26 11:59       ` [PATCH v4 1/3] vhost: fix malloc in rte_vhost_get_mem_table() Dariusz Stojaczyk
2017-05-26 11:59       ` [PATCH v4 2/3] vhost: free guest_pages in vhost_backend_cleanup() Dariusz Stojaczyk
2017-05-26 11:59       ` [PATCH v4 3/3] vhost: access VhostUsrMsg via packed struct Dariusz Stojaczyk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.