diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-03-27 06:53:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-14 09:42:18 -0400 |
commit | 57962c47ce49c5db9f719b8f2700f8034d54795e (patch) | |
tree | c12078e07008418efdc797748f51b38087e40f9e | |
parent | f78f1512ec2a6fca1ffd98c5b95757ec62be1389 (diff) |
vhost: validate vhost_get_vq_desc return value
[ Upstream commit a39ee449f96a2cd44ce056d8a0a112211a9b1a1f ]
vhost fails to validate negative error code
from vhost_get_vq_desc causing
a crash: we are using -EFAULT which is 0xfffffff2
as vector size, which exceeds the allocated size.
The code in question was introduced in commit
8dd014adfea6f173c1ef6378f7e5e7924866c923
vhost-net: mergeable buffers support
CVE-2014-0055
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/vhost/net.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 262842fd6635..c7fdabd0e5d3 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -513,9 +513,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, | |||
513 | r = -ENOBUFS; | 513 | r = -ENOBUFS; |
514 | goto err; | 514 | goto err; |
515 | } | 515 | } |
516 | d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, | 516 | r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, |
517 | ARRAY_SIZE(vq->iov) - seg, &out, | 517 | ARRAY_SIZE(vq->iov) - seg, &out, |
518 | &in, log, log_num); | 518 | &in, log, log_num); |
519 | if (unlikely(r < 0)) | ||
520 | goto err; | ||
521 | |||
522 | d = r; | ||
519 | if (d == vq->num) { | 523 | if (d == vq->num) { |
520 | r = 0; | 524 | r = 0; |
521 | goto err; | 525 | goto err; |