ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()
authorStefano Brivio <sbrivio@redhat.com>
Mon, 24 Jul 2017 21:14:28 +0000 (23:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jul 2017 04:17:10 +0000 (21:17 -0700)
commitafce615aaabfbaad02550e75c0bec106dafa1adf
treec7f34ab79daa3224f3f2e6f5ae7d8d40c455be3c
parent783692558a60cd69d8d86900b33846263598ca6c
ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()

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: 1d325d217c7f ("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>
net/ipv6/ip6_output.c