Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp531237pxb; Wed, 13 Jan 2021 09:22:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwn6zKcjexvAfjJK/nfKQKx9zNGLudjBgOijfZCedjiXZukzNuDhNx9/tCFKsewvbYkzIsL X-Received: by 2002:a17:906:7cc:: with SMTP id m12mr1734191ejc.386.1610558520272; Wed, 13 Jan 2021 09:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610558520; cv=none; d=google.com; s=arc-20160816; b=mjBG1R0mM64v0Qk7adevgwbzD7YNE762ORF7QkQ29SNSenCRXhG7t2SXHcvrZ2ShnL 9plWqR8C3bJAYghFL28alzGuprTP5GUM6TlmaMr8jHh9+FUxlwILSLp0GRFLoYcYLNxw sf/X1oCROmFMvs+Q/K5Ra/8FiDp0ihNGIspKhMsxn5RORZXuitcWJTWAzjqXB3oUNX3a 4XjstvzcZL4A3XMk9ufV5Tn8nxLDwP+lk2N2QMIC2qWyY4HpVrBdrSx7lIvMWnbgradG ABC09HraGX+vHNM4eNJkSaEJ9b4kFWRIFd6X6Yru1wNlxnn3MzvMOBLFr1Ram6Ho6h0N jtPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=V0lROAkdY9acdw8Y4RAB+mGlGxEAhxNtbJbaRarkeyY=; b=bUYL9mx2woVxW71GnpwWClXV8y+eewWOCe6lICVBFki8ItDYecUX3VD1nO1iR0vICO VDJJyg0nKiBKM/ItL2HiHEHlzLdkDVlgJIXt3PXZRYkedaLDCQXlivEsNgHmbG2T1f/C E8ib1jiK9NJfES1QzRD2jsYjeHm2dzCvn+DGdi85gX7y3zyB/A43YY1+XKlKUEDwsvVt 22S1LITskm6QWWnUpd0DLBFFRgwuFjfFDKal/c896HmrQ61L7RZ2GybvaHBOKrMZZvgA h3b1jbnfxGBbXQilQf0YXraQ076ZQyvzvhCVEbIsdnQBiphZTKFBTdG8eAPvhY953mWf JT3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XVDF0Qsp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr3si1317149ejb.388.2021.01.13.09.21.34; Wed, 13 Jan 2021 09:22:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XVDF0Qsp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728322AbhAMRUT (ORCPT + 99 others); Wed, 13 Jan 2021 12:20:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28405 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728067AbhAMRUS (ORCPT ); Wed, 13 Jan 2021 12:20:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610558332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V0lROAkdY9acdw8Y4RAB+mGlGxEAhxNtbJbaRarkeyY=; b=XVDF0QspBTzJ0FfxPXRSeqTY4ejoSd2D2SgLFA81Y+1qF0IsgH51wqKbMqDtkTdghOt9O8 1l2pALPsO7PGql/bXG73Q3BvIADxckQLXBTMY19TB6MgFLdWU9bVP9o9RwCbnfIRubsebo oAlkOD+tocBINHar3Sk0b9rMIlnHdnE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-bSqzembON_KnranJUeX09A-1; Wed, 13 Jan 2021 12:18:48 -0500 X-MC-Unique: bSqzembON_KnranJUeX09A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D70FD56BF4; Wed, 13 Jan 2021 17:18:46 +0000 (UTC) Received: from [10.36.114.165] (ovpn-114-165.ams2.redhat.com [10.36.114.165]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40AA95D9DD; Wed, 13 Jan 2021 17:18:44 +0000 (UTC) Subject: Re: [PATCH 3/9] KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base() To: Marc Zyngier Cc: eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com References: <20201212185010.26579-1-eric.auger@redhat.com> <20201212185010.26579-4-eric.auger@redhat.com> <87a6tyoseo.wl-maz@kernel.org> From: Auger Eric Message-ID: <3b073d69-dd4a-3f82-3a96-5361dabbce80@redhat.com> Date: Wed, 13 Jan 2021 18:18:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <87a6tyoseo.wl-maz@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >> --- >> 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. >