patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Xiao Zhang <xiao.zhang@intel.com>
To: dev@dpdk.org
Cc: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com,
	Xiao Zhang <xiao.zhang@intel.com>,
	stable@dpdk.org
Subject: [dpdk-stable] net/ixgbe: check illegal packets
Date: Fri, 14 Feb 2020 15:19:45 +0800	[thread overview]
Message-ID: <1581664785-67507-1-git-send-email-xiao.zhang@intel.com> (raw)

Some illegal packets will lead to TX hang. This patch checks those illegal
packets and protects TX from hanging.

Fixes: 7829b8d52be0 ("net/ixgbe: add Tx preparation")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++
 drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 7b398f1..f839bca 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -986,6 +986,12 @@ ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			return i;
 		}
 
+		/* check the size of packet */
+		if (m->pkt_len < IXGBE_TX_MIN_PKT_LEN) {
+			rte_errno = EINVAL;
+			return i;
+		}
+
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
 		ret = rte_validate_tx_offload(m);
 		if (ret != 0) {
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 000c5b1..31dbdfc 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -53,6 +53,8 @@
 
 #define IXGBE_TX_MAX_SEG                    40
 
+#define IXGBE_TX_MIN_PKT_LEN		     17
+
 #define IXGBE_PACKET_TYPE_MASK_82599        0X7F
 #define IXGBE_PACKET_TYPE_MASK_X550         0X10FF
 #define IXGBE_PACKET_TYPE_MASK_TUNNEL       0XFF
-- 
2.7.4


             reply	other threads:[~2020-02-14  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  7:19 Xiao Zhang [this message]
2020-02-17 14:51 ` [dpdk-stable] [v2] " Xiao Zhang
2020-02-17 15:09   ` Ananyev, Konstantin
2020-02-17 16:00   ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1581664785-67507-1-git-send-email-xiao.zhang@intel.com \
    --to=xiao.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).