From: Marc Zyngier <maz@kernel.org>
To: linmiaohe <linmiaohe@huawei.com>
Cc: <pbonzini@redhat.com>, <rkrcmar@redhat.com>,
<james.morse@arm.com>, <julien.thierry.kdev@gmail.com>,
<suzuki.poulose@arm.com>, <christoffer.dall@arm.com>,
<catalin.marinas@arm.com>, <eric.auger@redhat.com>,
<gregkh@linuxfoundation.org>, <will@kernel.org>,
<andre.przywara@arm.com>, <tglx@linutronix.de>,
<linux-arm-kernel@lists.infradead.org>,
<kvmarm@lists.cs.columbia.edu>, <linux-kernel@vger.kernel.org>,
<kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: vgic: Fix potential double free dist->spis in __kvm_vgic_destroy()
Date: Fri, 06 Dec 2019 11:53:36 +0000 [thread overview]
Message-ID: <c786fec1d39fc8beae4bc4fe4269add9@www.loen.fr> (raw)
In-Reply-To: <1574923128-19956-1-git-send-email-linmiaohe@huawei.com>
On 2019-11-28 06:38, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
>
> In kvm_vgic_dist_init() called from kvm_vgic_map_resources(), if
> dist->vgic_model is invalid, dist->spis will be freed without set
> dist->spis = NULL. And in vgicv2 resources clean up path,
> __kvm_vgic_destroy() will be called to free allocated resources.
> And dist->spis will be freed again in clean up chain because we
> forget to set dist->spis = NULL in kvm_vgic_dist_init() failed
> path. So double free would happen.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> virt/kvm/arm/vgic/vgic-init.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/virt/kvm/arm/vgic/vgic-init.c
> b/virt/kvm/arm/vgic/vgic-init.c
> index 53e3969dfb52..c17c29beeb72 100644
> --- a/virt/kvm/arm/vgic/vgic-init.c
> +++ b/virt/kvm/arm/vgic/vgic-init.c
> @@ -171,6 +171,7 @@ static int kvm_vgic_dist_init(struct kvm *kvm,
> unsigned int nr_spis)
> break;
> default:
> kfree(dist->spis);
> + dist->spis = NULL;
> return -EINVAL;
> }
> }
Applied, thanks.
M.
--
Jazz is not dead. It just smells funny...
prev parent reply other threads:[~2019-12-06 11:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 6:38 linmiaohe
2019-11-28 8:49 ` Auger Eric
2019-12-06 11:53 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c786fec1d39fc8beae4bc4fe4269add9@www.loen.fr \
--to=maz@kernel.org \
--cc=andre.przywara@arm.com \
--cc=catalin.marinas@arm.com \
--cc=christoffer.dall@arm.com \
--cc=eric.auger@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linmiaohe@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®