Skip to content

Commit 938177e

Browse files
hormsdavem330
authored andcommitted
netfilter: Correct calculation using skb->tail and skb-network_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->network_header will be an offset from head. This is corrected by using wrappers that ensure that calculations are always made using pointers. Reported-by: Stephen Rothwell <[email protected]> Reported-by: Chen Gang <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db8caf3 commit 938177e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nf_nat_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void mangle_contents(struct sk_buff *skb,
104104
/* move post-replacement */
105105
memmove(data + match_offset + rep_len,
106106
data + match_offset + match_len,
107-
skb->tail - (skb->network_header + dataoff +
107+
skb_tail_pointer(skb) - (skb_network_header(skb) + dataoff +
108108
match_offset + match_len));
109109

110110
/* insert data from buffer */

0 commit comments

Comments
 (0)