Skip to contentSkip to conversation

netfilter: ipv6: fix overlap check for fragments

PATCH Applied Shan Wei 2 participants 3 messages Nov 5, 2010 – Nov 12, 2010

Subsystems (3)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

PATCH 1/1 netfilter: ipv6: fix overlap check for fragments

The type of FRAG6_CB(prev)->offset is int, skb->len is *unsigned* int, and offset is int.

Without this patch, type conversion occurred to this expression, when (FRAG6_CB(prev)->offset + prev->len) is less than offset.

---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -1
index 3a3f129..79d43aa 100644
@@ -286,7 +286,7 @@ found:
 
 	/* Check for overlap with preceding fragment. */
 	if (prev &&
-	    (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset > 0)
+	    (NFCT_FRAG6_CB(prev)->offset + prev->len) > offset)
 		goto discard_fq;
 
 	/* Look for overlap with succeeding segment. */
Signature · 1 line
1.6.3.3
author
#1 lore raw

Hi Patrick:
Would you apply this to your tree. The similar patch for ipv6 has been
applied by David .
See http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=f46421416fb6b91513fb687d6503142cd99034a5

Shan Wei wrote, at 11/05/2010 07:56 PM:

Quoted 25 lines

The type of FRAG6_CB(prev)->offset is int, skb->len is *unsigned* int, and offset is int.

Without this patch, type conversion occurred to this expression, when (FRAG6_CB(prev)->offset + prev->len) is less than offset.

---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -1
index 3a3f129..79d43aa 100644
@@ -286,7 +286,7 @@ found:
 
 	/* Check for overlap with preceding fragment. */
 	if (prev &&
-	    (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset > 0)
+	    (NFCT_FRAG6_CB(prev)->offset + prev->len) > offset)
 		goto discard_fq;
 
 	/* Look for overlap with succeeding segment. */
Signature · 3 lines
Best Regards
-----
Shan Wei
#2 lore raw
In reply to Shan Wei
Quoted 5 lines · Shan Wei

The type of FRAG6_CB(prev)->offset is int, skb->len is *unsigned* int, and offset is int.

Without this patch, type conversion occurred to this expression, when (FRAG6_CB(prev)->offset + prev->len) is less than offset.

Applied, thanks Shan.