Skip to content

Commit 98b3377

Browse files
dlunevdavem330
authored andcommitted
ipv6: consolidate error paths in ipv6_frag_rcv
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0b0588d commit 98b3377

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

‎net/ipv6/reassembly.c‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,12 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
578578
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
579579

580580
/* Jumbo payload inhibits frag. header */
581-
if (hdr->payload_len==0) {
582-
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
583-
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
584-
skb_network_header_len(skb));
585-
return -1;
586-
}
581+
if (hdr->payload_len==0)
582+
goto fail_hdr;
583+
587584
if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
588-
sizeof(struct frag_hdr)))) {
589-
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
590-
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
591-
skb_network_header_len(skb));
592-
return -1;
593-
}
585+
sizeof(struct frag_hdr))))
586+
goto fail_hdr;
594587

595588
hdr = ipv6_hdr(skb);
596589
fhdr = (struct frag_hdr *)skb_transport_header(skb);
@@ -624,6 +617,11 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
624617
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS);
625618
kfree_skb(skb);
626619
return -1;
620+
621+
fail_hdr:
622+
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
623+
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb));
624+
return -1;
627625
}
628626

629627
static struct inet6_protocol frag_protocol =

0 commit comments

Comments
 (0)