linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Waiman Long <llong@redhat.com>
Cc: Gu Bowen <gubowen5@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, linux-mm@kvack.org,
	Breno Leitao <leitao@debian.org>,
	John Ogness <john.ogness@linutronix.de>,
	Lu Jialin <lujialin4@huawei.com>
Subject: Re: [PATCH v4] mm: Fix possible deadlock in kmemleak
Date: Wed, 20 Aug 2025 18:00:14 +0100	[thread overview]
Message-ID: <aKX_HvAK6ZopNX35@arm.com> (raw)
In-Reply-To: <fed73718-8001-4db6-af36-86c60e85d224@redhat.com>

On Wed, Aug 20, 2025 at 11:01:00AM -0400, Waiman Long wrote:
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 84265983f239..eb4e0af5edba 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -856,13 +856,8 @@ static void delete_object_part(unsigned long ptr, size_t size,
> 
>         raw_spin_lock_irqsave(&kmemleak_lock, flags);
>         object = __find_and_remove_object(ptr, 1, objflags);
> -       if (!object) {
> -#ifdef DEBUG
> -               kmemleak_warn("Partially freeing unknown object at 0x%08lx (size %zu)\n",
> -                             ptr, size);
> -#endif
> +       if (!object)
>                 goto unlock;
> -       }
> 
>         /*
>          * Create one or two objects that may result from the memory block
> @@ -882,8 +877,14 @@ static void delete_object_part(unsigned long ptr, size_t size,
> 
>  unlock:
>         raw_spin_unlock_irqrestore(&kmemleak_lock, flags);
> -       if (object)
> +       if (object) {
>                 __delete_object(object);
> +       } else {
> +#ifdef DEBUG
> +               kmemleak_warn("Partially freeing unknown object at 0x%08lx (size %zu)\n",
> +                             ptr, size);
> +#endif
> +       }
> 
> Anyway, I am not against using printk_deferred_enter/exit here. It is just
> that they should be used as a last resort if there is no easy way to work
> around it.

This works for me if Gu respins the patch

Thanks.

-- 
Catalin


  reply	other threads:[~2025-08-20 17:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18  9:09 Gu Bowen
2025-08-19 15:30 ` Catalin Marinas
2025-08-19 22:49   ` Andrew Morton
2025-08-20  1:23   ` Gu Bowen
2025-08-20  3:27 ` Waiman Long
2025-08-20 11:02   ` Catalin Marinas
2025-08-20 15:01     ` Waiman Long
2025-08-20 17:00       ` Catalin Marinas [this message]
2025-08-21 11:45         ` Gu Bowen

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=aKX_HvAK6ZopNX35@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gubowen5@huawei.com \
    --cc=john.ogness@linutronix.de \
    --cc=leitao@debian.org \
    --cc=linux-mm@kvack.org \
    --cc=llong@redhat.com \
    --cc=lujialin4@huawei.com \
    --cc=stable@vger.kernel.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