Bug 164628 - pci_scan_device can cause master abort
pci_scan_device can cause master abort
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Kimball Murray
Brian Brock
:
Depends On:
Blocks: 156322
  Show dependency treegraph
 
Reported: 2005-07-29 10:25 EDT by Kimball Murray
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHSA-2005-514
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-05 09:46:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kimball Murray 2005-07-29 10:25:08 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
pci_scan_device reads the header type from configuration space before checking if a valid vendor id can be read.  The vendor id should be read first to verify that a particular pci function exists.  Only after a valid vendor id is found should software then read other configuration registers. Failing to adhere to this order causes a master abort, which may be detected and reported on platforms whose pci bridges have that reporting capability.

Version-Release number of selected component (if applicable):
kernel-2.6.9-11

How reproducible:
Always

Steps to Reproduce:
1. Turn on error reporting in the pci bridge
2. insert a dual-port gigabit card in a pci hotplug slot
3. bringup the card using pci_scan_slot.
  

Actual Results:  bridge detects master abort from function 2 of the hotplug slot.  Function 2 does not exist.

Expected Results:  pci_scan_device should have returned from scanning function 2 without having read anything but vendor/device id.

Additional info:

This bug has been fixed upstream already.
Comment 1 Kimball Murray 2005-07-29 10:31:00 EDT
Suggested fix:

--- linux-2.6.9/drivers/pci/probe.c     2005-06-24 13:01:57.000000000 -0400
+++ /root/cvs/stratus/kernel-2.6.9/linux-2.6.9/drivers/pci/probe.c     
2005-07-29 09:48:10.000000000 -0400
@@ -590,9 +590,6 @@
        u32 l;
        u8 hdr_type;

-       if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
-               return NULL;
-
        if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l))
                return NULL;

@@ -601,6 +598,9 @@
            l == 0x0000ffff || l == 0xffff0000)
                return NULL;

+       if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
+               return NULL;
+
        dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
        if (!dev)
                return NULL;
Comment 6 Red Hat Bugzilla 2005-10-05 09:46:30 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-514.html

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