Thread (2 messages) 2 messages, 1 author, 2013-05-30

Re: [PATCH] netfilter: Correct calculation using skb->tail and skb-network_header

From: Simon Horman <horms@verge.net.au>
Date: 2013-05-30 23:58:32
Also in: netfilter-devel

On Fri, May 31, 2013 at 08:55:33AM +0900, Simon Horman wrote:
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.
Sorry, I made this patch in a bit of a rush and I realise it it not
always correct as skb->tail is not always a pointer. I will re-spin the
patch.
quoted hunk ↗ jump to hunk
Reported-by: Stephen Rothwell <redacted>
Reported-by: Chen Gang <redacted>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/nf_nat_helper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_nat_helper.c b/net/netfilter/nf_nat_helper.c
index 5fea563..fdbdfec 100644
--- a/net/netfilter/nf_nat_helper.c
+++ b/net/netfilter/nf_nat_helper.c
@@ -104,7 +104,7 @@ static void mangle_contents(struct sk_buff *skb,
 	/* move post-replacement */
 	memmove(data + match_offset + rep_len,
 		data + match_offset + match_len,
-		skb->tail - (skb->network_header + dataoff +
+		skb->tail - (skb_network_header(skb) + dataoff +
 			     match_offset + match_len));
 
 	/* insert data from buffer */
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help