Skip to content

lib/idr: Fixes for infinite loop and memory leak

Josh Law linux-fsdevel linux-mm lkml 3 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 3 repliesIn review
  2. v21 patch 2 repliesSuperseded
  3. v11 patch 0 repliesSuperseded

Changes in v3 from the cover letter

- Added idr-test.c updates to both commits to formally test the fix conditions.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2lib/idr: fix infinite loop in idr_get_next()lib/idr.c tools/testing/radix-tree/idr-test.c+4 -23 replies
2/2lib/idr: fix memory leak in ida_alloc_range() error pathtools/testing/radix-tree/idr-test.c+17 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak

This series includes two fixes for the IDR and IDA APIs, along with their corresponding test cases as requested by reviewers.

1. Fix an infinite loop condition in idr_get_next() that occurs when iterating over an ID > INT_MAX.
2. Fix a memory leak in ida_alloc_range() where an intermediate allocated bitmap is not freed if a subsequent XArray insertion fails.

Both fixes update tools/testing/radix-tree/idr-test.c to ensure the error paths are covered by the test suite.

Changes since v2:
- Added idr-test.c updates to both commits to formally test the fix conditions.

Josh Law (2):
lib/idr: fix infinite loop in idr_get_next() lib/idr: fix memory leak in ida_alloc_range() error path

 lib/idr.c                           |  4 +++-
 tools/testing/radix-tree/idr-test.c | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1