Patchwork [Oneiric/Precise/Quantal,CVE-2013-0311,1/1] vhost: fix length for cross region descriptor

login
register
mail settings
Submitter Luis Henriques
Date Feb. 21, 2013, 7:08 p.m.
Message ID <1361473680-18720-1-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/222403/
State New
Headers show

Comments

Luis Henriques - Feb. 21, 2013, 7:08 p.m.
From: "Michael S. Tsirkin" <mst@redhat.com>

CVE-2013-0311

BugLink: http://bugs.launchpad.net/bugs/1130951

If a single descriptor crosses a region, the
second chunk length should be decremented
by size translated so far, instead it includes
the full descriptor length.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bd97120fc3d1a11f3124c7c9ba1d91f51829eb85)

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Tim Gardner - Feb. 21, 2013, 7:45 p.m.

Patch

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 61047fe..e3fac28 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -986,7 +986,7 @@  static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
 		}
 		_iov = iov + ret;
 		size = reg->memory_size - addr + reg->guest_phys_addr;
-		_iov->iov_len = min((u64)len, size);
+		_iov->iov_len = min((u64)len - s, size);
 		_iov->iov_base = (void __user *)(unsigned long)
 			(reg->userspace_addr + addr - reg->guest_phys_addr);
 		s += size;