* [dpdk-stable] [PATCH] net/virtio: fix memory leak
@ 2017-10-27 3:54 Pengzhen Liu
2017-11-01 15:33 ` Yuanhan Liu
0 siblings, 1 reply; 8+ messages in thread
From: Pengzhen Liu @ 2017-10-27 3:54 UTC (permalink / raw)
To: thomas; +Cc: dev, liupengzhen3, stable
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed
when function return,
this is a possible memory leak.
Fixes: 8ced1542f7a3 ("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
---
drivers/net/virtio/virtio_ethdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index a8ae788..59a76ad 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1588,13 +1588,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
if (!hw->virtio_user_dev) {
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
- return ret;
+ goto out;
}
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
- return ret;
+ goto out;
/* Setup interrupt callback */
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
@@ -1602,6 +1602,10 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
virtio_interrupt_handler, eth_dev);
return 0;
+
+out:
+ rte_free(eth_dev->data->mac_addrs);
+ return ret;
}
static int
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH] net/virtio: fix memory leak
2017-10-27 3:54 [dpdk-stable] [PATCH] net/virtio: fix memory leak Pengzhen Liu
@ 2017-11-01 15:33 ` Yuanhan Liu
2017-11-01 15:49 ` Yuanhan Liu
2017-11-12 18:53 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 2 replies; 8+ messages in thread
From: Yuanhan Liu @ 2017-11-01 15:33 UTC (permalink / raw)
To: Pengzhen Liu; +Cc: thomas, dev, stable
On Fri, Oct 27, 2017 at 11:54:09AM +0800, Pengzhen Liu wrote:
> In function eth_virtio_dev_init(), dynamic memory stored
> in "eth_dev->data->mac_addrs" variable and it is not freed
> when function return,
> this is a possible memory leak.
>
> Fixes: 8ced1542f7a3 ("net/virtio: eth_dev->data->mac_addrs is not freed")
> Cc: stable@dpdk.org
> Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
--yliu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH] net/virtio: fix memory leak
2017-11-01 15:33 ` Yuanhan Liu
@ 2017-11-01 15:49 ` Yuanhan Liu
2017-11-12 18:53 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
1 sibling, 0 replies; 8+ messages in thread
From: Yuanhan Liu @ 2017-11-01 15:49 UTC (permalink / raw)
To: Pengzhen Liu; +Cc: thomas, dev, stable
On Wed, Nov 01, 2017 at 11:33:51PM +0800, Yuanhan Liu wrote:
> On Fri, Oct 27, 2017 at 11:54:09AM +0800, Pengzhen Liu wrote:
> > In function eth_virtio_dev_init(), dynamic memory stored
> > in "eth_dev->data->mac_addrs" variable and it is not freed
> > when function return,
> > this is a possible memory leak.
> >
> > Fixes: 8ced1542f7a3 ("net/virtio: eth_dev->data->mac_addrs is not freed")
> > Cc: stable@dpdk.org
> > Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
>
> Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
BTW, I have just seen you have send multiple versions out regarding this
patch. Next time please tag your patches with version, something like:
$ git format-patch -v 2 ...
--yliu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/virtio: fix memory leak
2017-11-01 15:33 ` Yuanhan Liu
2017-11-01 15:49 ` Yuanhan Liu
@ 2017-11-12 18:53 ` Thomas Monjalon
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2017-11-12 18:53 UTC (permalink / raw)
To: Pengzhen Liu; +Cc: dev, Yuanhan Liu, stable
01/11/2017 16:33, Yuanhan Liu:
> On Fri, Oct 27, 2017 at 11:54:09AM +0800, Pengzhen Liu wrote:
> > In function eth_virtio_dev_init(), dynamic memory stored
> > in "eth_dev->data->mac_addrs" variable and it is not freed
> > when function return,
> > this is a possible memory leak.
> >
> > Fixes: 8ced1542f7a3 ("net/virtio: eth_dev->data->mac_addrs is not freed")
> > Cc: stable@dpdk.org
> > Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
>
> Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
Applied, thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH] net/virtio: fix memory leak
@ 2017-10-26 14:42 Pengzhen Liu
0 siblings, 0 replies; 8+ messages in thread
From: Pengzhen Liu @ 2017-10-26 14:42 UTC (permalink / raw)
To: thomas; +Cc: dev, liupengzhen3, stable
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed
when function return,
this is a possible memory leak.
Fixes: 289ba0c0f52a ("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
---
drivers/net/virtio/virtio_ethdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ff2d9d6..4c7c3c4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1587,13 +1587,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
if (!hw->virtio_user_dev) {
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
- return ret;
+ goto out;
}
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
- return ret;
+ goto out;
/* Setup interrupt callback */
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
@@ -1601,6 +1601,10 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
virtio_interrupt_handler, eth_dev);
return 0;
+
+out:
+ rte_free(eth_dev->data->mac_addrs);
+ return ret;
}
static int
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH] net/virtio: fix memory leak
@ 2017-10-26 9:04 Pengzhen Liu
0 siblings, 0 replies; 8+ messages in thread
From: Pengzhen Liu @ 2017-10-26 9:04 UTC (permalink / raw)
To: thomas; +Cc: dev, liupengzhen3, stable
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed
when function return,
this is a possible memory leak.
Fixes: 6b9ed026a870 ("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
---
drivers/net/virtio/virtio_ethdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c85c14d..c450f25 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1587,13 +1587,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
if (!hw->virtio_user_dev) {
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
- goto out;
+ goto out;
}
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
- goto out;
+ goto out;
/* Setup interrupt callback */
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
@@ -1603,8 +1603,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
return 0;
out:
- rte_free(eth_dev->data->mac_addrs);
- return ret;
+ rte_free(eth_dev->data->mac_addrs);
+ return ret;
}
static int
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH] net/virtio: fix memory leak
@ 2017-10-26 8:52 Pengzhen Liu
0 siblings, 0 replies; 8+ messages in thread
From: Pengzhen Liu @ 2017-10-26 8:52 UTC (permalink / raw)
To: thomas
Cc: dev, liupengzhen3, zhangsha.zhang, huangjian.huangjian,
zangchuanqiang, stable
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed when function return,
this is a possible memory leak.
Fixes: 6b9ed026a870 ("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
---
drivers/net/virtio/virtio_ethdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c85c14d..c450f25 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1587,13 +1587,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
if (!hw->virtio_user_dev) {
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
- goto out;
+ goto out;
}
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
- goto out;
+ goto out;
/* Setup interrupt callback */
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
@@ -1603,8 +1603,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
return 0;
out:
- rte_free(eth_dev->data->mac_addrs);
- return ret;
+ rte_free(eth_dev->data->mac_addrs);
+ return ret;
}
static int
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH] net/virtio: fix memory leak
@ 2017-10-26 7:32 Pengzhen Liu
0 siblings, 0 replies; 8+ messages in thread
From: Pengzhen Liu @ 2017-10-26 7:32 UTC (permalink / raw)
To: thomas
Cc: dev, liupengzhen3, zhangsha.zhang, huangjian.huangjian,
zangchuanqiang, stable
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed whe function return,
this is a possible memory leak.
Fixes: 6b9ed026a870 ("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
---
drivers/net/virtio/virtio_ethdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 0ec54a9..d9f186f 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1586,13 +1586,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
if (!hw->virtio_user_dev) {
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
- return ret;
+ goto out;
}
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
- return ret;
+ goto out;
/* Setup interrupt callback */
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
@@ -1600,6 +1600,10 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
virtio_interrupt_handler, eth_dev);
return 0;
+
+out:
+ rte_free(eth_dev->data->mac_addrs);
+ return ret;
}
static int
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-11-12 18:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 3:54 [dpdk-stable] [PATCH] net/virtio: fix memory leak Pengzhen Liu
2017-11-01 15:33 ` Yuanhan Liu
2017-11-01 15:49 ` Yuanhan Liu
2017-11-12 18:53 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
-- strict thread matches above, loose matches on Subject: below --
2017-10-26 14:42 [dpdk-stable] " Pengzhen Liu
2017-10-26 9:04 Pengzhen Liu
2017-10-26 8:52 Pengzhen Liu
2017-10-26 7:32 Pengzhen Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).