aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Gusev <gusev.vitaliy@gmail.com>2022-10-23 18:47:56 +0000
committerMark Johnston <markj@FreeBSD.org>2022-10-23 18:50:43 +0000
commit3b5e5ce87bc885f35100d77b31ac81d3f98342bf (patch)
tree6be39c96ce8dcfd1f9d7cc085669d1718611fd89
parentfdd95483332bf7fab36e2562d570a9a914a19769 (diff)
bhyve: Handle snapshots of unconfigured virtio-net devices
In case of device reset or not configured - features_negotiated is not set, calling calling pci_vtnet_neg_features is wrong and resume gets "Segmentation fault". Reviewed by: markj Sponsored by: vStack MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36244
-rw-r--r--usr.sbin/bhyve/pci_virtio_net.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c
index 43e559b650c1..85fa09ca194b 100644
--- a/usr.sbin/bhyve/pci_virtio_net.c
+++ b/usr.sbin/bhyve/pci_virtio_net.c
@@ -786,9 +786,11 @@ pci_vtnet_snapshot(void *vsc, struct vm_snapshot_meta *meta)
*/
SNAPSHOT_VAR_OR_LEAVE(sc->vsc_features, meta, ret, done);
+ SNAPSHOT_VAR_OR_LEAVE(sc->features_negotiated, meta, ret, done);
/* Force reapply negociated features at restore time */
- if (meta->op == VM_SNAPSHOT_RESTORE) {
+ if (meta->op == VM_SNAPSHOT_RESTORE &&
+ sc->features_negotiated) {
pci_vtnet_neg_features(sc, sc->vsc_features);
netbe_rx_enable(sc->vsc_be);
}