[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1415921801-10452-1-git-send-email-joestringer@nicira.com>
Date: Thu, 13 Nov 2014 15:36:40 -0800
From: Joe Stringer <joestringer@...ira.com>
To: netdev@...r.kernel.org
Cc: matthew.vick@...el.com, jeffrey.t.kirsher@...el.com,
linux.nics@...el.com, therbert@...gle.com, gerlitz.or@...il.com,
alexander.duyck@...il.com, linux-kernel@...r.kernel.org
Subject: [PATCHv2 net 1/2] fm10k: Check tunnel header length in encap offload
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@...ira.com>
---
Matthew, I didn't see the equivalent patch on netdev so I went ahead and
created it. If I've missed this somewhere, then please disregard.
v2: First post.
---
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 e645af4..3a85291 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -732,6 +732,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.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists