summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/hyp/nvhe/page_alloc.c
diff options
context:
space:
mode:
authorQuentin Perret <qperret@google.com>2021-10-05 10:01:42 +0100
committerMarc Zyngier <maz@kernel.org>2021-10-05 13:02:54 +0100
commit7615c2a514788559c6684234b8fc27f3a843c2c6 (patch)
tree874d1721abc8e9d1ae97942d6376d994e3081b99 /arch/arm64/kvm/hyp/nvhe/page_alloc.c
parent1d58a17ef54599506d44c45ac95be27273a4d2b1 (diff)
KVM: arm64: Report corrupted refcount at EL2
Some of the refcount manipulation helpers used at EL2 are instrumented to catch a corrupted state, but not all of them are treated equally. Let's make things more consistent by instrumenting hyp_page_ref_dec_and_test() as well. Acked-by: Will Deacon <will@kernel.org> Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Quentin Perret <qperret@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20211005090155.734578-6-qperret@google.com
Diffstat (limited to 'arch/arm64/kvm/hyp/nvhe/page_alloc.c')
-rw-r--r--arch/arm64/kvm/hyp/nvhe/page_alloc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c
index a6e874e61a40..0bd7701ad1df 100644
--- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c
+++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c
@@ -152,6 +152,7 @@ static inline void hyp_page_ref_inc(struct hyp_page *p)
static inline int hyp_page_ref_dec_and_test(struct hyp_page *p)
{
+ BUG_ON(!p->refcount);
p->refcount--;
return (p->refcount == 0);
}