linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Josh Law <hlcj1234567@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Josh Law <objecting@objecting.org>
Subject: Re: [PATCH v2] lib/idr: fix infinite loop in idr_get_next()
Date: Thu, 12 Mar 2026 17:28:48 +0000	[thread overview]
Message-ID: <40767ecf-7e25-48f5-a604-c43b835b6b66@gmail.com> (raw)
In-Reply-To: <abL3U3xm9c4oSbKM@casper.infradead.org>

12 Mar 2026 17:26:44 Matthew Wilcox <willy@infradead.org>:

> On Thu, Mar 12, 2026 at 05:12:38PM +0000, Josh Law wrote:
>> From: Josh Law <objecting@objecting.org>
>>
>> In idr_get_next(), if the returned id from idr_get_next_ul() is greater
>> than INT_MAX, the function issues a warning and returns NULL without
>> updating the *nextid pointer. This causes a soft lockup for any caller
>> iterating over an IDR (e.g. via idr_for_each_entry) because they will
>> receive NULL, fail to advance their index, and repeatedly query the same
>> state forever.
>>
>> Fix this by setting *nextid to INT_MAX when the bounds check fails,
>> ensuring the caller's iteration will terminate.
>
> Can you add a test-case for this?  And the IDA patch you also sent?

Lmao you and your test cases, absolutely ill add some test cases


      reply	other threads:[~2026-03-12 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 17:12 Josh Law
2026-03-12 17:26 ` Matthew Wilcox
2026-03-12 17:28   ` Josh Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40767ecf-7e25-48f5-a604-c43b835b6b66@gmail.com \
    --to=hlcj1234567@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=objecting@objecting.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox