* Re: [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets.
2021-08-17 17:13 [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets Wenwu Ma
@ 2021-08-17 5:26 ` Jiang, Cheng1
2021-08-17 7:12 ` Hu, Jiayu
2021-08-26 11:47 ` Xia, Chenbo
2021-08-27 14:00 ` [dpdk-dev] [PATCH v2] " Wenwu Ma
2 siblings, 1 reply; 7+ messages in thread
From: Jiang, Cheng1 @ 2021-08-17 5:26 UTC (permalink / raw)
To: Ma, WenwuX, dev; +Cc: maxime.coquelin, Xia, Chenbo, Hu, Jiayu, stable
Acked-by: Cheng Jiang <cheng1.jiang@intel.com>
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma@intel.com>
> Sent: Wednesday, August 18, 2021 1:13 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> Jiang, Cheng1 <cheng1.jiang@intel.com>; Hu, Jiayu <jiayu.hu@intel.com>;
> Ma, WenwuX <wenwux.ma@intel.com>; stable@dpdk.org
> Subject: [PATCH] examples/vhost: fix memory leak on forwarding packets.
>
> In function virtio_tx_local(), when the device receiving the packet is the
> same as the device to which the packet is forwarded, or the device is
> removed, we return but not free the packet, it will cause a memory leak.
>
> Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---
> examples/vhost/main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> bc3d71c898..07fd90ec64 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> rte_mbuf *m)
> return -1;
>
> if (vdev->vid == dst_vdev->vid) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) TX: src and dst MAC is same. Dropping
> packet.\n",
> vdev->vid);
> @@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> rte_mbuf *m)
> "(%d) TX: MAC address is local\n", dst_vdev->vid);
>
> if (unlikely(dst_vdev->remove)) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) device is marked for removal\n", dst_vdev-
> >vid);
> return 0;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets.
2021-08-17 5:26 ` Jiang, Cheng1
@ 2021-08-17 7:12 ` Hu, Jiayu
0 siblings, 0 replies; 7+ messages in thread
From: Hu, Jiayu @ 2021-08-17 7:12 UTC (permalink / raw)
To: Jiang, Cheng1, Ma, WenwuX, dev; +Cc: maxime.coquelin, Xia, Chenbo, stable
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
> -----Original Message-----
> From: Jiang, Cheng1 <cheng1.jiang@intel.com>
> Sent: Tuesday, August 17, 2021 1:26 PM
> To: Ma, WenwuX <wenwux.ma@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>; Hu,
> Jiayu <jiayu.hu@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] examples/vhost: fix memory leak on forwarding packets.
>
> Acked-by: Cheng Jiang <cheng1.jiang@intel.com>
>
>
>
>
> > -----Original Message-----
> > From: Ma, WenwuX <wenwux.ma@intel.com>
> > Sent: Wednesday, August 18, 2021 1:13 AM
> > To: dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> > Jiang, Cheng1 <cheng1.jiang@intel.com>; Hu, Jiayu
> > <jiayu.hu@intel.com>; Ma, WenwuX <wenwux.ma@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] examples/vhost: fix memory leak on forwarding packets.
> >
> > In function virtio_tx_local(), when the device receiving the packet is
> > the same as the device to which the packet is forwarded, or the device
> > is removed, we return but not free the packet, it will cause a memory leak.
> >
> > Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost
> > application")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> > ---
> > examples/vhost/main.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> > bc3d71c898..07fd90ec64 100644
> > --- a/examples/vhost/main.c
> > +++ b/examples/vhost/main.c
> > @@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> > rte_mbuf *m)
> > return -1;
> >
> > if (vdev->vid == dst_vdev->vid) {
> > + rte_pktmbuf_free(m);
> > RTE_LOG_DP(DEBUG, VHOST_DATA,
> > "(%d) TX: src and dst MAC is same. Dropping
> packet.\n",
> > vdev->vid);
> > @@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> > rte_mbuf *m)
> > "(%d) TX: MAC address is local\n", dst_vdev->vid);
> >
> > if (unlikely(dst_vdev->remove)) {
> > + rte_pktmbuf_free(m);
> > RTE_LOG_DP(DEBUG, VHOST_DATA,
> > "(%d) device is marked for removal\n", dst_vdev-
> > >vid);
> > return 0;
> > --
> > 2.25.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets.
2021-08-17 17:13 [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets Wenwu Ma
2021-08-17 5:26 ` Jiang, Cheng1
@ 2021-08-26 11:47 ` Xia, Chenbo
2021-08-27 14:00 ` [dpdk-dev] [PATCH v2] " Wenwu Ma
2 siblings, 0 replies; 7+ messages in thread
From: Xia, Chenbo @ 2021-08-26 11:47 UTC (permalink / raw)
To: Ma, WenwuX, dev; +Cc: maxime.coquelin, Jiang, Cheng1, Hu, Jiayu, stable
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma@intel.com>
> Sent: Wednesday, August 18, 2021 1:13 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>; Jiang,
> Cheng1 <cheng1.jiang@intel.com>; Hu, Jiayu <jiayu.hu@intel.com>; Ma, WenwuX
> <wenwux.ma@intel.com>; stable@dpdk.org
> Subject: [PATCH] examples/vhost: fix memory leak on forwarding packets.
Should delete '.' in the title when applying.
With this fixed:
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
>
> In function virtio_tx_local(), when the device receiving the packet
> is the same as the device to which the packet is forwarded,
> or the device is removed, we return but not free the packet,
> it will cause a memory leak.
>
> Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---
> examples/vhost/main.c | 2 ++
> 1 file changed, 2 insertions(+)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on forwarding packets
2021-08-17 17:13 [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets Wenwu Ma
2021-08-17 5:26 ` Jiang, Cheng1
2021-08-26 11:47 ` Xia, Chenbo
@ 2021-08-27 14:00 ` Wenwu Ma
2021-08-31 5:50 ` Xia, Chenbo
2021-09-02 6:50 ` Yang, YvonneX
2 siblings, 2 replies; 7+ messages in thread
From: Wenwu Ma @ 2021-08-27 14:00 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, chenbo.xia, cheng1.jiang, jiayu.hu, Wenwu Ma, stable
In function virtio_tx_local(), when the device receiving the packet
is the same as the device to which the packet is forwarded,
or the device is removed, we return but not free the packet,
it will cause a memory leak.
Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
Cc: stable@dpdk.org
v2:
- Delete '.' in the title.
Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
examples/vhost/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index bc3d71c898..07fd90ec64 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m)
return -1;
if (vdev->vid == dst_vdev->vid) {
+ rte_pktmbuf_free(m);
RTE_LOG_DP(DEBUG, VHOST_DATA,
"(%d) TX: src and dst MAC is same. Dropping packet.\n",
vdev->vid);
@@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m)
"(%d) TX: MAC address is local\n", dst_vdev->vid);
if (unlikely(dst_vdev->remove)) {
+ rte_pktmbuf_free(m);
RTE_LOG_DP(DEBUG, VHOST_DATA,
"(%d) device is marked for removal\n", dst_vdev->vid);
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on forwarding packets
2021-08-27 14:00 ` [dpdk-dev] [PATCH v2] " Wenwu Ma
@ 2021-08-31 5:50 ` Xia, Chenbo
2021-09-02 6:50 ` Yang, YvonneX
1 sibling, 0 replies; 7+ messages in thread
From: Xia, Chenbo @ 2021-08-31 5:50 UTC (permalink / raw)
To: Ma, WenwuX, dev; +Cc: maxime.coquelin, Jiang, Cheng1, Hu, Jiayu, stable
Hi Wenwu,
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma@intel.com>
> Sent: Friday, August 27, 2021 10:01 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>; Jiang,
> Cheng1 <cheng1.jiang@intel.com>; Hu, Jiayu <jiayu.hu@intel.com>; Ma, WenwuX
> <wenwux.ma@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] examples/vhost: fix memory leak on forwarding packets
>
> In function virtio_tx_local(), when the device receiving the packet
> is the same as the device to which the packet is forwarded,
> or the device is removed, we return but not free the packet,
> it will cause a memory leak.
>
> Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
> Cc: stable@dpdk.org
>
> v2:
> - Delete '.' in the title.
>
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
The version description should be after signed-off-by tag like:
Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
v2:XXX
---
examples/vhost/main.c | 2 ++
Please fix this to save Maxime's effort when applying.
And you missed the Acked-by/Reviewed-by tag of Jiayu/Cheng/Mine.
Thanks,
Chenbo
> ---
> examples/vhost/main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index bc3d71c898..07fd90ec64 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m)
> return -1;
>
> if (vdev->vid == dst_vdev->vid) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) TX: src and dst MAC is same. Dropping packet.\n",
> vdev->vid);
> @@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m)
> "(%d) TX: MAC address is local\n", dst_vdev->vid);
>
> if (unlikely(dst_vdev->remove)) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) device is marked for removal\n", dst_vdev->vid);
> return 0;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on forwarding packets
2021-08-27 14:00 ` [dpdk-dev] [PATCH v2] " Wenwu Ma
2021-08-31 5:50 ` Xia, Chenbo
@ 2021-09-02 6:50 ` Yang, YvonneX
1 sibling, 0 replies; 7+ messages in thread
From: Yang, YvonneX @ 2021-09-02 6:50 UTC (permalink / raw)
To: Ma, WenwuX, dev
Cc: maxime.coquelin, Xia, Chenbo, Jiang, Cheng1, Hu, Jiayu, Ma,
WenwuX, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wenwu Ma
> Sent: Friday, August 27, 2021 10:01 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> Jiang, Cheng1 <cheng1.jiang@intel.com>; Hu, Jiayu <jiayu.hu@intel.com>;
> Ma, WenwuX <wenwux.ma@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on
> forwarding packets
>
> In function virtio_tx_local(), when the device receiving the packet is the
> same as the device to which the packet is forwarded, or the device is
> removed, we return but not free the packet, it will cause a memory leak.
>
> Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
> Cc: stable@dpdk.org
>
> v2:
> - Delete '.' in the title.
>
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---
> examples/vhost/main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> bc3d71c898..07fd90ec64 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> rte_mbuf *m)
> return -1;
>
> if (vdev->vid == dst_vdev->vid) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) TX: src and dst MAC is same. Dropping
> packet.\n",
> vdev->vid);
> @@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct
> rte_mbuf *m)
> "(%d) TX: MAC address is local\n", dst_vdev->vid);
>
> if (unlikely(dst_vdev->remove)) {
> + rte_pktmbuf_free(m);
> RTE_LOG_DP(DEBUG, VHOST_DATA,
> "(%d) device is marked for removal\n", dst_vdev-
> >vid);
> return 0;
> --
> 2.25.1
Tested-by: Yvonne Yang <yvonnex.yang@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread