Skip to content

Commit

Permalink
virtio: console: Check if port is valid in resize_console
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amit Shah authored and Michael S. Tsirkin committed Mar 22, 2010
1 parent ec64213 commit 2de16a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2de16a4

Please sign in to comment.