[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5c7ce5b-93f0-b305-de32-c99d0390eb28@suse.cz>
Date: Tue, 14 Sep 2021 18:11:01 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
kernel test robot <oliver.sang@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [for-linus][PATCH 1/2] bootconfig: Fix to check the xbc_node is
used before free it
On 9/14/21 16:48, Steven Rostedt wrote:
> From: Masami Hiramatsu <mhiramat@...nel.org>
>
> Fix to check the xbc_node is used before calling memblock_free()
> because passing NULL to phys_addr() will cause a panic.
> This will happen if user doesn't pass any bootconfig to the
> kernel, because kernel will call xbc_destroy_all() after
> booting.
>
> Link: https://lkml.kernel.org/r/163149460533.291098.7342418455457691240.stgit@devnote2
>
> Fixes: 40caa127f3c7 ("init: bootconfig: Remove all bootconfig data when the init memory is removed")
> Reported-by: kernel test robot <oliver.sang@...el.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
Should have replied here.
Tested-by: Vlastimil Babka <vbabka@...e.cz>
details:
https://lore.kernel.org/all/61ab2d0c-3313-aaab-514c-e15b7aa054a0@suse.cz/
> ---
> lib/bootconfig.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index f8419cff1147..4f8849706ef6 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -792,7 +792,8 @@ void __init xbc_destroy_all(void)
> xbc_data = NULL;
> xbc_data_size = 0;
> xbc_node_num = 0;
> - memblock_free(__pa(xbc_nodes), sizeof(struct xbc_node) * XBC_NODE_MAX);
> + if (xbc_nodes)
> + memblock_free(__pa(xbc_nodes), sizeof(struct xbc_node) * XBC_NODE_MAX);
> xbc_nodes = NULL;
> brace_index = 0;
> }
>
Powered by blists - more mailing lists