提交 0f3d9a17 编写于 作者: K Krishna Kumar 提交者: Michael S. Tsirkin

vhost: Fix host panic if ioctl called with wrong index

Missed a boundary value check in vhost_set_vring. The host panics if
idx == nvqs is used in ioctl commands in vhost_virtqueue_init.
Signed-off-by: NKrishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 8a74ad60
......@@ -374,7 +374,7 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
r = get_user(idx, idxp);
if (r < 0)
return r;
if (idx > d->nvqs)
if (idx >= d->nvqs)
return -ENOBUFS;
vq = d->vqs + idx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册