pdump: fix pcap_dump coredump caused by incorrect pkt_len

This commit is contained in:
jiangheng12 2023-06-17 20:35:59 +08:00
parent 1b7ecad484
commit 9f12e21bcb
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 28be6f7f94f85dd15e1807abb6d14a1164b4396d Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Sat, 17 Jun 2023 20:29:39 +0800
Subject: [PATCH] pdump: fix pcap_dump coredump caused by incorrect pkt_len
---
drivers/net/pcap/rte_eth_pcap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index aa7ef6f..18b2f30 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -342,8 +342,13 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
* in the mbuf (when the mbuf is contiguous) or, otherwise,
* a pointer to temp_data after copying into it.
*/
- pcap_dump((u_char *)dumper, &header,
- rte_pktmbuf_read(mbuf, 0, len, temp_data));
+ const void *sp = rte_pktmbuf_read(mbuf, 0, len, temp_data);
+ if (sp == NULL) {
+ rte_pktmbuf_free(mbuf);
+ continue;
+ } else {
+ pcap_dump((u_char *)dumper, &header, sp);
+ }
num_tx++;
tx_bytes += len;
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 19.11
Release: 28
Release: 29
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 19.11
@ -64,6 +64,8 @@ Patch9000: hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch
Patch6014: backport-fix-dedicated-queue-mode-in-vector-burst.patch
Patch9001: 0001-pdump-fix-pcap_dump-coredump-caused-by-incorrect-pkt_len.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
License: BSD and LGPLv2 and GPLv2
@ -232,6 +234,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
/usr/sbin/depmod
%changelog
* Sat Jun 17 2023 jiangheng <jiangheng14@huawei.com> - 19.11-29
- pdump: fix pcap_dump coredump caused by incorrect pkt_len
* Tue May 16 2023 zhujunhao <zhujunhao11@huawei.com> - 19.11-28
- fix bond connect failed