diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2017-03-29 16:22:04 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-04-07 09:39:00 -0400 |
commit | 2055997f983c6db7b5c3940ce5f8f822657d5bc3 (patch) | |
tree | 3cff42099d23a1fe28d45c1ef86e0ff524b99ead | |
parent | fe36cbe0671e868cbd2f534a50ac60273fa5acf2 (diff) |
virtio_console: fix uninitialized variable use
We try to disable callbacks on c_ivq even without multiport
even though that vq is not initialized in this configuration.
Fixes: c743d09dbd01 ("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>
-rw-r--r-- | drivers/char/virtio_console.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e9b7e0b3cabe..87fe111d0be6 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -2202,14 +2202,16 @@ static int virtcons_freeze(struct virtio_device *vdev) | |||
2202 | 2202 | ||
2203 | vdev->config->reset(vdev); | 2203 | vdev->config->reset(vdev); |
2204 | 2204 | ||
2205 | virtqueue_disable_cb(portdev->c_ivq); | 2205 | if (use_multiport(portdev)) |
2206 | virtqueue_disable_cb(portdev->c_ivq); | ||
2206 | cancel_work_sync(&portdev->control_work); | 2207 | cancel_work_sync(&portdev->control_work); |
2207 | cancel_work_sync(&portdev->config_work); | 2208 | cancel_work_sync(&portdev->config_work); |
2208 | /* | 2209 | /* |
2209 | * Once more: if control_work_handler() was running, it would | 2210 | * Once more: if control_work_handler() was running, it would |
2210 | * enable the cb as the last step. | 2211 | * enable the cb as the last step. |
2211 | */ | 2212 | */ |
2212 | virtqueue_disable_cb(portdev->c_ivq); | 2213 | if (use_multiport(portdev)) |
2214 | virtqueue_disable_cb(portdev->c_ivq); | ||
2213 | remove_controlq_data(portdev); | 2215 | remove_controlq_data(portdev); |
2214 | 2216 | ||
2215 | list_for_each_entry(port, &portdev->ports, list) { | 2217 | list_for_each_entry(port, &portdev->ports, list) { |