diff options
Diffstat (limited to 'net/nsh/nsh.c')
-rw-r--r-- | net/nsh/nsh.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index d7da99a0b0b8..9696ef96b719 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c | |||
@@ -57,6 +57,8 @@ int nsh_pop(struct sk_buff *skb) | |||
57 | return -ENOMEM; | 57 | return -ENOMEM; |
58 | nh = (struct nshhdr *)(skb->data); | 58 | nh = (struct nshhdr *)(skb->data); |
59 | length = nsh_hdr_len(nh); | 59 | length = nsh_hdr_len(nh); |
60 | if (length < NSH_BASE_HDR_LEN) | ||
61 | return -EINVAL; | ||
60 | inner_proto = tun_p_to_eth_p(nh->np); | 62 | inner_proto = tun_p_to_eth_p(nh->np); |
61 | if (!pskb_may_pull(skb, length)) | 63 | if (!pskb_may_pull(skb, length)) |
62 | return -ENOMEM; | 64 | return -ENOMEM; |
@@ -90,6 +92,8 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, | |||
90 | if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) | 92 | if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) |
91 | goto out; | 93 | goto out; |
92 | nsh_len = nsh_hdr_len(nsh_hdr(skb)); | 94 | nsh_len = nsh_hdr_len(nsh_hdr(skb)); |
95 | if (nsh_len < NSH_BASE_HDR_LEN) | ||
96 | goto out; | ||
93 | if (unlikely(!pskb_may_pull(skb, nsh_len))) | 97 | if (unlikely(!pskb_may_pull(skb, nsh_len))) |
94 | goto out; | 98 | goto out; |
95 | 99 | ||