All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Joe Stringer <joestringer@nicira.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 11/15] fm10k: Check tunnel header length in encap offload
Date: Thu, 22 Jan 2015 18:37:07 -0800	[thread overview]
Message-ID: <1421980631-1955-12-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1421980631-1955-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Joe Stringer <joestringer@nicira.com>

fm10k supports up to 184 bytes of inner+outer headers. Add an initial
check to fail encap offload if these are too large.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index c7a19a5..84ab9ee 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -727,6 +727,12 @@ static __be16 fm10k_tx_encap_offload(struct sk_buff *skb)
 	struct ethhdr *eth_hdr;
 	u8 l4_hdr = 0;
 
+/* fm10k supports 184 octets of outer+inner headers. Minus 20 for inner L4. */
+#define FM10K_MAX_ENCAP_TRANSPORT_OFFSET	164
+	if (skb_inner_transport_header(skb) - skb_mac_header(skb) >
+	    FM10K_MAX_ENCAP_TRANSPORT_OFFSET)
+		return 0;
+
 	switch (vlan_get_protocol(skb)) {
 	case htons(ETH_P_IP):
 		l4_hdr = ip_hdr(skb)->protocol;
-- 
1.9.3

  parent reply	other threads:[~2015-01-23  2:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  2:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-01-22 Jeff Kirsher
2015-01-23  2:36 ` [net-next 01/15] e1000: fix time comparison Jeff Kirsher
2015-01-23  2:36 ` [net-next 02/15] e1000e: Fix 82572EI that has no hardware timestamp support Jeff Kirsher
2015-01-23  2:36 ` [net-next 03/15] virtio_net: add software " Jeff Kirsher
2015-01-23  2:37 ` [net-next 04/15] igb: Clean-up page reuse code Jeff Kirsher
2015-01-23  2:37 ` [net-next 05/15] fm10k: " Jeff Kirsher
2015-01-23  2:37 ` [net-next 06/15] igb: refactor time sync interrupt handling Jeff Kirsher
2015-01-23  2:37 ` [net-next 07/15] igb: serialize access to the time sync interrupt registers Jeff Kirsher
2015-01-23  2:37 ` [net-next 08/15] igb: enable internal PPS for the i210 Jeff Kirsher
2015-01-23  2:37 ` [net-next 09/15] igb: enable auxiliary PHC functions " Jeff Kirsher
2015-01-23  2:37 ` [net-next 10/15] net/fm10k: Avoid double setting of NETIF_F_SG for the HW encapsulation feature mask Jeff Kirsher
2015-01-23  2:37 ` Jeff Kirsher [this message]
2015-01-23  2:37 ` [net-next 12/15] fm10k: Increase the timeout for the data path reset Jeff Kirsher
2015-01-23  2:37 ` [net-next 13/15] igb: Indicate failure on vf reset for empty mac address Jeff Kirsher
2015-01-23  2:37 ` [net-next 14/15] net: e1000: support txtd update delay via xmit_more Jeff Kirsher
2015-01-23  2:37 ` [net-next 15/15] net: e1000e: " Jeff Kirsher
2015-01-25  7:24 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-01-22 David Miller

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=1421980631-1955-12-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=joestringer@nicira.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.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 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.