summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenghui Yu <yuzenghui@huawei.com>2020-01-14 14:22:12 +0300
committerMarc Zyngier <maz@kernel.org>2020-01-19 21:06:20 +0300
commit821c10c2ae0bac5a8503cc7e961e7af90ea676eb (patch)
treea68976db54a2fdd11f37aff66107e3ba71dc7935
parent1cfbb484de158e378e8971ac40f3082e53ecca55 (diff)
downloadlinux-821c10c2ae0bac5a8503cc7e961e7af90ea676eb.tar.xz
KVM: arm/arm64: vgic-its: Properly check the unmapped coll in DISCARD handler
Discard is supposed to fail if the collection is not mapped to any target redistributor. We currently check if the collection is mapped by "ite->collection" but this is incomplete (e.g., mapping a LPI to an unmapped collection also results in a non NULL ite->collection). What actually needs to be checked is its_is_collection_mapped(), let's turn to it. Also take this chance to remove an extra blank line. Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/r/20200114112212.1411-1-yuzenghui@huawei.com
-rw-r--r--virt/kvm/arm/vgic/vgic-its.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 17920d1b350a..d53d34a33e35 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -839,9 +839,8 @@ static int vgic_its_cmd_handle_discard(struct kvm *kvm, struct vgic_its *its,
u32 event_id = its_cmd_get_id(its_cmd);
struct its_ite *ite;
-
ite = find_ite(its, device_id, event_id);
- if (ite && ite->collection) {
+ if (ite && its_is_collection_mapped(ite->collection)) {
/*
* Though the spec talks about removing the pending state, we
* don't bother here since we clear the ITTE anyway and the