Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

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

 



Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:

> On Tue, 30 Nov 2021 14:29:02 +0530 "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx> wrote:
>
>> > What's the thinking here?  The node can later be offlined and the
>> > kernel takes no action to reset home nodes, so why not permit setting a
>> > presently-offline node as the home node?  Checking here seems rather
>> > arbitrary?
>> 
>> The node online check was needed to avoid accessing 
>> uninitialised pgdat structure. Such an access can result in
>> below crash
>
> Oh.  This is unobvious from reading the code.  Which calls for a
> comment, no?

updated

@@ -1497,6 +1498,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 	if (flags != 0)
 		return -EINVAL;
 
+	/*
+	 * Check home_node is online to avoid accessing uninitialized
+	 * NODE_DATA.
+	 */
 	if (home_node >= MAX_NUMNODES || !node_online(home_node))
 		return -EINVAL;




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux