diff mbox

KVM: Enhance the coalesced_mmio_write() parameter to avoid stack buffer overflow

Message ID 20100412015714.GA2815@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

wzt wzt April 12, 2010, 1:57 a.m. UTC
None
diff mbox

Patch

diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index c0dcfb7..eb4601c 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -61,6 +61,10 @@  static int coalesced_mmio_write(struct kvm_io_device *this,
 {
 	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
 	struct kvm_coalesced_mmio_ring *ring = dev->kvm->coalesced_mmio_ring;
+
+	if (len < 0)
+		return -EOPNOTSUPP;
+
 	if (!coalesced_mmio_in_range(dev, addr, len))
 		return -EOPNOTSUPP;