[PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak
From: Josh Law
Date: Thu Mar 12 2026 - 14:21:42 EST
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(-)
--
2.34.1