mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Thomas Gleixner <tglx@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] debugobjects: Fix NULL pointer dereference in kmem_alloc_batch()
Date: Sun, 8 Nov 2026 20:56:00 -0800	[thread overview]
Message-ID: <20261108205600.3e737ad18ce85b6ce3049309@linux-foundation.org> (raw)
In-Reply-To: <20261109041215.11280-2-ekffu200098@gmail.com>

On Mon,  9 Nov 2026 13:12:10 +0900 Sang-Heon Jeon <ekffu200098@gmail.com> wrote:

> During boot, debug_objects_replace_static_objects() calls
> kmem_alloc_batch() while obj_cache is still NULL.
> 
> If kmem_cache_zalloc() fails, kmem_alloc_batch() tries to free the
> allocated objects with free_object_list(). But free_object_list()
> always calls kmem_cache_free() with obj_cache, which causes a NULL
> pointer dereference.
> 
> So use the cache passed to kmem_alloc_batch() instead.

Thanks.

We conventionally assume that memory allocations in __init code cannot
fail.  Because if they do fail, something has already gone horribly
wrong with the kernel and it simply isn't viable.  If an unchecked
allocation results in an oops then that's fine - it was inevitable
anyway.



  reply	other threads:[~2026-11-09  4:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  4:12 [PATCH 0/2] " Sang-Heon Jeon
2026-11-09  4:12 ` [PATCH 1/2] " Sang-Heon Jeon
2026-11-09  4:56   ` Andrew Morton [this message]
2026-11-09  5:15     ` Sang-Heon Jeon
2026-11-09  4:12 ` [PATCH 2/2] debugobjects: Use free_object_list() in the boot error path Sang-Heon Jeon

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=20261108205600.3e737ad18ce85b6ce3049309@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ekffu200098@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@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

all inboxes | Powered by JetHome®