From: Shannon Zhao <shannon.zhao@linux.alibaba.com>
To: kvmarm@lists.cs.columbia.edu, maz@kernel.org,
james.morse@arm.com, suzuki.poulose@arm.com,
christoffer.dall@arm.com
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 2/7] KVM: arch_timer: Fix resource leak on error path
Date: Thu, 24 Oct 2019 18:27:45 +0800 [thread overview]
Message-ID: <1571912870-18471-3-git-send-email-shannon.zhao@linux.alibaba.com> (raw)
In-Reply-To: <1571912870-18471-1-git-send-email-shannon.zhao@linux.alibaba.com>
It needs to cleanup irq setup for host_vtimer_irq when
request_percpu_irq fails for host_ptimer_irq. It needs to cleanup irq
setup for both host_vtimer_irq and host_ptimer_irq when seeting vcpu
affinity error as well.
Fixes: 9e01dc76be6a ("KVM: arm/arm64: arch_timer: Assign the phys timer on VHE systems")
Signed-off-by: Shannon Zhao <shannon.zhao@linux.alibaba.com>
---
virt/kvm/arm/arch_timer.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index e2bb5bd..f5a5d51 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -960,7 +960,7 @@ int kvm_timer_hyp_init(bool has_gic)
if (err) {
kvm_err("kvm_arch_timer: can't request ptimer interrupt %d (%d)\n",
host_ptimer_irq, err);
- return err;
+ goto out_free_irq;
}
if (has_gic) {
@@ -968,7 +968,7 @@ int kvm_timer_hyp_init(bool has_gic)
kvm_get_running_vcpus());
if (err) {
kvm_err("kvm_arch_timer: error setting vcpu affinity\n");
- goto out_free_irq;
+ goto out_free_pirq;
}
}
@@ -984,6 +984,8 @@ int kvm_timer_hyp_init(bool has_gic)
"kvm/arm/timer:starting", kvm_timer_starting_cpu,
kvm_timer_dying_cpu);
return 0;
+out_free_pirq:
+ free_percpu_irq(host_ptimer_irq, kvm_get_running_vcpus());
out_free_irq:
free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());
return err;
--
1.8.3.1
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2019-10-24 12:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 10:27 [PATCH RFC 0/7] Support KVM being compiled as a kernel module on arm64 Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 1/7] KVM: ARM: call hyp_cpu_pm_exit on correct fail and exit path Shannon Zhao
2019-10-24 10:27 ` Shannon Zhao [this message]
2019-10-24 10:27 ` [PATCH RFC 3/7] KVM: vgic: make vgic parameters work well for module Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 4/7] KVM: vgic: Add hyp uninitialize function Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 5/7] KVM: arch_timer: " Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 6/7] KVM: arm/arm64: Move target table register into register table init function Shannon Zhao
2019-10-24 10:27 ` [PATCH RFC 7/7] KVM: ARM: Support KVM being compiled as a kernel module Shannon Zhao
2019-10-24 10:58 ` [PATCH RFC 0/7] Support KVM being compiled as a kernel module on arm64 James Morse
2019-10-24 13:41 ` Marc Zyngier
2019-10-25 2:48 ` Shannon Zhao
2019-10-25 10:12 ` Christoffer Dall
2019-10-25 10:43 ` Marc Zyngier
2019-10-25 2:24 ` Shannon Zhao
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=1571912870-18471-3-git-send-email-shannon.zhao@linux.alibaba.com \
--to=shannon.zhao@linux.alibaba.com \
--cc=christoffer.dall@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).