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>
This commit is contained in:
committed by
David S. Miller
parent
be8b678c6c
commit
ced14f6804
@@ -1724,7 +1724,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
|
||||
skb_reset_mac_header(skb2);
|
||||
|
||||
if (skb_network_header(skb2) < skb2->data ||
|
||||
skb2->network_header > skb2->tail) {
|
||||
skb_network_header(skb2) > skb_tail_pointer(skb2)) {
|
||||
net_crit_ratelimited("protocol %04x is buggy, dev %s\n",
|
||||
ntohs(skb2->protocol),
|
||||
dev->name);
|
||||
@@ -3892,7 +3892,7 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
|
||||
NAPI_GRO_CB(skb)->frag0 = NULL;
|
||||
NAPI_GRO_CB(skb)->frag0_len = 0;
|
||||
|
||||
if (skb->mac_header == skb->tail &&
|
||||
if (skb_mac_header(skb) == skb_tail_pointer(skb) &&
|
||||
pinfo->nr_frags &&
|
||||
!PageHighMem(skb_frag_page(frag0))) {
|
||||
NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0);
|
||||
|
||||
Reference in New Issue
Block a user