From patchwork Thu Feb 21 19:08:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 222403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B7DEB2C0295 for ; Fri, 22 Feb 2013 06:08:14 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U8bUx-0005Zj-LD; Thu, 21 Feb 2013 19:08:03 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U8bUw-0005Ze-4x for kernel-team@lists.ubuntu.com; Thu, 21 Feb 2013 19:08:02 +0000 Received: from bl20-126-215.dsl.telepac.pt ([2.81.126.215] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1U8bUv-0004YS-Ns for kernel-team@lists.ubuntu.com; Thu, 21 Feb 2013 19:08:01 +0000 From: Luis Henriques To: kernel-team@lists.ubuntu.com Subject: [Oneiric/Precise/Quantal CVE-2013-0311 1/1] vhost: fix length for cross region descriptor Date: Thu, 21 Feb 2013 19:08:00 +0000 Message-Id: <1361473680-18720-1-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: "Michael S. Tsirkin" 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 Acked-by: Jason Wang Signed-off-by: David S. Miller (cherry picked from commit bd97120fc3d1a11f3124c7c9ba1d91f51829eb85) Signed-off-by: Luis Henriques --- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;