diff options
| author | Zongmin Zhou <zhouzongmin@kylinos.cn> | 2026-07-16 15:37:56 +0800 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2026-08-01 14:27:36 +0530 |
| commit | e971f19e4c821906db17b4f67747bbce62bf7bf9 (patch) | |
| tree | b1f933dec8115f1d0c1cf86713e3684ebeb7daf7 | |
| parent | b7a4bd0c80656dae7f0a7a9c9be4fdf6f58d29ab (diff) | |
| download | linux-next-e971f19e4c821906db17b4f67747bbce62bf7bf9.tar.gz linux-next-e971f19e4c821906db17b4f67747bbce62bf7bf9.zip | |
KVM: riscv: Fix infinite loop in NACL hfence entry allocation
try_count is initialized to 5 but never decremented in the retry path,
making the `if (try_count)` check always true. If all NACL shared memory
hfence entries remain in the pending state after sync, the function loops
forever, causing a soft lockup. Decrement try_count on each retry so the
fallback warning and return become reachable.
Fixes: d466c19cead5 ("RISC-V: KVM: Add common nested acceleration support")
Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260716073756.44153-1-min_halo@163.com
Signed-off-by: Anup Patel <anup@brainfault.org>
| -rw-r--r-- | arch/riscv/kvm/nacl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kvm/nacl.c b/arch/riscv/kvm/nacl.c index 6f9f8963e9dd..9aff03c4f667 100644 --- a/arch/riscv/kvm/nacl.c +++ b/arch/riscv/kvm/nacl.c @@ -33,7 +33,7 @@ again: } if (ent < 0) { - if (try_count) { + if (try_count--) { nacl_sync_hfence(-1UL); goto again; } else { |
