[PATCH 30/31] net/cnxk: add flag check for extension header when used

Nithin Dabilpuram ndabilpuram at marvell.com
Fri Aug 11 10:58:04 CEST 2023


From: Akhil Goyal <gakhil at marvell.com>

send_hdr_ext is being used, but it may be null when
the flag check for NIX_TX_NEED_EXT_HDR is not done.
Hence added a check here to avoid null pointer dereference.

Signed-off-by: Akhil Goyal <gakhil at marvell.com>
---
 drivers/net/cnxk/cn10k_tx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h
index 464cd9b401..fff7ae7fc9 100644
--- a/drivers/net/cnxk/cn10k_tx.h
+++ b/drivers/net/cnxk/cn10k_tx.h
@@ -1011,7 +1011,8 @@ cn10k_nix_xmit_prepare(struct cn10k_eth_txq *txq,
 		send_hdr_ext->w0.markptr = markptr;
 	}
 
-	if (flags & NIX_TX_OFFLOAD_TSO_F && (ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+	if (flags & NIX_TX_NEED_EXT_HDR && flags & NIX_TX_OFFLOAD_TSO_F &&
+	    (ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
 		uint16_t lso_sb;
 		uint64_t mask;
 
-- 
2.25.1



More information about the dev mailing list