Skip to content

Commit

Permalink
virtio_console: fix uninitialized variable use
Browse files Browse the repository at this point in the history
We try to disable callbacks on c_ivq even without multiport
even though that vq is not initialized in this configuration.

Fixes: c743d09 ("virtio: console: Disable callbacks for virtqueues at start of S4 freeze")
Suggested-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Apr 7, 2017
1 parent fe36cbe commit 2055997
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -2202,14 +2202,16 @@ static int virtcons_freeze(struct virtio_device *vdev)

vdev->config->reset(vdev);

virtqueue_disable_cb(portdev->c_ivq);
if (use_multiport(portdev))
virtqueue_disable_cb(portdev->c_ivq);
cancel_work_sync(&portdev->control_work);
cancel_work_sync(&portdev->config_work);
/*
* Once more: if control_work_handler() was running, it would
* enable the cb as the last step.
*/
virtqueue_disable_cb(portdev->c_ivq);
if (use_multiport(portdev))
virtqueue_disable_cb(portdev->c_ivq);
remove_controlq_data(portdev);

list_for_each_entry(port, &portdev->ports, list) {
Expand Down

0 comments on commit 2055997

Please sign in to comment.