Skip to content

Commit

Permalink
netdev-dpdk: fix mbuf leaks
Browse files Browse the repository at this point in the history
mbufs could be chained (by the "next" field of rte_mbuf struct), when
an mbuf is not big enough to hold a big packet, say when TSO is enabled.

rte_pktmbuf_free_seg() frees the head mbuf only, leading mbuf leaks.
This patch fix it by invoking the right API rte_pktmbuf_free(), to
free all mbufs in the chain.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
  • Loading branch information
Yuanhan Liu authored and ddiproietto committed Mar 10, 2016
1 parent f76def2 commit b00b4a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -226,6 +226,7 @@ YAMAMOTO Takashi yamamoto@midokura.com
Yasuhito Takamiya yasuhito@gmail.com
Yin Lin linyi@vmware.com
Yu Zhiguo yuzg@cn.fujitsu.com
Yuanhan Liu yuanhan.liu@linux.intel.com
ZhengLingyun konghuarukhr@163.com
Zoltán Balogh zoltan.balogh@ericsson.com
Zoltan Kiss zoltan.kiss@citrix.com
Expand Down
4 changes: 2 additions & 2 deletions lib/netdev-dpdk.c
Expand Up @@ -396,7 +396,7 @@ free_dpdk_buf(struct dp_packet *p)
{
struct rte_mbuf *pkt = (struct rte_mbuf *) p;

rte_pktmbuf_free_seg(pkt);
rte_pktmbuf_free(pkt);
}

static void
Expand Down Expand Up @@ -1089,7 +1089,7 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int qid)
int i;

for (i = nb_tx; i < txq->count; i++) {
rte_pktmbuf_free_seg(txq->burst_pkts[i]);
rte_pktmbuf_free(txq->burst_pkts[i]);
}
rte_spinlock_lock(&dev->stats_lock);
dev->stats.tx_dropped += txq->count-nb_tx;
Expand Down

0 comments on commit b00b4a8

Please sign in to comment.