From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 356DA1B1B0; Thu, 18 Jan 2018 10:07:56 +0100 (CET) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 6CD70123892; Thu, 18 Jan 2018 10:06:23 +0100 (CET) From: Olivier Matz To: dev@dpdk.org, Yuanhan Liu , Maxime Coquelin , Tiwei Bie Cc: stable@dpdk.org, Zijie Pan Date: Thu, 18 Jan 2018 10:07:33 +0100 Message-Id: <20180118090733.12728-4-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180118090733.12728-1-olivier.matz@6wind.com> References: <20180118090733.12728-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 3/3] net/virtio: fix memory leak when reinitializing device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2018 09:07:56 -0000 Free the previous queues and the attached mbufs before initializing new ones. Cc: stable@dpdk.org Fixes: 60e6f4707ef2 ("net/virtio: reinitialize device when configuring") Signed-off-by: Zijie Pan Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index d8b3b8ed7..977fd61f5 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1379,6 +1379,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Reset the device although not necessary at startup */ vtpci_reset(hw); + if (hw->vqs) { + virtio_dev_free_mbufs(eth_dev); + virtio_free_queues(hw); + } + /* Tell the host we've noticed this device. */ vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK); -- 2.11.0