Patch "base/node.c: initialize the accessor list before registering" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    base/node.c: initialize the accessor list before registering

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     base-node.c-initialize-the-accessor-list-before-regi.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit afa19df0f792b63502994ec88c2d7629def42556
Author: Gregory Price <gourry.memverge@xxxxxxxxx>
Date:   Mon Oct 30 00:42:39 2023 -0400

    base/node.c: initialize the accessor list before registering
    
    [ Upstream commit 48b5928e18dc27e05cab3dc4c78cd8a15baaf1e5 ]
    
    The current code registers the node as available in the node array
    before initializing the accessor list.  This makes it so that
    anything which might access the accessor list as a result of
    allocations will cause an undefined memory access.
    
    In one example, an extension to access hmat data during interleave
    caused this undefined access as a result of a bulk allocation
    that occurs during node initialization but before the accessor
    list is initialized.
    
    Initialize the accessor list before making the node generally
    available to the global system.
    
    Fixes: 08d9dbe72b1f ("node: Link memory nodes to their compute nodes")
    Signed-off-by: Gregory Price <gregory.price@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231030044239.971756-1-gregory.price@xxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 493d533f8375..4d588f4658c8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -868,11 +868,15 @@ int __register_one_node(int nid)
 {
 	int error;
 	int cpu;
+	struct node *node;
 
-	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
-	if (!node_devices[nid])
+	node = kzalloc(sizeof(struct node), GFP_KERNEL);
+	if (!node)
 		return -ENOMEM;
 
+	INIT_LIST_HEAD(&node->access_list);
+	node_devices[nid] = node;
+
 	error = register_node(node_devices[nid], nid);
 
 	/* link cpu under this node */
@@ -881,7 +885,6 @@ int __register_one_node(int nid)
 			register_cpu_under_node(cpu, nid);
 	}
 
-	INIT_LIST_HEAD(&node_devices[nid]->access_list);
 	node_init_caches(nid);
 
 	return error;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux