diff options
author | Chris Wright <chrisw@sous-sol.org> | 2008-04-21 16:02:48 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-01 09:47:14 -0500 |
commit | aff427a1ca09945082a4ec21aee2960306800fb0 (patch) | |
tree | 9aa24e8dbc09dc035a99e034c0347d2c7da3c919 /hw/rtl8139.c | |
parent | Fix serial option with -drive (diff) | |
download | qemu-kvm-aff427a1ca09945082a4ec21aee2960306800fb0.tar.gz qemu-kvm-aff427a1ca09945082a4ec21aee2960306800fb0.tar.bz2 qemu-kvm-aff427a1ca09945082a4ec21aee2960306800fb0.zip |
Pci nic: pci_register_device can fail
The pci_register_device() call in PCI nic initialization routines can
fail. Handle this failure and propagate a meaningful error message to
the user instead of generating a SEGV.
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 0093ff4a9..19c7623c5 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3451,7 +3451,11 @@ PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) "RTL8139", sizeof(PCIRTL8139State), devfn, NULL, NULL); + if (!d) + return NULL; + d->dev.unregister = pci_rtl8139_uninit; + pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139); |