Bug 10534 - seg fault in xf86scanpci
Summary: seg fault in xf86scanpci
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-05 10:50 UTC by Daniel Yeisley
Modified: 2007-06-28 14:00 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Don't allow xf86MaxPciDevs to exceed MAX_PCI_DEVICES. (561 bytes, patch)
2007-04-05 10:53 UTC, Daniel Yeisley
no flags Details | Splinter Review

Description Daniel Yeisley 2007-04-05 10:50:52 UTC
I'm seeing a seg fault in xf86scanpci.  The problem is because the pci_devp array is defined to have MAX_PCI_DEVICES + 1 elements at compile time.  But, at run time, the variable xf86MaxPciDevs is set to the actual number of buses in the system.  If there are more than 128 buses, the array bounds are exceeded and a seg fault occurs.
Comment 1 Daniel Yeisley 2007-04-05 10:53:07 UTC
Created attachment 9484 [details] [review]
Don't allow xf86MaxPciDevs to exceed MAX_PCI_DEVICES.

I've tested this patch on an x86_64 system, but I believe we are seeing the same problem on IA64.
Comment 2 Adam Jackson 2007-05-30 13:01:56 UTC
That's not the right fix.  The right fix is to allocate that array dynamically.  (Otherwise, if the VGA device is not in the first 128 or however many, then X still won't start.)

I have a patch for this, will attach it shortly.
Comment 3 Daniel Yeisley 2007-05-30 13:20:19 UTC
(In reply to comment #2)
> I have a patch for this, will attach it shortly.

Sounds great!

I'm not real familiar with how X works so I was wondering why it needs to store info for every PCI device in the system.    
Comment 4 Adam Jackson 2007-06-28 14:00:03 UTC
Actually, already applied to git master as commits d322608dc929d5f8cda07a53143a4f28423e0460 and 8a06ff9ffa4816d192e58e43e7fe569b97b4dd7c.  Sorry for the lag in the response.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.