aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/gre_demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/gre_demux.c')
-rw-r--r--net/ipv4/gre_demux.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index c4c3e439f424..b798862b6be5 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -62,26 +62,26 @@ EXPORT_SYMBOL_GPL(gre_del_protocol);
62 62
63/* Fills in tpi and returns header length to be pulled. */ 63/* Fills in tpi and returns header length to be pulled. */
64int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, 64int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
65 bool *csum_err, __be16 proto) 65 bool *csum_err, __be16 proto, int nhs)
66{ 66{
67 const struct gre_base_hdr *greh; 67 const struct gre_base_hdr *greh;
68 __be32 *options; 68 __be32 *options;
69 int hdr_len; 69 int hdr_len;
70 70
71 if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr)))) 71 if (unlikely(!pskb_may_pull(skb, nhs + sizeof(struct gre_base_hdr))))
72 return -EINVAL; 72 return -EINVAL;
73 73
74 greh = (struct gre_base_hdr *)skb_transport_header(skb); 74 greh = (struct gre_base_hdr *)(skb->data + nhs);
75 if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING))) 75 if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
76 return -EINVAL; 76 return -EINVAL;
77 77
78 tpi->flags = gre_flags_to_tnl_flags(greh->flags); 78 tpi->flags = gre_flags_to_tnl_flags(greh->flags);
79 hdr_len = gre_calc_hlen(tpi->flags); 79 hdr_len = gre_calc_hlen(tpi->flags);
80 80
81 if (!pskb_may_pull(skb, hdr_len)) 81 if (!pskb_may_pull(skb, nhs + hdr_len))
82 return -EINVAL; 82 return -EINVAL;
83 83
84 greh = (struct gre_base_hdr *)skb_transport_header(skb); 84 greh = (struct gre_base_hdr *)(skb->data + nhs);
85 tpi->proto = greh->protocol; 85 tpi->proto = greh->protocol;
86 86
87 options = (__be32 *)(greh + 1); 87 options = (__be32 *)(greh + 1);