Skip to content

Fix mas_skip_node() for mas_empty_area()

Liam R. Howlett linux-mm lkml stable 2 versions – Applied

Status from this message: [merged mm-hotfixes-stable] maple_tree-fix-mas_skip_node-end-slot-detection.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied 2/2
  2. v12 patches 7 repliesSuperseded

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2maple_tree: Fix mas_skip_node() end slot detectionlib/maple_tree.c+5 -191 replyApplied
2/2test_maple_tree: Add more testing for mas_empty_area()lib/test_maple_tree.c+48 -00 repliesApplied

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchSnild Dolkow
1/2T-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] Fix mas_skip_node() for mas_empty_area()

Andrew, this should replace these patches in mm-hotfixes-unstable:
400922513f30 ("maple_tree: fix mas_skip_node() end slot detection") 4d4ec28ef3a4 ("test_maple_tree: add more testing for mas_empty_area()")

mas_empty_area() was incorrectly returning an error when there was room. The issue was tracked down to mas_skip_node() using the incorrect end-of-slot count. Instead of using the nodes hard limit, the limit of data should be used.

mas_skip_node() was also setting the min and max to that of the child node, which was unnecessary. Within these limits being set, there was also a bug that corrupted the maple state's max if the offset was set to the maximum node pivot. The bug was without consequence unless there was a sufficient gap in the next child node which would cause an error to be returned.

This patch set fixes these errors by removing the limit setting from mas_skip_node() and uses the mas_data_end() for slot limits, and adds tests for all failures discovered.

Liam R. Howlett (2):
maple_tree: Fix mas_skip_node() end slot detection
test_maple_tree: Add more testing for mas_empty_area()

 lib/maple_tree.c      | 24 +++++-----------------
 lib/test_maple_tree.c | 48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 19 deletions(-)
Signature · 1 line
2.39.2