* [PATCH] pcap: Fixed bug in eth_pcap_rx function
@ 2014-08-05 10:18 Pablo de Lara
[not found] ` <1407233900-9734-1-git-send-email-pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Pablo de Lara @ 2014-08-05 10:18 UTC (permalink / raw)
To: dev-VfR2kkLFssw
Normally, bufs[i] stores the mbuf pointer, the index of buf[i]
is the loop count i, but if header.len > buf_size, DPDK will
free the mbuf, but the loop count i still increases, so some
of the items in bufs[] might be NULL ponter, causing a potential
DPDK core. Using num_rx as the index for bufs[] solves the problem.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
lib/librte_pmd_pcap/rte_eth_pcap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index c77ee25..eebe768 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -154,7 +154,7 @@ eth_pcap_rx(void *queue,
rte_memcpy(mbuf->pkt.data, packet, header.len);
mbuf->pkt.data_len = (uint16_t)header.len;
mbuf->pkt.pkt_len = mbuf->pkt.data_len;
- bufs[i] = mbuf;
+ bufs[num_rx] = mbuf;
num_rx++;
} else {
/* pcap packet will not fit in the mbuf, so drop packet */
--
1.7.0.7
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1407233900-9734-1-git-send-email-pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] pcap: Fixed bug in eth_pcap_rx function [not found] ` <1407233900-9734-1-git-send-email-pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2014-08-12 2:29 ` Jiajia, SunX [not found] ` <F21F274FCF2C0948830A3ED003452977180210-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Jiajia, SunX @ 2014-08-12 2:29 UTC (permalink / raw) To: De Lara Guarch, Pablo, dev-VfR2kkLFssw@public.gmane.org Tested-by: Jiajia SunX <sunx.jiajia-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> This patch fixed a bug by changing eth_pcap_rx function, and is ready to integrate into DPDK.org. > -----Original Message----- > From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Pablo de Lara > Sent: Tuesday, August 05, 2014 6:18 PM > To: dev-VfR2kkLFssw@public.gmane.org > Subject: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function > > Normally, bufs[i] stores the mbuf pointer, the index of buf[i] > is the loop count i, but if header.len > buf_size, DPDK will > free the mbuf, but the loop count i still increases, so some > of the items in bufs[] might be NULL ponter, causing a potential > DPDK core. Using num_rx as the index for bufs[] solves the problem. > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > lib/librte_pmd_pcap/rte_eth_pcap.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c > b/lib/librte_pmd_pcap/rte_eth_pcap.c > index c77ee25..eebe768 100644 > --- a/lib/librte_pmd_pcap/rte_eth_pcap.c > +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c > @@ -154,7 +154,7 @@ eth_pcap_rx(void *queue, > rte_memcpy(mbuf->pkt.data, packet, header.len); > mbuf->pkt.data_len = (uint16_t)header.len; > mbuf->pkt.pkt_len = mbuf->pkt.data_len; > - bufs[i] = mbuf; > + bufs[num_rx] = mbuf; > num_rx++; > } else { > /* pcap packet will not fit in the mbuf, so drop > packet */ > -- > 1.7.0.7 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <F21F274FCF2C0948830A3ED003452977180210-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: [PATCH] pcap: Fixed bug in eth_pcap_rx function [not found] ` <F21F274FCF2C0948830A3ED003452977180210-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2014-08-12 23:29 ` Thomas Monjalon 0 siblings, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2014-08-12 23:29 UTC (permalink / raw) To: De Lara Guarch, Pablo; +Cc: dev-VfR2kkLFssw > > Normally, bufs[i] stores the mbuf pointer, the index of buf[i] > > is the loop count i, but if header.len > buf_size, DPDK will > > free the mbuf, but the loop count i still increases, so some > > of the items in bufs[] might be NULL ponter, causing a potential > > DPDK core. Using num_rx as the index for bufs[] solves the problem. > > > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Tested-by: Jiajia SunX <sunx.jiajia-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Acked-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> Applied for version 1.7.1 Thanks -- Thomas ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-12 23:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05 10:18 [PATCH] pcap: Fixed bug in eth_pcap_rx function Pablo de Lara
[not found] ` <1407233900-9734-1-git-send-email-pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12 2:29 ` Jiajia, SunX
[not found] ` <F21F274FCF2C0948830A3ED003452977180210-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-08-12 23:29 ` Thomas Monjalon
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.