All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
To: dev@dpdk.org
Cc: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Subject: [PATCH v3 2/3] vhost: free guest_pages in vhost_backend_cleanup()
Date: Thu, 11 May 2017 16:33:11 +0200	[thread overview]
Message-ID: <1494513192-85863-3-git-send-email-dariuszx.stojaczyk@intel.com> (raw)
In-Reply-To: <1494513192-85863-1-git-send-email-dariuszx.stojaczyk@intel.com>

This patch fixes a memory leak.
virtio_net::guest_pages is allocated in vhost_setup_mem_table(),
reallocated in add_one_guest_page(), but never freed.

Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
---
 lib/librte_vhost/vhost_user.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 5c8058b..2cc0b66 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -114,6 +114,10 @@ vhost_backend_cleanup(struct virtio_net *dev)
 		rte_free(dev->mem);
 		dev->mem = NULL;
 	}
+
+	free(dev->guest_pages);
+	dev->guest_pages = NULL;
+
 	if (dev->log_addr) {
 		munmap((void *)(uintptr_t)dev->log_addr, dev->log_size);
 		dev->log_addr = 0;
-- 
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.

  parent reply	other threads:[~2017-05-11 11:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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     ` Dariusz Stojaczyk [this message]
2017-05-11 14:31       ` [PATCH v3 2/3] vhost: free guest_pages in vhost_backend_cleanup() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494513192-85863-3-git-send-email-dariuszx.stojaczyk@intel.com \
    --to=dariuszx.stojaczyk@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.