Skip to contentSkip to conversation

Patch "ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 8, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ipv6-don-t-increase-ipstats_mib_fragfails-twice-in-ip6_fragment.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Tue Aug 8 16:27:53 PDT 2017

From: Stefano Brivio <[email protected]>
Date: Mon, 24 Jul 2017 23:14:28 +0200
Subject: ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()

From: Stefano Brivio <[email protected]>

[ 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.

Fixes 1d325d217c7f ("ipv6: ip6_fragment: fix headroom tests and skb leak")
---
 net/ipv6/ip6_output.c |    4 ----
 1 file changed, 4 deletions(-)
net/ipv6/ip6_output.c +0 -4
@@ -662,8 +662,6 @@ int ip6_fragment(struct net *net, struct
 		*prevhdr = NEXTHDR_FRAGMENT;
 		tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC);
 		if (!tmp_hdr) {
-			IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
-				      IPSTATS_MIB_FRAGFAILS);
 			err = -ENOMEM;
 			goto fail;
 		}
@@ -782,8 +780,6 @@ slow_path:
 		frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
 				 hroom + troom, GFP_ATOMIC);
 		if (!frag) {
-			IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
-				      IPSTATS_MIB_FRAGFAILS);
 			err = -ENOMEM;
 			goto fail;
 		}

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/ipv6-don-t-increase-ipstats_mib_fragfails-twice-in-ip6_fragment.patch