Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2019701

Summary: libvirt crash when "virsh nodedev-define" with wrong formatted <uuid> in xml
Product: Red Hat Enterprise Linux 9 Reporter: zhentang <zhetang>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: pkrempa, virt-maint
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-03 08:12:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhentang 2021-11-03 07:52:07 UTC
Description of problem:
libvirt crash when "virsh nodedev-define" with wrong formatted <uuid> in xml 

Version-Release number of selected component (if applicable):
libvirt-7.8.0-1.el9
qemu-kvm-6.1.0-6.el9

How reproducible:
100%

Steps to Reproduce:
1.prepare a xml file for define mdev device with an invalid uuid
#vi mdev.xml
<device>
  <name>mdev_4187c971_5830_4a17_aed7_b1410c7eb63a_0000_5b_00_0</name>
  <parent>computer</parent>
  <capability type='mdev'>
    <type id='nvidia-262'/>
    <uuid>4187aed7-b1410c7eb63a</uuid>
    <iommuGroup number='0'/>
  </capability>
</device>



2.try to define the device
# virsh nodedev-define md.xml 
error: Disconnected from qemu:///system due to end of file
error: Failed to define node device from 'md.xml'
error: End of file while reading data: Input/output error

Error message in /var/log/libvirt/libvirtd.log 
"2021-11-03 07:42:13.601+0000: 18508: error : virNodeDevCapMdevParseXML:1924 : internal error: Invalid uuid '4187aed7-b1410c7eb63a' for new mdev device"


3.

Actual results:
device define failed and libvirt crash 

Expected results:
output error message like "error: internal error: malformed uuid element" when device define failed

Additional info:

Comment 1 Peter Krempa 2021-11-03 08:12:05 UTC
This is the same root cause as https://bugzilla.redhat.com/show_bug.cgi?id=2014139 . The parser returns a NULL object if the XML is invalid and then we tried to invoke the post-parse callbacks.

*** This bug has been marked as a duplicate of bug 2014139 ***