[dpdk-dev] net/pcap: fix use-after-free

Message ID 20170313092125.22517-1-johan.xb.samuelsson@ericsson.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Johan Samuelsson March 13, 2017, 9:21 a.m. UTC
  Signed-off-by: Johan Samuelsson <johan.xb.samuelsson@ericsson.com>
---
 drivers/net/pcap/rte_eth_pcap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit March 14, 2017, 5:47 p.m. UTC | #1
On 3/13/2017 9:21 AM, Johan Samuelsson wrote:
> Signed-off-by: Johan Samuelsson <johan.xb.samuelsson@ericsson.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit March 14, 2017, 6:08 p.m. UTC | #2
On 3/14/2017 5:47 PM, Ferruh Yigit wrote:
> On 3/13/2017 9:21 AM, Johan Samuelsson wrote:
>> Signed-off-by: Johan Samuelsson <johan.xb.samuelsson@ericsson.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

    Fixes: 2269e7e815a2 ("pcap: add Rx and Tx byte counters")
    Cc: stable@dpdk.org

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7f0b650..075e3be 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -293,9 +293,9 @@  eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			}
 		}
 
-		rte_pktmbuf_free(mbuf);
 		num_tx++;
 		tx_bytes += mbuf->pkt_len;
+		rte_pktmbuf_free(mbuf);
 	}
 
 	/*