[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <df48ed76cf8a756a7f97ed42a1a39d0a404014bc.1598363608.git.christophe.leroy@csgroup.eu>
Date: Tue, 25 Aug 2020 13:53:59 +0000 (UTC)
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>
Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH v1 1/9] powerpc/vdso: Remove BUG_ON() in vdso_init()
If we are not able to allocate memory for the pagelists, bail out.
There is no reason to crash the machine, just have vdso init fail.
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
---
This series is based on top of the series switching to C VDSO implementation,
but in fact only the last patch depends on that series and is not vital as
it is just afterwork cleanup.
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
---
arch/powerpc/kernel/vdso.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 23208a051af5..88a4a02ed4c4 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -747,20 +747,16 @@ static int __init vdso_init(void)
* Initialize the vDSO images in memory, that is do necessary
* fixups of vDSO symbols, locate trampolines, etc...
*/
- if (vdso_setup()) {
- printk(KERN_ERR "vDSO setup failure, not enabled !\n");
- vdso32_pages = 0;
-#ifdef CONFIG_PPC64
- vdso64_pages = 0;
-#endif
- return 0;
- }
+ if (vdso_setup())
+ goto setup_failed;
#ifdef CONFIG_VDSO32
/* Make sure pages are in the correct state */
vdso32_pagelist = kcalloc(vdso32_pages + 2, sizeof(struct page *),
GFP_KERNEL);
- BUG_ON(vdso32_pagelist == NULL);
+ if (!vdso32_pagelist)
+ goto alloc_failed;
+
for (i = 0; i < vdso32_pages; i++) {
struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
get_page(pg);
@@ -773,7 +769,9 @@ static int __init vdso_init(void)
#ifdef CONFIG_PPC64
vdso64_pagelist = kcalloc(vdso64_pages + 2, sizeof(struct page *),
GFP_KERNEL);
- BUG_ON(vdso64_pagelist == NULL);
+ if (!vdso64_pagelist)
+ goto alloc_failed;
+
for (i = 0; i < vdso64_pages; i++) {
struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
get_page(pg);
@@ -789,5 +787,14 @@ static int __init vdso_init(void)
vdso_ready = 1;
return 0;
+
+setup_failed:
+ pr_err("vDSO setup failure, not enabled !\n");
+alloc_failed:
+ vdso32_pages = 0;
+#ifdef CONFIG_PPC64
+ vdso64_pages = 0;
+#endif
+ return 0;
}
arch_initcall(vdso_init);
--
2.25.0
Powered by blists - more mailing lists