DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] examples/l3fwd: fix core dump after packet match
@ 2022-09-07 11:33 Sean Morrissey
  2022-09-21 18:14 ` Medvedkin, Vladimir
  2022-10-08  3:11 ` Chen, LingliX
  0 siblings, 2 replies; 4+ messages in thread
From: Sean Morrissey @ 2022-09-07 11:33 UTC (permalink / raw)
  To: Konstantin Ananyev, Sean Morrissey; +Cc: dev, stable

This patch fixes a core dump which occurs on 32-bit-builds
after sending a matched packet due to overrunning an array.

Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
Cc: sean.morrissey@intel.com
Cc: stable@dpdk.org

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
---
 examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd/l3fwd_acl_scalar.h b/examples/l3fwd/l3fwd_acl_scalar.h
index cd99f8594a..542c303d3b 100644
--- a/examples/l3fwd/l3fwd_acl_scalar.h
+++ b/examples/l3fwd/l3fwd_acl_scalar.h
@@ -70,15 +70,12 @@ send_packets_single(struct lcore_conf *qconf, struct rte_mbuf *pkts[], uint16_t
 
 		/* Set MAC addresses. */
 		eth_hdr = rte_pktmbuf_mtod(pkts[j], struct rte_ether_hdr *);
-		*(uint64_t *)&eth_hdr->dst_addr = dest_eth_addr[hops[j]];
-		rte_ether_addr_copy(&ports_eth_addr[hops[j]],
-						&eth_hdr->src_addr);
-	}
-
-	for (j  = 0; j != nb_tx; j++) {
-		if (hops[j] != BAD_PORT)
+		if (hops[j] != BAD_PORT) {
+			*(uint64_t *)&eth_hdr->dst_addr = dest_eth_addr[hops[j]];
+			rte_ether_addr_copy(&ports_eth_addr[hops[j]],
+							&eth_hdr->src_addr);
 			send_single_packet(qconf, pkts[j], hops[j]);
-		else
+		} else
 			rte_pktmbuf_free(pkts[j]);
 	}
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] examples/l3fwd: fix core dump after packet match
  2022-09-07 11:33 [PATCH v1] examples/l3fwd: fix core dump after packet match Sean Morrissey
@ 2022-09-21 18:14 ` Medvedkin, Vladimir
  2022-10-08  3:11 ` Chen, LingliX
  1 sibling, 0 replies; 4+ messages in thread
From: Medvedkin, Vladimir @ 2022-09-21 18:14 UTC (permalink / raw)
  To: Sean Morrissey, Konstantin Ananyev; +Cc: dev, stable

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 07/09/2022 12:33, Sean Morrissey wrote:
> This patch fixes a core dump which occurs on 32-bit-builds
> after sending a matched packet due to overrunning an array.
>
> Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
> Cc: sean.morrissey@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> ---
>   examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/examples/l3fwd/l3fwd_acl_scalar.h b/examples/l3fwd/l3fwd_acl_scalar.h
> index cd99f8594a..542c303d3b 100644
> --- a/examples/l3fwd/l3fwd_acl_scalar.h
> +++ b/examples/l3fwd/l3fwd_acl_scalar.h
> @@ -70,15 +70,12 @@ send_packets_single(struct lcore_conf *qconf, struct rte_mbuf *pkts[], uint16_t
>   
>   		/* Set MAC addresses. */
>   		eth_hdr = rte_pktmbuf_mtod(pkts[j], struct rte_ether_hdr *);
> -		*(uint64_t *)&eth_hdr->dst_addr = dest_eth_addr[hops[j]];
> -		rte_ether_addr_copy(&ports_eth_addr[hops[j]],
> -						&eth_hdr->src_addr);
> -	}
> -
> -	for (j  = 0; j != nb_tx; j++) {
> -		if (hops[j] != BAD_PORT)
> +		if (hops[j] != BAD_PORT) {
> +			*(uint64_t *)&eth_hdr->dst_addr = dest_eth_addr[hops[j]];
> +			rte_ether_addr_copy(&ports_eth_addr[hops[j]],
> +							&eth_hdr->src_addr);
>   			send_single_packet(qconf, pkts[j], hops[j]);
> -		else
> +		} else
>   			rte_pktmbuf_free(pkts[j]);
>   	}
>   }

-- 
Regards,
Vladimir


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v1] examples/l3fwd: fix core dump after packet match
  2022-09-07 11:33 [PATCH v1] examples/l3fwd: fix core dump after packet match Sean Morrissey
  2022-09-21 18:14 ` Medvedkin, Vladimir
@ 2022-10-08  3:11 ` Chen, LingliX
  2022-10-10 21:51   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Chen, LingliX @ 2022-10-08  3:11 UTC (permalink / raw)
  To: Konstantin Ananyev, Morrissey, Sean; +Cc: dev, stable


> -----Original Message-----
> From: Sean Morrissey <sean.morrissey@intel.com>
> Sent: Wednesday, September 7, 2022 7:34 PM
> To: Konstantin Ananyev <konstantin.ananyev@intel.com>; Morrissey, Sean
> <sean.morrissey@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH v1] examples/l3fwd: fix core dump after packet match
> 
> This patch fixes a core dump which occurs on 32-bit-builds after sending a
> matched packet due to overrunning an array.
> 
> Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
> Cc: sean.morrissey@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> ---

Tested-by: Lingli Chen <linglix.chen@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] examples/l3fwd: fix core dump after packet match
  2022-10-08  3:11 ` Chen, LingliX
@ 2022-10-10 21:51   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-10-10 21:51 UTC (permalink / raw)
  To: Morrissey, Sean; +Cc: Konstantin Ananyev, dev, stable, Chen, LingliX

> > This patch fixes a core dump which occurs on 32-bit-builds after sending a
> > matched packet due to overrunning an array.
> > 
> > Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
> > Cc: sean.morrissey@intel.com
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> Tested-by: Lingli Chen <linglix.chen@intel.com>

Applied, thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-10 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 11:33 [PATCH v1] examples/l3fwd: fix core dump after packet match Sean Morrissey
2022-09-21 18:14 ` Medvedkin, Vladimir
2022-10-08  3:11 ` Chen, LingliX
2022-10-10 21:51   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).