Skip to content

Commit d1ed1f8

Browse files
sbrivio-rhgregkh
authored andcommitted
ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()
[ Upstream commit afce615aaabfbaad02550e75c0bec106dafa1adf ] RFC 2465 defines ipv6IfStatsOutFragFails as: "The number of IPv6 datagrams that have been discarded because they needed to be fragmented at this output interface but could not be." The existing implementation, instead, would increase the counter twice in case we fail to allocate room for single fragments: once for the fragment, once for the datagram. This didn't look intentional though. In one of the two affected affected failure paths, the double increase was simply a result of a new 'goto fail' statement, introduced to avoid a skb leak. The other path appears to be affected since at least 2.6.12-rc2. Reported-by: Sabrina Dubroca <sdubroca@redhat.com> Fixes: 1d325d2 ("ipv6: ip6_fragment: fix headroom tests and skb leak") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4993389 commit d1ed1f8

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

net/ipv6/ip6_output.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,6 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
647647
*prevhdr = NEXTHDR_FRAGMENT;
648648
tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC);
649649
if (!tmp_hdr) {
650-
IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
651-
IPSTATS_MIB_FRAGFAILS);
652650
err = -ENOMEM;
653651
goto fail;
654652
}
@@ -767,8 +765,6 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
767765
frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
768766
hroom + troom, GFP_ATOMIC);
769767
if (!frag) {
770-
IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
771-
IPSTATS_MIB_FRAGFAILS);
772768
err = -ENOMEM;
773769
goto fail;
774770
}

0 commit comments

Comments
 (0)