Buggy PCI drivers - do not mark pci_device_id as discardable data
Subsystems (4)
Guys,
All these drivers are buggy wrt PCI hotplugging/Cardbus/PCI new_id support and are all potential sources of oops dumps. You don't need to have hotplugging enabled to cause your machine to oops with any of these drivers loaded.
The authors of future drivers doing this will be sent home to write 1000 lines, using pen and paper, of: "I will not use __initdata with pci_device_id tables." Printed copies, trick photography, and emails will not be accepted.
(I'm sending Linus a separate patch since I've already sent him the AGP fixes.)
drivers/char/agp/ati-agp.c +1 -1
@@ -491,7 +491,7 @@agp_put_bridge (bridge); } -static struct pci_device_id agp_ati_pci_table[]__initdata = { +static struct pci_device_id agp_ati_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST <<8 ), .class_mask = ~0 ,
drivers/char/agp/sis-agp.c +1 -1
@@ -215,7 +215,7 @@agp_put_bridge (bridge); } -static struct pci_device_id agp_sis_pci_table[]__initdata = { +static struct pci_device_id agp_sis_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST <<8 ), .class_mask = ~0 ,
drivers/char/agp/uninorth-agp.c +1 -1
@@ -350,7 +350,7 @@agp_put_bridge (bridge); } -static struct pci_device_id agp_uninorth_pci_table[]__initdata = { +static struct pci_device_id agp_uninorth_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST <<8 ), .class_mask = ~0 ,
drivers/char/agp/via-agp.c +1 -1
@@ -432,7 +432,7 @@agp_put_bridge (bridge); } -static struct pci_device_id agp_via_pci_table[]__initdata = { +static struct pci_device_id agp_via_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST <<8 ), .class_mask = ~0 ,
drivers/char/watchdog/alim1535_wdt.c +1 -1
@@ -317,7 +317,7 @@* want to register another driver on the same PCI id. */ -static struct pci_device_id ali_pci_tbl[]__initdata = { +static struct pci_device_id ali_pci_tbl[] = { {PCI_VENDOR_ID_AL ,1535 ,PCI_ANY_ID ,PCI_ANY_ID ,}, {0 , }, };
drivers/char/watchdog/amd7xx_tco.c +1 -1
@@ -294,7 +294,7 @@ .fops = &amdtco_fops }; -static struct pci_device_id amdtco_pci_tbl[]__initdata = { +static struct pci_device_id amdtco_pci_tbl[] = {/* AMD 766 PCI_IDs here */ {PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_OPUS_7443 ,PCI_ANY_ID ,PCI_ANY_ID , }, {0 , }
drivers/char/watchdog/i810-tco.c +1 -1
@@ -301,7 +301,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id i810tco_pci_tbl[]__initdata = { +static struct pci_device_id i810tco_pci_tbl[] = { {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AB_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801BA_0 ,PCI_ANY_ID ,PCI_ANY_ID , },
drivers/char/hw_random.c +1 -1
@@ -149,7 +149,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id rng_pci_tbl[]__initdata = { +static struct pci_device_id rng_pci_tbl[] = { {0x1022 ,0x7443 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd }, {0x1022 ,0x746b ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd },
drivers/isdn/hisax/config.c +1 -1
@@ -2113,7 +2113,7 @@#include <linux/pci.h> -static struct pci_device_id hisax_pci_tbl[]__initdata = { +static struct pci_device_id hisax_pci_tbl[] = {#ifdef CONFIG_HISAX_FRITZPCI {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID}, #endif
drivers/isdn/hysdn/hysdn_init.c +1 -1
@@ -21,7 +21,7 @@#include "hysdn_defs.h" -static struct pci_device_id hysdn_pci_tbl[]__initdata = { +static struct pci_device_id hysdn_pci_tbl[] = { {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_METRO }, {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 }, {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_ERGO },
drivers/net/fc/iph5526.c +1 -1
@@ -110,7 +110,7 @@#define ALIGNED_ADDR (addr, len) ((((unsigned long)(addr) + (len - 1)) & ~(len - 1)) - (unsigned long)(addr)) -static struct pci_device_id iph5526_pci_tbl[]__initdata = { +static struct pci_device_id iph5526_pci_tbl[] = { {PCI_VENDOR_ID_INTERPHASE ,PCI_DEVICE_ID_INTERPHASE_5526 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTERPHASE , PCI_DEVICE_ID_INTERPHASE_55x6,PCI_ANY_ID ,PCI_ANY_ID , }, { }/* Terminating entry */
drivers/net/irda/via-ircc.c +1 -1
@@ -121,7 +121,7 @@ } } -static struct pci_device_id via_pci_tbl[]__initdata = { +static struct pci_device_id via_pci_tbl[] = { {PCI_VENDOR_ID_VIA , DeviceID1,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, {PCI_VENDOR_ID_VIA , DeviceID2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,1 }, {PCI_VENDOR_ID_VIA , DeviceID3,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,2 },
drivers/net/skfp/skfddi.c +1 -1
@@ -182,7 +182,7 @@extern void enable_tx_irq (struct s_smc *smc,u_short queue);extern void mac_drv_clear_txd (struct s_smc *smc); -static struct pci_device_id skfddi_pci_tbl[]__initdata = { +static struct pci_device_id skfddi_pci_tbl[] = { {PCI_VENDOR_ID_SK ,PCI_DEVICE_ID_SK_FP ,PCI_ANY_ID ,PCI_ANY_ID , }, { }/* Terminating entry */ };
drivers/net/wan/sdladrv.c +1 -1
@@ -201,7 +201,7 @@* Note: All data must be explicitly initialized!!! */ -static struct pci_device_id sdladrv_pci_tbl[]__initdata = { +static struct pci_device_id sdladrv_pci_tbl[] = { {V3_VENDOR_ID ,V3_DEVICE_ID ,PCI_ANY_ID ,PCI_ANY_ID , }, { }/* Terminating entry */ };
drivers/net/dgrs.c +1 -1
@@ -120,7 +120,7 @@#include "dgrs_asstruct.h" #include "dgrs_bcomm.h" -static struct pci_device_id dgrs_pci_tbl[]__initdata = { +static struct pci_device_id dgrs_pci_tbl[] = { {SE6_PCI_VENDOR_ID ,SE6_PCI_DEVICE_ID ,PCI_ANY_ID ,PCI_ANY_ID , }, { }/* Terminating entry */ };
drivers/net/hp100.c +1 -1
@@ -284,7 +284,7 @@#define HP100_PCI_IDS_SIZE (sizeof(hp100_pci_ids)/sizeof(struct hp100_pci_id)) -static struct pci_device_id hp100_pci_tbl[]__initdata = { +static struct pci_device_id hp100_pci_tbl[] = { {PCI_VENDOR_ID_HP ,PCI_DEVICE_ID_HP_J2585A ,PCI_ANY_ID ,PCI_ANY_ID ,}, {PCI_VENDOR_ID_HP ,PCI_DEVICE_ID_HP_J2585B ,PCI_ANY_ID ,PCI_ANY_ID ,}, {PCI_VENDOR_ID_COMPEX ,PCI_DEVICE_ID_COMPEX_ENET100VG4 ,PCI_ANY_ID ,PCI_ANY_ID ,},
drivers/net/sunhme.c +1 -1
@@ -179,7 +179,7 @@where it could be referenced at any time due to hot plugging, the __initdata reference should be removed. */ -struct pci_device_id happymeal_pci_ids[]__initdata = { +struct pci_device_id happymeal_pci_ids[] = { { .vendor =PCI_VENDOR_ID_SUN , .device =PCI_DEVICE_ID_SUN_HAPPYMEAL ,
drivers/video/i810/i810_main.c +1 -1
@@ -66,7 +66,7 @@"Intel(R) 815 (Internal Graphics with AGP) Framebuffer Device" }; -static struct pci_device_id i810fb_pci_tbl[]__initdata = { +static struct pci_device_id i810fb_pci_tbl[] = { {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82810_IG1 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82810_IG3 ,
Signature · 5 lines
Russell King ([email protected]) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core
drivers/char/watchdog/amd7xx_tco.c line 300
Quoted 11 lines · Russell King
drivers/char/watchdog/amd7xx_tco.c +1
-1@@ -294,7 +294,7 @@ .fops = &amdtco_fops }; -static struct pci_device_id amdtco_pci_tbl[]__initdata = { +static struct pci_device_id amdtco_pci_tbl[] = {/* AMD 766 PCI_IDs here */ {PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_OPUS_7443 ,PCI_ANY_ID ,PCI_ANY_ID , }, {0 , }
That's not a bug.
drivers/char/watchdog/i810-tco.c line 307
Quoted 11 lines
drivers/char/watchdog/i810-tco.c +1
-1@@ -301,7 +301,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id i810tco_pci_tbl[]__initdata = { +static struct pci_device_id i810tco_pci_tbl[] = { {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AB_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801BA_0 ,PCI_ANY_ID ,PCI_ANY_ID , },
Neither is that.
drivers/char/hw_random.c line 154
Quoted 10 lines
drivers/char/hw_random.c +1
-1@@ -149,7 +149,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id rng_pci_tbl[]__initdata = { +static struct pci_device_id rng_pci_tbl[] = { {0x1022 ,0x7443 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd }, {0x1022 ,0x746b ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd },
This too
Quoted 30 lines · Zwane Mwaikambo
drivers/char/watchdog/amd7xx_tco.c line 300
Quoted 11 lines · Russell King
drivers/char/watchdog/amd7xx_tco.c +1
-1@@ -294,7 +294,7 @@ .fops = &amdtco_fops }; -static struct pci_device_id amdtco_pci_tbl[]__initdata = { +static struct pci_device_id amdtco_pci_tbl[] = {/* AMD 766 PCI_IDs here */ {PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_OPUS_7443 ,PCI_ANY_ID ,PCI_ANY_ID , }, {0 , }That's not a bug.
drivers/char/watchdog/i810-tco.c line 307
Quoted 11 lines
drivers/char/watchdog/i810-tco.c +1
-1@@ -301,7 +301,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id i810tco_pci_tbl[]__initdata = { +static struct pci_device_id i810tco_pci_tbl[] = { {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AB_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801BA_0 ,PCI_ANY_ID ,PCI_ANY_ID , },Neither is that.
Quoted 12 lines
drivers/char/hw_random.c line 154
Quoted 10 lines
drivers/char/hw_random.c +1
-1@@ -149,7 +149,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id rng_pci_tbl[]__initdata = { +static struct pci_device_id rng_pci_tbl[] = { {0x1022 ,0x7443 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd }, {0x1022 ,0x746b ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd },This too
They're all bugs, plain and simple. The pci device id tables are scanned *whenever* a new pci device is inserted into the system, or the appropriate numbers are echoed to the "new_id" driver model entry for the driver.
It doesn't matter if the driver doesn't care or not.
Signature · 5 lines
Russell King ([email protected]) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core
Quoted 30 lines · Zwane Mwaikambo
drivers/char/watchdog/amd7xx_tco.c line 300
Quoted 11 lines · Russell King
drivers/char/watchdog/amd7xx_tco.c +1
-1@@ -294,7 +294,7 @@ .fops = &amdtco_fops }; -static struct pci_device_id amdtco_pci_tbl[]__initdata = { +static struct pci_device_id amdtco_pci_tbl[] = {/* AMD 766 PCI_IDs here */ {PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_OPUS_7443 ,PCI_ANY_ID ,PCI_ANY_ID , }, {0 , }That's not a bug.
drivers/char/watchdog/i810-tco.c line 307
Quoted 11 lines
drivers/char/watchdog/i810-tco.c +1
-1@@ -301,7 +301,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id i810tco_pci_tbl[]__initdata = { +static struct pci_device_id i810tco_pci_tbl[] = { {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AB_0 ,PCI_ANY_ID ,PCI_ANY_ID , }, {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801BA_0 ,PCI_ANY_ID ,PCI_ANY_ID , },Neither is that.
Quoted 12 lines
drivers/char/hw_random.c line 154
Quoted 10 lines
drivers/char/hw_random.c +1
-1@@ -149,7 +149,7 @@* register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static struct pci_device_id rng_pci_tbl[]__initdata = { +static struct pci_device_id rng_pci_tbl[] = { {0x1022 ,0x7443 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd }, {0x1022 ,0x746b ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , rng_hw_amd },This too
Ok, I'm happy that this aren't (after reading someone elses explaination).
Having these different makes it hard to ensure that no further bad cases exist in the tree though.
I want this to be foolproof, because its me people bug when their cardbus cards oops when they insert the damned things. If people are happy to ignore this issue, I'm happy to ignore the bug reports.
It basically isn't something I want to deal with, and we need to find a way to stop these stupidities appearing in the first place.
Any ideas?
Signature · 5 lines
Russell King ([email protected]) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core
Quoted 8 lines · Russell King
I want this to be foolproof, because its me people bug when their cardbus cards oops when they insert the damned things. If people are happy to ignore this issue, I'm happy to ignore the bug reports.
It basically isn't something I want to deal with, and we need to find a way to stop these stupidities appearing in the first place.
Any ideas?
You've already got symbols for initdata start and end, just check the pointers in the pci_register code. I guess you want a per platform
BUG_IF_INIT(x)
Quoted 8 lines · Alan Cox
Quoted 7 lines · Russell King
I want this to be foolproof, because its me people bug when their cardbus cards oops when they insert the damned things. If people are happy to ignore this issue, I'm happy to ignore the bug reports.
It basically isn't something I want to deal with, and we need to find a way to stop these stupidities appearing in the first place.
Quoted 6 lines
Quoted 1 line
Any ideas?
You've already got symbols for initdata start and end, just check the pointers in the
pci_registercode. I guess you want a per platform
BUG_IF_INIT(x)
I hacked up something similar, but i'm not sure what to do about modules.
Quoted 8 lines · Alan Cox
Quoted 7 lines · Russell King
I want this to be foolproof, because its me people bug when their cardbus cards oops when they insert the damned things. If people are happy to ignore this issue, I'm happy to ignore the bug reports.
It basically isn't something I want to deal with, and we need to find a way to stop these stupidities appearing in the first place.
Quoted 6 lines
Quoted 1 line
Any ideas?
You've already got symbols for initdata start and end, just check the pointers in the
pci_registercode. I guess you want a per platform
BUG_IF_INIT(x)
That would work for built-in drivers. We could couple that with an idea Kai came up with (in private mail) to catch them in modpost. However, the problem with modpost is that it gets false positives for these drivers which explicitly want to discard their module device id tables.
As we currently stand, there seem to be only four drivers which want to discard their driver id tables. Is it really worth adding extra code to the kernel to try to trap these, or just not mark the device id tables with __initdata or __devinitdata and detect the bad guys with a grep?
Signature · 5 lines
Russell King ([email protected]) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core
drivers/char/agp/ati-agp.c line 494
Quoted 2 lines · Russell King
drivers/char/agp/ati-agp.c +1
-1-static struct pci_device_id agp_ati_pci_table[]__initdata = { +static struct pci_device_id agp_ati_pci_table[] = {
Wierd. I could swear akpm had these patches in his tree no so long back.
Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 5 lines · Dave Jones
drivers/char/agp/ati-agp.c line 494
Quoted 2 lines · Russell King
drivers/char/agp/ati-agp.c +1
-1-static struct pci_device_id agp_ati_pci_table[]__initdata = { +static struct pci_device_id agp_ati_pci_table[] = {Wierd. I could swear akpm had these patches in his tree no so long back.
So did I, so I checked the history in bk, and it seems it never made Linus' tree.
Signature · 5 lines
Russell King ([email protected]) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core