From a3401138f7cc7a32eb9a4ac7a2700fc0d7a6f557 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin <markmc@redhat.com> Date: Wed, 1 Jul 2009 23:13:18 +0100 Subject: [PATCH 3/4] Fix ne2k_pci segfault during live migrate after NIC hot-unplug https://bugzilla.redhat.com/500977 ne2k_pci registers a savevm handler which is not removed when the NIC is hot-unplugged. This patch just cherry-picks ne2k_pci bits from: http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commitdiff;h=a34b6eb776 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Message-Id: <1246486398.598.95.camel@blaa> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Bugzilla: 500977 RH-Upstream-status: applied Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Don Dutile <ddutile@redhat.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> --- qemu/hw/ne2000.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/qemu/hw/ne2000.c b/qemu/hw/ne2000.c index d24c547..e69b5ca 100644 --- a/qemu/hw/ne2000.c +++ b/qemu/hw/ne2000.c @@ -779,6 +779,13 @@ static void ne2000_map(PCIDevice *pci_dev, int region_num, register_ioport_read(addr + 0x1f, 1, 1, ne2000_reset_ioport_read, s); } +static void ne2000_cleanup(VLANClientState *vc) +{ + NE2000State *s = vc->opaque; + + unregister_savevm("ne2000", s); +} + PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) { PCINE2000State *d; @@ -812,6 +819,7 @@ PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, ne2000_receive, ne2000_can_receive, s); nd->vc = s->vc; + s->vc->cleanup = ne2000_cleanup; qemu_format_nic_info_str(s->vc, s->macaddr); -- 1.6.3.rc4.29.g8146