summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2014-11-14 07:47:40 +0000
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-01-22 18:10:21 -0800
commitb66b6d9f6dbe0655a570fb2a2482cceac5f1a9bc (patch)
treecffd645bf612e024996c7c623110fe3590a16a0a /drivers/net
parente2929e453a1dddf489cc8bc360eb207df39d196c (diff)
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@nicira.com> Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index c7a19a5e0ec9..84ab9eea2768 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;