summaryrefslogtreecommitdiffstats
path: root/include/net/inet_ecn.h
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2013-05-28 22:34:25 +0200
committerDavid S. Miller <davem@davemloft.net>2013-05-29 08:49:07 +0200
commitced14f6804a979d1972415bc23f2f8ddb18595dd (patch)
tree4a1acce32c9d4dd88afaba37841461bb36be9c4d /include/net/inet_ecn.h
parentcxgb3: Correct comparisons and calculations using skb->tail and skb-transport... (diff)
downloadlinux-ced14f6804a979d1972415bc23f2f8ddb18595dd.tar.xz
linux-ced14f6804a979d1972415bc23f2f8ddb18595dd.zip
net: Correct comparisons and calculations using skb->tail and skb-transport_header
This corrects an regression introduced by "net: Use 16bits for *_headers fields of struct skbuff" when NET_SKBUFF_DATA_USES_OFFSET is not set. In that case skb->tail will be a pointer whereas skb->transport_header will be an offset from head. This is corrected by using wrappers that ensure that comparisons and calculations are always made using pointers. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_ecn.h')
-rw-r--r--include/net/inet_ecn.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index aab73757bc4d..3bd22795c3e2 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -134,12 +134,14 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
{
switch (skb->protocol) {
case cpu_to_be16(ETH_P_IP):
- if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
+ if (skb_network_header(skb) + sizeof(struct iphdr) <=
+ skb_tail_pointer(skb))
return IP_ECN_set_ce(ip_hdr(skb));
break;
case cpu_to_be16(ETH_P_IPV6):
- if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
+ if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
+ skb_tail_pointer(skb))
return IP6_ECN_set_ce(ipv6_hdr(skb));
break;
}