Skip to content

Commit

Permalink
virtio_net: Fix error handling in virtnet_restore()
Browse files Browse the repository at this point in the history
Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210517084516.332-1-xieyongji@bytedance.com
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
YongjiXie authored and mstsirkin committed Jul 3, 2021
1 parent b71ba22 commit 3f2869c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -3310,8 +3310,11 @@ static __maybe_unused int virtnet_restore(struct virtio_device *vdev)
virtnet_set_queues(vi, vi->curr_queue_pairs);

err = virtnet_cpu_notif_add(vi);
if (err)
if (err) {
virtnet_freeze_down(vdev);
remove_vq_common(vi);
return err;
}

return 0;
}
Expand Down

0 comments on commit 3f2869c

Please sign in to comment.