[PATCH] arm64: vdso: fix AArch32 compat init allocation leaks
From: Osama Abdelkader
Date: Mon Mar 23 2026 - 17:42:22 EST
aarch32_alloc_vdso_pages() allocates the AA32 vdso pagelist, the compat
sigpage, then the kuser vectors page. If aarch32_alloc_sigpage() or
aarch32_alloc_kuser_vdso_page() fails, earlier allocations were not freed.
Unwind in reverse order: drop the sigpage when kuser setup fails, and
kfree the vdso pagelist when either later step fails (only when
CONFIG_COMPAT_VDSO allocated it).
Signed-off-by: Osama Abdelkader <osama.abdelkader@xxxxxxxxx>
---
arch/arm64/kernel/vdso.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 592dd8668de4..9903bfdfd45e 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -236,9 +236,27 @@ static int __init aarch32_alloc_vdso_pages(void)
ret = aarch32_alloc_sigpage();
if (ret)
- return ret;
+ goto free_vdso;
+
+ ret = aarch32_alloc_kuser_vdso_page();
+ if (ret)
+ goto free_sig;
+
+ return 0;
- return aarch32_alloc_kuser_vdso_page();
+free_sig:
+ if (aarch32_sig_page) {
+ __free_page(aarch32_sig_page);
+ aarch32_sig_page = NULL;
+ }
+free_vdso:
+#ifdef CONFIG_COMPAT_VDSO
+ if (vdso_info[VDSO_ABI_AA32].cm && vdso_info[VDSO_ABI_AA32].cm->pages) {
+ kfree(vdso_info[VDSO_ABI_AA32].cm->pages);
+ vdso_info[VDSO_ABI_AA32].cm->pages = NULL;
+ }
+#endif
+ return ret;
}
arch_initcall(aarch32_alloc_vdso_pages);
--
2.43.0