nsh.c (664b0bae0b87f69bc9deb098f5e0158b9cf18e04) | nsh.c (af50e4ba34f4c45e92535364133d4deb5931c1c5) |
---|---|
1/* 2 * Network Service Header 3 * 4 * Copyright (c) 2017 Red Hat, Inc. -- Jiri Benc <jbenc@redhat.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 43 unchanged lines hidden (view full) --- 52 struct nshhdr *nh; 53 size_t length; 54 __be16 inner_proto; 55 56 if (!pskb_may_pull(skb, NSH_BASE_HDR_LEN)) 57 return -ENOMEM; 58 nh = (struct nshhdr *)(skb->data); 59 length = nsh_hdr_len(nh); | 1/* 2 * Network Service Header 3 * 4 * Copyright (c) 2017 Red Hat, Inc. -- Jiri Benc <jbenc@redhat.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 43 unchanged lines hidden (view full) --- 52 struct nshhdr *nh; 53 size_t length; 54 __be16 inner_proto; 55 56 if (!pskb_may_pull(skb, NSH_BASE_HDR_LEN)) 57 return -ENOMEM; 58 nh = (struct nshhdr *)(skb->data); 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); 61 if (!pskb_may_pull(skb, length)) 62 return -ENOMEM; 63 64 if (!inner_proto) 65 return -EAFNOSUPPORT; 66 67 skb_pull_rcsum(skb, length); --- 17 unchanged lines hidden (view full) --- 85 skb_reset_network_header(skb); 86 87 nhoff = skb->network_header - skb->mac_header; 88 mac_len = skb->mac_len; 89 90 if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) 91 goto out; 92 nsh_len = nsh_hdr_len(nsh_hdr(skb)); | 62 inner_proto = tun_p_to_eth_p(nh->np); 63 if (!pskb_may_pull(skb, length)) 64 return -ENOMEM; 65 66 if (!inner_proto) 67 return -EAFNOSUPPORT; 68 69 skb_pull_rcsum(skb, length); --- 17 unchanged lines hidden (view full) --- 87 skb_reset_network_header(skb); 88 89 nhoff = skb->network_header - skb->mac_header; 90 mac_len = skb->mac_len; 91 92 if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) 93 goto out; 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))) 94 goto out; 95 96 proto = tun_p_to_eth_p(nsh_hdr(skb)->np); 97 if (!proto) 98 goto out; 99 100 __skb_pull(skb, nsh_len); --- 51 unchanged lines hidden --- | 97 if (unlikely(!pskb_may_pull(skb, nsh_len))) 98 goto out; 99 100 proto = tun_p_to_eth_p(nsh_hdr(skb)->np); 101 if (!proto) 102 goto out; 103 104 __skb_pull(skb, nsh_len); --- 51 unchanged lines hidden --- |