diff mbox

[dpdk-dev] examples/vhost: fix segfault when link_vmdq fails

Message ID 1422602016-12662-1-git-send-email-huawei.xie@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Huawei Xie Jan. 30, 2015, 7:13 a.m. UTC
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
 examples/vhost/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ouyang Changchun Jan. 30, 2015, 7:57 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Huawei Xie
> Sent: Friday, January 30, 2015 3:14 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] examples/vhost: fix segfault when link_vmdq
> fails
> 
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>

Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>

> ---
>  examples/vhost/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> 04f0118..3a35359 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -1308,8 +1308,8 @@ switch_worker(__attribute__((unused)) void *arg)
>  				/* If this is the first received packet we need
> to learn the MAC and setup VMDQ */
>  				if (unlikely(vdev->ready ==
> DEVICE_MAC_LEARNING) && tx_count) {
>  					if (vdev->remove ||
> (link_vmdq(vdev, pkts_burst[0]) == -1)) {
> -						while (tx_count--)
> -
> 	rte_pktmbuf_free(pkts_burst[tx_count]);
> +						while (tx_count)
> +
> 	rte_pktmbuf_free(pkts_burst[--tx_count]);
>  					}
>  				}
>  				while (tx_count)
> --
> 1.8.1.4
Thomas Monjalon Jan. 30, 2015, 9:43 a.m. UTC | #2
> > Signed-off-by: Huawei Xie <huawei.xie@intel.com>
> 
> Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>

Applied

Thanks
diff mbox

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 04f0118..3a35359 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1308,8 +1308,8 @@  switch_worker(__attribute__((unused)) void *arg)
 				/* If this is the first received packet we need to learn the MAC and setup VMDQ */
 				if (unlikely(vdev->ready == DEVICE_MAC_LEARNING) && tx_count) {
 					if (vdev->remove || (link_vmdq(vdev, pkts_burst[0]) == -1)) {
-						while (tx_count--)
-							rte_pktmbuf_free(pkts_burst[tx_count]);
+						while (tx_count)
+							rte_pktmbuf_free(pkts_burst[--tx_count]);
 					}
 				}
 				while (tx_count)