summaryrefslogtreecommitdiffstats
path: root/net/nsh
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2018-05-17 16:29:19 +0200
committerWolfram Sang <wsa@the-dreams.de>2018-05-17 16:29:19 +0200
commit3d8b7a4ea310f3621a19d50cbe6cbc89bb23b82f (patch)
tree51a261418928d8499ecade36f74e74fc92396503 /net/nsh
parenti2c: stm32f7: fix documentation typo (diff)
parenti2c: pnx: move header into the driver (diff)
downloadlinux-3d8b7a4ea310f3621a19d50cbe6cbc89bb23b82f.tar.xz
linux-3d8b7a4ea310f3621a19d50cbe6cbc89bb23b82f.zip
Merge branch 'i2c/platform_data-immutable' into i2c/for-4.18
Diffstat (limited to 'net/nsh')
-rw-r--r--net/nsh/nsh.c4
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)
return -ENOMEM;
nh = (struct nshhdr *)(skb->data);
length = nsh_hdr_len(nh);
+ if (length < NSH_BASE_HDR_LEN)
+ return -EINVAL;
inner_proto = tun_p_to_eth_p(nh->np);
if (!pskb_may_pull(skb, length))
return -ENOMEM;
@@ -90,6 +92,8 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN)))
goto out;
nsh_len = nsh_hdr_len(nsh_hdr(skb));
+ if (nsh_len < NSH_BASE_HDR_LEN)
+ goto out;
if (unlikely(!pskb_may_pull(skb, nsh_len)))
goto out;