1
0
Fork 0

virtio: console: Check if port is valid in resize_console

The console port could have been hot-unplugged. Check if it is valid
before working on it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hifive-unleashed-5.1
Amit Shah 2010-03-19 17:36:44 +05:30 committed by Michael S. Tsirkin
parent ec64213c4d
commit 2de16a493c
1 changed files with 4 additions and 0 deletions

View File

@ -681,6 +681,10 @@ static void resize_console(struct port *port)
struct virtio_device *vdev;
struct winsize ws;
/* The port could have been hot-unplugged */
if (!port)
return;
vdev = port->portdev->vdev;
if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
vdev->config->get(vdev,