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 1399260 - USB slots out of range are accepted by libvirt
Summary: USB slots out of range are accepted by libvirt
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Pei Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-28 16:24 UTC by Ján Tomko
Modified: 2017-08-01 23:59 UTC (History)
5 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:19:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Ján Tomko 2016-11-28 16:24:52 UTC
Description of problem:
USB slots out of range are accepted by libvirt

Version-Release number of selected component (if applicable):
libvirt-daemon-2.0.0-10.el7.x86_64

How reproducible:
100 %

Steps to Reproduce:
1. Define a domain referencing a non-existent USB port:
$ virsh define /dev/stdin <<EOF
<domain type='kvm'>
  <name>port_out_of_range</name>
  <memory unit='MiB'>512</memory>
  <vcpu>1</vcpu>
  <os>
    <type machine='pc'>hvm</type>
  </os>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0' model='piix3-uhci'/>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='7'/>
    </input>
  </devices>
</domain>
EOF

Actual results:
Domain port_out_of_range defined from /dev/stdin

Expected results:
An error is reported.

Additional info:
Starting this domain fails:
$ virsh start port_out_of_range
error: Failed to start domain port_out_of_range
error: internal error: process exited while connecting to monitor: 2016-11-28T16:23:27.731597Z qemu-kvm: -device usb-tablet,id=input0,bus=usb.0,port=7: usb port 7 (bus usb.0) not found (in use?)

Comment 1 Ján Tomko 2016-11-28 16:52:19 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2016-November/msg01395.html

Comment 2 Ján Tomko 2016-11-30 10:11:56 UTC
Pushed upstream:
commit 2650d5e1f5f8712cc8bf83ddf1bd2abcfb312259
Author:     Ján Tomko <jtomko>
CommitDate: 2016-11-30 10:59:01 +0100

    qemu: error out on USB ports out of range
    
    My overly sophisticated address reservation code forgot
    to add an error message for user-requested ports out of range.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1399260

git describe: v2.5.0-rc1-9-g2650d5e

Comment 4 Pei Zhang 2017-05-11 05:42:16 UTC
Version :
libvirt-3.2.0-3.el7.x86_64
qemu-kvm-rhev-2.9.0-2.el7.x86_64

Steps :
Test with different USB controllers: piix3-uhci, companion controllers; nec-xhci.
   
1. Define a domain
edit vm and add an USB device with port out of range.

# virsh edit r74
error: XML error: requested USB port 10 not present on USB bus 0
Failed. Try again? [y,n,i,f,?]: 

2. Define and start a guest.

# virsh list 
 Id    Name                           State
----------------------------------------------------
 1     r74                            running

Attach an usb device with port out of range. 

# cat udisk.xml 
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/raw.img'/>
      <backingStore/>
	<target dev='sde' bus='usb'/>
	<address type='usb' bus='0' port='10'/>
    </disk>


# virsh attach-device r74 udisk.xml 
error: Failed to attach device from udisk.xml
error: XML error: requested USB port 10 not present on USB bus 0

# virsh attach-device r74 udisk.xml --config
error: Failed to attach device from udisk.xml
error: XML error: requested USB port 10 not present on USB bus 0

As above, move this bug to verified.

Comment 5 Pei Zhang 2017-05-11 06:17:48 UTC
Sorry for pasting the wrong version. 

Verified with version :
libvirt-3.2.0-4.el7.x86_64
qemu-kvm-rhev-2.9.0-3.el7.x86_64

Comment 6 errata-xmlrpc 2017-08-01 17:19:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 7 errata-xmlrpc 2017-08-01 23:59:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846


Note You need to log in before you can comment on or make changes to this bug.