diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-09 19:13:01 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-18 00:30:20 -0400 |
commit | b38dfee3d616ffadb58d4215e3ff9d1d7921031e (patch) | |
tree | 55ae104c8522e973291f490c9902580de798ae93 /net/bridge | |
parent | c8c9f9a3de2c50c876b1068dd41f9a06c5749f80 (diff) |
[NET]: skb_trim audit
I found a few more spots where pskb_trim_rcsum could be used but were not.
This patch changes them to use it.
Also, sk_filter can get paged skb data. Therefore we must use pskb_trim
instead of skb_trim.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_netfilter.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 3da9264449f7..3e41f9d6d51c 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -407,12 +407,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, | |||
407 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { | 407 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { |
408 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) | 408 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) |
409 | goto inhdr_error; | 409 | goto inhdr_error; |
410 | if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { | 410 | if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) |
411 | if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))) | 411 | goto inhdr_error; |
412 | goto inhdr_error; | ||
413 | if (skb->ip_summed == CHECKSUM_HW) | ||
414 | skb->ip_summed = CHECKSUM_NONE; | ||
415 | } | ||
416 | } | 412 | } |
417 | if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) | 413 | if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) |
418 | goto inhdr_error; | 414 | goto inhdr_error; |
@@ -495,11 +491,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, | |||
495 | if (skb->len < len || len < 4 * iph->ihl) | 491 | if (skb->len < len || len < 4 * iph->ihl) |
496 | goto inhdr_error; | 492 | goto inhdr_error; |
497 | 493 | ||
498 | if (skb->len > len) { | 494 | pskb_trim_rcsum(skb, len); |
499 | __pskb_trim(skb, len); | ||
500 | if (skb->ip_summed == CHECKSUM_HW) | ||
501 | skb->ip_summed = CHECKSUM_NONE; | ||
502 | } | ||
503 | 495 | ||
504 | nf_bridge_put(skb->nf_bridge); | 496 | nf_bridge_put(skb->nf_bridge); |
505 | if (!nf_bridge_alloc(skb)) | 497 | if (!nf_bridge_alloc(skb)) |