lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1410368033-23628-1-git-send-email-chris.j.arges@canonical.com>
Date:	Wed, 10 Sep 2014 11:53:31 -0500
From:	Chris J Arges <chris.j.arges@...onical.com>
To:	kvm@...r.kernel.org
Cc:	Chris J Arges <chris.j.arges@...onical.com>,
	Gleb Natapov <gleb@...nel.org>,
	Paolo Bonzini <pbonzini@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] KVM: ioapic: add check for RTC_GSI

cppcheck found the following error:
[ioapic.c:114]: (error) Array index -1 is out of bounds.

If CONFIG_X86 is not defined, RTC_GSI == -1U which means that an out of bounds
error could occur when accessing &ioapic->redirtbl[RTC_GSI].

This patch adds a check to kvm_rtc_eoi_tracking_restore_one that is similar to
how kvm_rtc_eoi_tracking_restore_all checks this condition.

Signed-off-by: Chris J Arges <chris.j.arges@...onical.com>
---
 virt/kvm/ioapic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index e8ce34c..859f5b8 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -136,6 +136,9 @@ void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
 {
 	struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic;
 
+	if (RTC_GSI >= IOAPIC_NUM_PINS)
+		return;
+
 	spin_lock(&ioapic->lock);
 	__rtc_irq_eoi_tracking_restore_one(vcpu);
 	spin_unlock(&ioapic->lock);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ