Skip to contentSkip to conversation

drivers-base-node-fix-double-free-in-register_one_node.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 28, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: drivers/base/node: fix double free in register_one_node()
has been removed from the -mm tree. Its filename was
drivers-base-node-fix-double-free-in-register_one_node.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Donet Tom <[email protected]>
Subject: drivers/base/node: fix double free in register_one_node()
Date: Thu, 18 Sep 2025 11:11:44 +0530

When device_register() fails in register_node(), it calls put_device(&node->dev). This triggers node_device_release(), which calls kfree(to_node(dev)), thereby freeing the entire node structure.

As a result, when register_node() returns an error, the node memory has already been freed. Calling kfree(node) again in register_one_node() leads to a double free.

This patch removes the redundant kfree(node) from register_one_node() to prevent the double free.

Fixes 786eb990cfb7 ("drivers/base/node: handle error properly in register_one_node()")
Cc Alison Schofield <[email protected]>
Cc Chris Mason <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Hiroyouki Kamezawa <[email protected]>
Cc Joanthan Cameron <[email protected]>
Cc "Ritesh Harjani (IBM)" <[email protected]>
Cc Yury Norov (NVIDIA) <[email protected]>
Cc Zi Yan <[email protected]>

---

 drivers/base/node.c |    1 -
 1 file changed, 1 deletion(-)
drivers/base/node.c renamed from drivers/base/node.c~drivers-base-node-fix-double-free-in-register_one_node +0 -1
@@ -887,7 +887,6 @@ int register_one_node(int nid)
 	error = register_node(node_devices[nid], nid);
 	if (error) {
 		node_devices[nid] = NULL;
-		kfree(node);
 		return error;
 	}
 

_

Patches currently in -mm which might be from [email protected] are