dm: virtio_console: read only when the virtqueue is ready.

The read should not continue if the virtqueue is not ready.

Tracked-On: #5544
Signed-off-by: Jie Deng <jie.deng@intel.com>
This commit is contained in:
Jie Deng 2020-11-24 15:03:07 +08:00 committed by wenlingz
parent 4dbf30fcad
commit 74203e39d9
1 changed files with 1 additions and 1 deletions

View File

@ -461,7 +461,7 @@ virtio_console_backend_read(int fd __attribute__((unused)),
port = be->port;
vq = virtio_console_port_to_vq(port, true);
if (!be->open || !port->rx_ready) {
if (!be->open || !port->rx_ready || !vq_ring_ready(vq)) {
len = read(be->fd, dummybuf, sizeof(dummybuf));
if (len == 0)
goto close;