Bug 524022

Summary: qemu's pci_add monitor command should not exit() if the NIC model is not valid
Product: [Fedora] Fedora Reporter: Vladimir Benes <vbenes>
Component: qemuAssignee: Glauber Costa <gcosta>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: berrange, crobinso, dwmw2, gcosta, hbrock, itamar, jaswinder, jforbes, markmc, quintela, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-28 12:46:21 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 498969    
Attachments:
Description Flags
virt-manager.log none

Description Vladimir Benes 2009-09-17 12:05:34 EDT
Description of problem:
when I attach network device then detach it and then attach it again virtual guest goes down with this message in /var/log/libvirt/qemu/$guest.log:
char device redirected to /dev/pts/0
qemu: Unsupported NIC model: �c��
qemu: Supported NIC models: 
ne2k_pci,i82551,i82557b,i82559er,rtl8139,e1000,pcnet,virtio


Version-Release number of selected component (if applicable):
qemu-kvm-0.10.92-4.fc12.x86_64
qemu-common-0.10.92-4.fc12.x86_64
qemu-system-x86-0.10.92-4.fc12.x86_64
qemu-kvm-tools-0.10.92-4.fc12.x86_64
qemu-img-0.10.92-4.fc12.x86_64

libvirt-0.7.1-4.fc12.x86_64
virt-viewer-0.2.0-1.fc12.x86_64
libvirt-client-0.7.1-4.fc12.x86_64
virt-manager-0.8.0-3.fc12.noarch
virt-top-1.0.3-5.fc12.x86_64
python-virtinst-0.500.0-2.fc12.noarch
libvirt-python-0.7.1-4.fc12.x86_64
virt-mem-0.3.1-9.fc12.x86_64

kernel-2.6.31-14.fc12.x86_64

How reproducible:


Steps to Reproduce:
1.install virt guest and delete all NIC devices
2.power on guest
3.attach new NIC (NAT type)
4.detach that NIC again
5.attach that NIC again
  
Actual results:
guest is stopped with this question:

Are you sure you want to add this device?

This device could not be attached to the running machine. Would you like to make the device available after the next VM shutdown?

Warning: this will overwrite any other changes that require a VM reboot.

Expected results:
guest still running and NIC attached again

Additional info:
Comment 1 Vladimir Benes 2009-09-17 12:07:33 EDT
Created attachment 361520 [details]
virt-manager.log
Comment 2 Mark McLoughlin 2009-09-17 12:36:27 EDT
This looks like two issues with qemu:

  1) When not passed a model and you do pci_add/pci_del/pci_add with no
     model= parameter, it seems to get the parameters confused

  2) It exits when you pass an invalid model= via pci_add rather than
     just printing an error
Comment 3 Glauber Costa 2009-09-17 16:30:04 EDT
This is a trivial use-after-free bug.

I've just sent a patch upstream
Comment 4 Mark McLoughlin 2009-09-18 08:13:09 EDT
Patch is here:

http://lists.gnu.org/archive/html/qemu-devel/2009-09/msg01196.html

Still need to fix (2), though
Comment 5 Mark McLoughlin 2009-09-23 07:33:40 EDT
Patch applied in rawhide now, thanks

* Wed Sep 23 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10.92-5
- Fix issue causing NIC hotplug confusion when no model is specified (#524022)

Leaving it open to fix the other issue
Comment 6 Mark McLoughlin 2009-09-28 12:46:21 EDT
Should be fixed in rawhide now thanks to a cherry-pick from Markus's series here:

  http://lists.gnu.org/archive/html/qemu-devel/2009-09/threads.html#01585

* Mon Sep 28 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-2
- Fix pci hotplug to not exit if supplied an invalid NIC model (#524022)