public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak
@ 2026-03-12 18:19 Josh Law
  2026-03-12 18:19 ` [PATCH v3 1/2] lib/idr: fix infinite loop in idr_get_next() Josh Law
  2026-03-12 18:19 ` [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path Josh Law
  0 siblings, 2 replies; 6+ messages in thread
From: Josh Law @ 2026-03-12 18:19 UTC (permalink / raw)
  To: Matthew Wilcox, Andrew Morton
  Cc: linux-fsdevel, linux-mm, linux-kernel, Josh Law

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-12 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 18:19 [PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak Josh Law
2026-03-12 18:19 ` [PATCH v3 1/2] lib/idr: fix infinite loop in idr_get_next() Josh Law
2026-03-12 20:55   ` Andrew Morton
2026-03-12 20:57     ` Josh Law
2026-03-12 21:15       ` Josh Law
2026-03-12 18:19 ` [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path Josh Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox