mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
vhost: validate vhost_get_vq_desc return value
[ Upstream commita39ee449f9] 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 commit8dd014adfevhost-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: Kamal Mostafa <kamal@canonical.com>
This commit is contained in:
committed by
Kamal Mostafa
parent
f936659d48
commit
e75d342baa
@@ -435,9 +435,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
|
||||
r = -ENOBUFS;
|
||||
goto err;
|
||||
}
|
||||
d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
|
||||
r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
|
||||
ARRAY_SIZE(vq->iov) - seg, &out,
|
||||
&in, log, log_num);
|
||||
if (unlikely(r < 0))
|
||||
goto err;
|
||||
|
||||
d = r;
|
||||
if (d == vq->num) {
|
||||
r = 0;
|
||||
goto err;
|
||||
|
||||
Reference in New Issue
Block a user