Commit 821c10c2 authored by Zenghui Yu's avatar Zenghui Yu Committed by Marc Zyngier

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: default avatarZenghui Yu <yuzenghui@huawei.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20200114112212.1411-1-yuzenghui@huawei.com
parent 1cfbb484
...@@ -839,9 +839,8 @@ static int vgic_its_cmd_handle_discard(struct kvm *kvm, struct vgic_its *its, ...@@ -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); u32 event_id = its_cmd_get_id(its_cmd);
struct its_ite *ite; struct its_ite *ite;
ite = find_ite(its, device_id, event_id); 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 * Though the spec talks about removing the pending state, we
* don't bother here since we clear the ITTE anyway and the * don't bother here since we clear the ITTE anyway and the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment