vhost: Fix host panic if ioctl called with wrong index
Subsystems (4)
PATCH 1/1 vhost: Fix host panic if ioctl called with wrong index
From: Krishna Kumar <[email protected]>
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 Krishna Kumar <[email protected]>
--- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +1 -1
@@ -374,7 +374,7 @@ static long vhost_set_vring(struct vhost r =get_user (idx, idxp);if (r <0 )return r; -if (idx > d->nvqs) +if (idx >= d->nvqs)return -ENOBUFS ; vq = d->vqs + idx;
Quoted 6 lines · Krishna Kumar
From: Krishna Kumar <[email protected]>
Missed a boundary value check in
vhost_set_vring. The host panics if idx == nvqs is used in ioctl commands invhost_virtqueue_init.Signed-off-by Krishna Kumar <[email protected]>
Thanks, applied.
Quoted 16 lines
--- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -ruNp
org/drivers/vhost/vhost.cnew/drivers/vhost/vhost.cdrivers/vhost/vhost.c +1
-1@@ -374,7 +374,7 @@ static long vhost_set_vring(struct vhost r =get_user (idx, idxp);if (r <0 )return r; -if (idx > d->nvqs) +if (idx >= d->nvqs)return -ENOBUFS ; vq = d->vqs + idx;