linux-dpdk: packet: initialize dummy packet in _odp_pktio_send_completion

Message ID 1509110334-1265-1-git-send-email-matias.elo@nokia.com
State New
Headers show
Series
  • linux-dpdk: packet: initialize dummy packet in _odp_pktio_send_completion
Related show

Commit Message

Matias Elo Oct. 27, 2017, 1:18 p.m.
Passing an uninitialized dummy packet handle to send_pkt_dpdk() causes a
segfault. Map the dummy handle to a dummy mbuf struct with zero length.

Fixes bug https://bugs.linaro.org/show_bug.cgi?id=3380

Signed-off-by: Matias Elo <matias.elo@nokia.com>
---
 platform/linux-dpdk/odp_packet_dpdk.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c
index d056a82..1294fd9 100644
--- a/platform/linux-dpdk/odp_packet_dpdk.c
+++ b/platform/linux-dpdk/odp_packet_dpdk.c
@@ -312,11 +312,15 @@  static void _odp_pktio_send_completion(pktio_entry_t *pktio_entry)
 {
 	int i;
 	unsigned j;
+	struct rte_mbuf mbuf;
 	odp_packet_t dummy;
 	pool_entry_t *pool_entry =
 		get_pool_entry(_odp_typeval(pktio_entry->s.pool));
 	struct rte_mempool *rte_mempool = pool_entry->s.rte_mempool;
 
+	mbuf.pkt_len = 0;
+	dummy = (odp_packet_t)&mbuf;
+
 	for (j = 0; j < pktio_entry->s.num_out_queue; j++)
 		send_pkt_dpdk(pktio_entry, j, &dummy, 0);