2.6.x kernels & PCI-to-PCMCIA bridges [again]

Russell King rmk+pcmcia at arm.linux.org.uk
Tue May 11 10:10:20 BST 2004


On Sat, May 08, 2004 at 09:52:27AM +0900, komujun at nifty.com wrote:
> >3. sockets[] is a global static array.  If we ever encounter a machine
> >   which has two PCI device/functions whose device/vendor IDs are matched
> >   by this driver, we will overwrite this array. *BAD*.
> 
> If two PD6729 is installed in a machine,
> two PD6729 driver will be loaded.

Wrong.  You can only load one instance of any particular driver.

In fact, what will happen is that your drivers ->probe method will be
called a _second_ time - once for the first device and again for the
second device.

When this happens, your static data for the first device will be
overwritten, possibly leading to a kernel oops at some point later,
as well as the obvious memory leak and non-functioning first device.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core



More information about the linux-pcmcia mailing list