[PATCH v1 01/10] KVM: arm64: Don't WARN on SMCCC filter reserved range allocation failure

From: Fuad Tabba

Date: Mon Sep 28 2026 - 11:26:04 EST


The first time userspace sets an SMCCC filter, kvm_smccc_set_filter()
inserts the reserved architecture ranges into the maple tree and WARNs
if that fails. The tree is empty and config_lock is held, so the only
way it can fail is -ENOMEM. The allocation is GFP_KERNEL_ACCOUNT, so a
memory cgroup limit is enough to hit the WARN from userspace.

The WARN goes back to when the ranges were inserted at VM creation and
the error was dropped. Since commit d34b76489ea0c ("KVM: arm64: Only
insert reserved ranges when SMCCC filter is used") the tree is emptied
on failure and the error reaches userspace. Drop the WARN.

Fixes: d34b76489ea0c ("KVM: arm64: Only insert reserved ranges when SMCCC filter is used")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/20260829055809.29AD31F000E9@xxxxxxxxxxxxxxx/
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
arch/arm64/kvm/hypercalls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
index b11b8821c9fbc..210a496733d0e 100644
--- a/arch/arm64/kvm/hypercalls.c
+++ b/arch/arm64/kvm/hypercalls.c
@@ -197,7 +197,7 @@ static int kvm_smccc_set_filter(struct kvm *kvm, struct kvm_smccc_filter __user

if (!kvm_smccc_filter_configured(kvm)) {
r = kvm_smccc_filter_insert_reserved(kvm);
- if (WARN_ON_ONCE(r))
+ if (r)
goto out_unlock;
}

--
2.39.5