mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Joan Bruguera Micó" <joanbrugueram@gmail.com>
Cc: Steven Price <steven.price@arm.com>,
	zhengqi.arch@bytedance.com,
	Roman Gushchin <roman.gushchin@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: shrinkers: fix race condition on debugfs cleanup
Date: Sat, 29 Jul 2023 01:50:27 +0100	[thread overview]
Message-ID: <ZMRiUw8TGdbDsj1t@casper.infradead.org> (raw)
In-Reply-To: <20230726000827.724389-1-joanbrugueram@gmail.com>

On Wed, Jul 26, 2023 at 12:08:26AM +0000, Joan Bruguera Micó wrote:
> Hmmm, indeed linux-next crashes with a null pointer dereference when
> calling `ida_free(..., -1)`.
> 
> It appears to me that 69cb69ea5542 ("ida: Remove assertions that an ID was
> allocated") didn't intend to make `ida_free(..., -1)` invalid; after all,
> it was authored & introduced immediately after fc82bbf4dede ("ida: don't
> use BUG_ON() for debugging") whose commit message calls for making it
> legal, with Matthew's support.
> And the referenced Bluetooth HCI code that also calls `ida_free(..., -1)`
> is still there, as far as I can tell ([1]).
> 
> Rather, probably the `((int)id < 0)` was accidentally dropped, or the idea
> was that it would be handled by the `not_found:` label in `ida_free`, but
> for that to work you'd need to change the `!test_bit(bit, bitmap->bitmap)`
> condition to `!bitmap || !test_bit(bit, bitmap->bitmap)` since otherwise
> `bitmap->bitmap` is a null pointer dereference.

I've been in two minds about that patch ever since I wrote it.  I've
dropped it from my tree for now.

But, er, you have pointed out a bug which is that we don't handle
!bitmap properly.  That should be fixed.

      reply	other threads:[~2023-07-29  0:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  1:32 Joan Bruguera Micó
2023-05-03  5:37 ` Qi Zheng
2023-05-21 13:57   ` Joan Bruguera Micó
2023-07-03 11:14     ` Steven Price
2023-07-26  0:08       ` Joan Bruguera Micó
2023-07-29  0:50         ` Matthew Wilcox [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=ZMRiUw8TGdbDsj1t@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=joanbrugueram@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=roman.gushchin@linux.dev \
    --cc=steven.price@arm.com \
    --cc=zhengqi.arch@bytedance.com \
    /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

all inboxes | Powered by JetHome®