[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b073d69-dd4a-3f82-3a96-5361dabbce80@redhat.com>
Date: Wed, 13 Jan 2021 18:18:42 +0100
From: Auger Eric <eric.auger@...hat.com>
To: Marc Zyngier <maz@...nel.org>
Cc: eric.auger.pro@...il.com, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, kvmarm@...ts.cs.columbia.edu,
drjones@...hat.com, alexandru.elisei@....com, james.morse@....com,
julien.thierry.kdev@...il.com, suzuki.poulose@....com,
shuah@...nel.org, pbonzini@...hat.com
Subject: Re: [PATCH 3/9] KVM: arm64: vgic-v3: Fix error handling in
vgic_v3_set_redist_base()
Hi Marc,
On 12/28/20 4:35 PM, Marc Zyngier wrote:
> Hi Eric,
>
> On Sat, 12 Dec 2020 18:50:04 +0000,
> Eric Auger <eric.auger@...hat.com> wrote:
>>
>> vgic_register_all_redist_iodevs may succeed while
>> vgic_register_all_redist_iodevs fails. For example this can happen
>
> The same function cannot both fail and succeed ;-) Can you shed some
> light on what you had in mind?
Damn, I meant vgic_v3_insert_redist_region() can be successful and then
vgic_register_all_redist_iodevs() fails due to detection of overlap.
>
>> while adding a redistributor region overlapping a dist region. The
>> failure only is detected on vgic_register_all_redist_iodevs when
>> vgic_v3_check_base() gets called.
>>
>> In such a case, remove the newly added redistributor region and free
>> it.
>>
>> Signed-off-by: Eric Auger <eric.auger@...hat.com>
>> ---
>> arch/arm64/kvm/vgic/vgic-mmio-v3.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
>> index 8e8a862def76..581f0f490000 100644
>> --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
>> +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
>> @@ -866,8 +866,14 @@ int vgic_v3_set_redist_base(struct kvm *kvm, u32 index, u64 addr, u32 count)
>> * afterwards will register the iodevs when needed.
>> */
>> ret = vgic_register_all_redist_iodevs(kvm);
>> - if (ret)
>> + if (ret) {
>> + struct vgic_redist_region *rdreg =
>> + vgic_v3_rdist_region_from_index(kvm, index);
>> +
>
> nit: consider splitting declaration and assignment so that we avoid
> the line split if you insist on the 80 character limit.
Sure
Thanks
Eric
>
>> + list_del(&rdreg->list);
>> + kfree(rdreg);
>> return ret;
>> + }
>>
>> return 0;
>> }
>> --
>> 2.21.3
>>
>>
>
> Thanks,
>
> M.
>
Powered by blists - more mailing lists