Skip to contentSkip to conversation

examples/vhost: fix segfault when link_vmdq fails

PATCH Applied Huawei Xie 3 participants 3 messages Jan 30, 2015 2 messages not in the archive

lore
Share & tools
lore

Huawei Xie

author
#0 lore raw

PATCH 1/1 examples/vhost: fix segfault when link_vmdq fails

---
 examples/vhost/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost/main.c +2 -2
index 04f0118..3a35359 100644
@@ -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)
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1422602016-12662-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Huawei Xie
Sent: Friday, January 30, 2015 3:14 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] examples/vhost: fix segfault when link_vmdq fails

Quoted 26 lines
---
 examples/vhost/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

04f0118..3a35359 100644

examples/vhost/main.c +0 -0
@@ -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)) {

examples/vhost/main.c +0 -2
-						while (tx_count--)
-
	rte_pktmbuf_free(pkts_burst[tx_count]);
examples/vhost/main.c +2 -0
+						while (tx_count)
+
	rte_pktmbuf_free(pkts_burst[--tx_count]);
examples/vhost/main.c +0 -1
 					}
 				}
 				while (tx_count)
--

1.8.1.4

A message that is not in the archive (sent off-list or not yet received): F52918179C57134FAEC9EA62FA2F9625119B7892-E2R4CRU6q/[email protected]