|
|
6676648 |
Bugzilla: 1081503
|
|
|
6676648 |
Upstream-status: Sent to netdev
|
|
|
6676648 |
|
|
|
6676648 |
From patchwork Thu Mar 27 10:53:37 2014
|
|
|
6676648 |
Content-Type: text/plain; charset="utf-8"
|
|
|
6676648 |
MIME-Version: 1.0
|
|
|
6676648 |
Content-Transfer-Encoding: 7bit
|
|
|
6676648 |
Subject: [net] vhost: validate vhost_get_vq_desc return value
|
|
|
6676648 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
6676648 |
X-Patchwork-Id: 334291
|
|
|
6676648 |
Message-Id: <1395917517-30937-1-git-send-email-mst@redhat.com>
|
|
|
6676648 |
To: linux-kernel@vger.kernel.org
|
|
|
6676648 |
Cc: kvm@vger.kernel.org, virtio-dev@lists.oasis-open.org,
|
|
|
6676648 |
virtualization@lists.linux-foundation.org, netdev@vger.kernel.org,
|
|
|
6676648 |
David Miller <davem@davemloft.net>, Jason Wang <jasowang@redhat.com>
|
|
|
6676648 |
Date: Thu, 27 Mar 2014 12:53:37 +0200
|
|
|
6676648 |
|
|
|
6676648 |
vhost fails to validate negative error code
|
|
|
6676648 |
from vhost_get_vq_desc causing
|
|
|
6676648 |
a crash: we are using -EFAULT which is 0xfffffff2
|
|
|
6676648 |
as vector size, which exceeds the allocated size.
|
|
|
6676648 |
|
|
|
6676648 |
The code in question was introduced in commit
|
|
|
6676648 |
8dd014adfea6f173c1ef6378f7e5e7924866c923
|
|
|
6676648 |
vhost-net: mergeable buffers support
|
|
|
6676648 |
|
|
|
6676648 |
CVE-2014-0055
|
|
|
6676648 |
|
|
|
6676648 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
6676648 |
|
|
|
6676648 |
---
|
|
|
6676648 |
This is needed in -stable.
|
|
|
6676648 |
|
|
|
6676648 |
drivers/vhost/net.c | 6 +++++-
|
|
|
6676648 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
6676648 |
|
|
|
6676648 |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
|
|
|
6676648 |
index 026be58..e1e22e0 100644
|
|
|
6676648 |
--- a/drivers/vhost/net.c
|
|
|
6676648 |
+++ b/drivers/vhost/net.c
|
|
|
6676648 |
@@ -505,9 +505,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
|
|
|
6676648 |
r = -ENOBUFS;
|
|
|
6676648 |
goto err;
|
|
|
6676648 |
}
|
|
|
6676648 |
- d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
|
|
|
6676648 |
+ r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
|
|
|
6676648 |
ARRAY_SIZE(vq->iov) - seg, &out,
|
|
|
6676648 |
&in, log, log_num);
|
|
|
6676648 |
+ if (unlikely(r < 0))
|
|
|
6676648 |
+ goto err;
|
|
|
6676648 |
+
|
|
|
6676648 |
+ d = r;
|
|
|
6676648 |
if (d == vq->num) {
|
|
|
6676648 |
r = 0;
|
|
|
6676648 |
goto err;
|