gnrc_ipv6_ext_frag: fix release on rbuf creation for n-th fragment [backport 2019.10] #12434
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #12414
Contribution description
While testing #12375, @kb2ma noticed that in some rare cases, one of the nodes crashes. He informed me offline and I was able to reproduce that. After some more runs, I was able to pinpoint it to the following corner case:
Due to that I added a test case to the unittests of IPv6 reassembly (feee568).
In the end it turned out that when a subsequent fragment is received packet parts that are stored in the reassembly buffer are freed from the packet buffer on reassembly buffer creation. This in turn leads that freed (but still referenced by the reassembly buffer) region to be reused for another packet coming in, e.g. another fragment, that then caches the other reassembly buffer entry out, since the reassembly buffer is full, leading to parts of its data to be released by the reassembly buffer, causing a crash, as the data is now not valid anymore.
Testing procedure
With a board of your choice (preferably
native
, as this test due to anethos
bug [#12264] skips some tests for non-native boards):if feee568 is reverted, the test fails.
Issues/PRs references
Follow-up on #12375.