mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] debugobjects: Use free_object_list() in the boot error path
Date: Mon,  9 Nov 2026 13:12:11 +0900	[thread overview]
Message-ID: <20261109041215.11280-3-ekffu200098@gmail.com> (raw)
In-Reply-To: <20261109041215.11280-1-ekffu200098@gmail.com>

Now that free_object_list() takes a cache argument, use it in the error
path of debug_objects_replace_static_objects() instead of open coding
the loop.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 lib/debugobjects.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 7ab1fd8e0891..b066036ff37e 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -1502,7 +1502,6 @@ void __init debug_objects_early_init(void)
 static bool __init debug_objects_replace_static_objects(struct kmem_cache *cache)
 {
 	struct debug_bucket *db = obj_hash;
-	struct hlist_node *tmp;
 	struct debug_obj *obj;
 	HLIST_HEAD(objects);
 	int i;
@@ -1530,11 +1529,7 @@ static bool __init debug_objects_replace_static_objects(struct kmem_cache *cache
 	}
 	return true;
 free:
-	/* Can't use free_object_list() as the cache is not populated yet */
-	hlist_for_each_entry_safe(obj, tmp, &pool_global.objects, node) {
-		hlist_del(&obj->node);
-		kmem_cache_free(cache, obj);
-	}
+	free_object_list(&pool_global.objects, cache);
 	return false;
 }
 
-- 
2.53.0


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  4:12 [PATCH 0/2] debugobjects: Fix NULL pointer dereference in kmem_alloc_batch() Sang-Heon Jeon
2026-11-09  4:12 ` [PATCH 1/2] " Sang-Heon Jeon
2026-11-09  4:12 ` Sang-Heon Jeon [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=20261109041215.11280-3-ekffu200098@gmail.com \
    --to=ekffu200098@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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®