Commit 047b9b94 authored by Heinz Graalfs's avatar Heinz Graalfs Committed by Rusty Russell

virtio_net: verify if queue is broken after virtqueue_get_buf()

If a virtqueue_get_buf() call returns a NULL pointer a possibly endless while
loop should be avoided by checking for a broken virtqueue.
Signed-off-by: default avatarHeinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 40e4dc53
...@@ -825,7 +825,8 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, ...@@ -825,7 +825,8 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
/* Spin for a response, the kick causes an ioport write, trapping /* Spin for a response, the kick causes an ioport write, trapping
* into the hypervisor, so the request should be handled immediately. * into the hypervisor, so the request should be handled immediately.
*/ */
while (!virtqueue_get_buf(vi->cvq, &tmp)) while (!virtqueue_get_buf(vi->cvq, &tmp) &&
!virtqueue_is_broken(vi->cvq))
cpu_relax(); cpu_relax();
return status == VIRTIO_NET_OK; return status == VIRTIO_NET_OK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment