Skip to contentSkip to conversation

PCI: fix hotplug double free

PATCH New Greg KH 4 participants 17 messages Mar 4, 2005 – Mar 28, 2005 1 message not in the archive PCI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Greg KH

author
#1 lore raw

PCI: remove pci_find_device usage from pci sysfs code.

ChangeSet 1.1998.11.23, 2005/02/25 08:26:11-08:00, [email protected]

PCI: remove pci_find_device usage from pci sysfs code.

 drivers/pci/pci-sysfs.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +1 -1
diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
@@ -481,7 +481,7 @@
 	struct pci_dev *pdev = NULL;
 	
 	sysfs_initialized = 1;
-	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
+	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
 		pci_create_sysfs_dev_files(pdev);
 
 	return 0;
author
#2 lore raw

PATCH 1/1 PCI: Apple PCI IDs update

ChangeSet 1.1998.11.24, 2005/02/25 14:36:10-08:00, [email protected]

[PATCH] PCI: Apple PCI IDs update

please sent that to Andrew/Linus in your next batch for after 2.6.11, those new IDs will be needed for support of the new iMac G5.

The changes to pci.ids match the changes already submitted to the web database.

From: Benjamin Herrenschmidt <[email protected]>

 include/linux/pci_ids.h |    3 +++
 1 files changed, 3 insertions(+)
include/linux/pci_ids.h +3 -0
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
@@ -862,6 +862,9 @@
 #define PCI_DEVICE_ID_APPLE_KEYLARGO_I	0x003e
 #define PCI_DEVICE_ID_APPLE_K2_ATA100	0x0043
 #define PCI_DEVICE_ID_APPLE_K2_GMAC	0x004c
+#define PCI_DEVICE_ID_APPLE_SH_ATA      0x0050
+#define PCI_DEVICE_ID_APPLE_SH_SUNGEM   0x0051
+#define PCI_DEVICE_ID_APPLE_SH_FW       0x0052
 #define PCI_DEVICE_ID_APPLE_TIGON3	0x1645
 
 #define PCI_VENDOR_ID_YAMAHA		0x1073
author
#3 lore raw

PATCH 1/1 PCI: tone down pci=routeirq message

ChangeSet 1.1998.11.25, 2005/02/25 15:47:53-08:00, [email protected]

[PATCH] PCI: tone down pci=routeirq message

From: Bjorn Helgaas <[email protected]>

Tone down the message about using "pci=routeirq". I do still get a few reports, but most are now prompted just by the fact that my email address appears in dmesg in an "error-type" message.

 arch/i386/pci/acpi.c |   17 ++++-------------
 arch/ia64/pci/pci.c  |   16 +++-------------
 2 files changed, 7 insertions(+), 26 deletions(-)
arch/i386/pci/acpi.c +4 -13
diff -Nru a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
@@ -37,21 +37,12 @@
 		 * also do it here in case there are still broken drivers that
 		 * don't use pci_enable_device().
 		 */
-		printk(KERN_INFO "** Routing PCI interrupts for all devices because \"pci=routeirq\"\n");
-		printk(KERN_INFO "** was specified.  If this was required to make a driver work,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to [email protected]\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
+		printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
 		while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
 			acpi_pci_irq_enable(dev);
-	} else {
-		printk(KERN_INFO "** PCI interrupts are no longer routed automatically.  If this\n");
-		printk(KERN_INFO "** causes a device to stop working, it is probably because the\n");
-		printk(KERN_INFO "** driver failed to call pci_enable_device().  As a temporary\n");
-		printk(KERN_INFO "** workaround, the \"pci=routeirq\" argument restores the old\n");
-		printk(KERN_INFO "** behavior.  If this argument makes the device work again,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to [email protected]\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
-	}
+	} else
+		printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\".  If it helps, post a report\n");
+
 #ifdef CONFIG_X86_IO_APIC
 	if (acpi_ioapic)
 		print_IO_APIC();
arch/ia64/pci/pci.c +3 -13
diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
@@ -151,21 +151,11 @@
 		 * also do it here in case there are still broken drivers that
 		 * don't use pci_enable_device().
 		 */
-		printk(KERN_INFO "** Routing PCI interrupts for all devices because \"pci=routeirq\"\n");
-		printk(KERN_INFO "** was specified.  If this was required to make a driver work,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to [email protected]\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
+		printk(KERN_INFO "PCI: Routing interrupts for all devices because \"pci=routeirq\" specified\n");
 		for_each_pci_dev(dev)
 			acpi_pci_irq_enable(dev);
-	} else {
-		printk(KERN_INFO "** PCI interrupts are no longer routed automatically.  If this\n");
-		printk(KERN_INFO "** causes a device to stop working, it is probably because the\n");
-		printk(KERN_INFO "** driver failed to call pci_enable_device().  As a temporary\n");
-		printk(KERN_INFO "** workaround, the \"pci=routeirq\" argument restores the old\n");
-		printk(KERN_INFO "** behavior.  If this argument makes the device work again,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to [email protected]\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
-	}
+	} else
+		printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\".  If it helps, post a report\n");
 
 	return 0;
 }
author
#4 lore raw

PATCH 1/1 PCI: fix hotplug double free

ChangeSet 1.1998.11.26, 2005/02/25 15:48:12-08:00, [email protected]

[PATCH] PCI: fix hotplug double free

With the brackets missed out func could be freed twice.

Found by Coverity tool

 drivers/pci/hotplug/pciehp_ctrl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/hotplug/pciehp_ctrl.c +2 -1
diff -Nru a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -1354,10 +1354,11 @@
 				dbg("PCI Bridge Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", 
 					ctrl->seg, func->bus, func->device, func->function);
 				bridge_slot_remove(func);
-			} else
+			} else {
 				dbg("PCI Function Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", 
 					ctrl->seg, func->bus, func->device, func->function);
 				slot_remove(func);
+			}
 
 			func = pciehp_slot_find(ctrl->slot_bus, device, 0);
 		}
author
#5 lore raw

PATCH 1/1 PCI: One more Asus SMBus quirk

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

 drivers/pci/quirks.c |    1 +
 1 files changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
diff -Nru a/drivers/pci/quirks.c b/drivers/pci/quirks.c
@@ -786,6 +786,7 @@
 			}
 		if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
 			switch (dev->subsystem_device) {
+			case 0x184b: /* W1N notebook */
 			case 0x186a: /* M6Ne notebook */
 				asus_hides_smbus = 1;
 			}
#6 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1? They seem to fit the "real bug" criteria.

Signature · 3 lines
   -bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
 last possible moment - but no longer"  -me
#7 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Hi Bill,

Quoted 6 lines
Quoted 3 lines

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1? They seem to fit the "real bug" criteria.

I see nothing critical in this patch. It gives access to a chip. Without the patch you cannot access the chip, and that's about it. No bug there, only a missing feature.

Can't speak for the "double-free patch", don't know what it is all about.

Signature · 1 line
Jean Delvare
#8 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 4 lines · Jean Delvare

Hi Bill,

Quoted 2 lines
Quoted 2 lines

[PATCH] PCI: One more Asus SMBus quirk

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1? They seem to fit the "real bug" criteria.

I see nothing critical in this patch. It gives access to a chip. Without the patch you cannot access the chip, and that's about it. No bug there, only a missing feature.

Sorry, I thought this was an non-functional feature in existing code rather than support for a new chip.

Quoted 7 lines

Can't speak for the "double-free patch", don't know what it is all about.

Signature · 1 line
Jean Delvare
Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
author
#9 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

In reply to Bill Davidsen
Quoted 11 lines · Bill Davidsen
Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1?

what double-free patch?

thanks,

greg k-h

#10 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 6 lines · Greg KH
Quoted 5 lines · Bill Davidsen
Quoted 4 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1?

what double-free patch?

ChangeSet 1.1998.11.26, 2005/02/25 15:48:12-08:00

See <[email protected]>.

Or do you feel the possible results are harmless enough to wait for the next release? Your call, obviously.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
author
#11 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 13 lines · Bill Davidsen
Quoted 11 lines · Greg KH
Quoted 10 lines · Bill Davidsen
Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Hopefully this and the double-free patch will be included in 2.6.11.n+1?

what double-free patch?

ChangeSet 1.1998.11.26, 2005/02/25 15:48:12-08:00

See <[email protected]>.

Giving just the Subject: would have been easier to find the patch...

Quoted 2 lines

Or do you feel the possible results are harmless enough to wait for the next release? Your call, obviously.

I'll add it to the -stable queue, thanks for pointing it out.

greg k-h

#12 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 16 lines · Greg KH
Quoted 15 lines · Bill Davidsen
Quoted 13 lines · Greg KH
Quoted 11 lines · Bill Davidsen
Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

what double-free patch?

ChangeSet 1.1998.11.26, 2005/02/25 15:48:12-08:00

See <[email protected]>.

Giving just the Subject: would have been easier to find the patch...

But... but... but it was YOUR PATCH, wasn't it? That's kind of why I didn't expect much problem identifying it, I got it from you.

Quoted 5 lines
Quoted 3 lines

Or do you feel the possible results are harmless enough to wait for the next release? Your call, obviously.

I'll add it to the -stable queue, thanks for pointing it out.

Great, then I didn't waste your time with it. I'm still feeling out what's worth suggesting for -stable, as you probably guessed.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
author
#13 lore raw

Re: [PATCH] PCI: One more Asus SMBus quirk

Quoted 20 lines · Bill Davidsen
Quoted 18 lines · Greg KH
Quoted 17 lines · Bill Davidsen
Quoted 14 lines · Greg KH
Quoted 11 lines · Bill Davidsen
Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.27, 2005/02/25 15:48:28-08:00, [email protected]

[PATCH] PCI: One more Asus SMBus quirk

One more Asus laptop requiring the SMBus quirk (W1N model).

Hopefully this and the double-free patch will be included in 2.6.11.n+1?

what double-free patch?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

ChangeSet 1.1998.11.26, 2005/02/25 15:48:12-08:00

See <[email protected]>.

Giving just the Subject: would have been easier to find the patch...

But... but... but it was YOUR PATCH, wasn't it? That's kind of why I didn't expect much problem identifying it, I got it from you.

No, I didn't write it. If you notice, I sent out over 200 patches in the past few days, the majority from other people. So trying to remember exactly which patch you were referring to took a bit of searching :)

thanks,

greg k-h

#14 lore raw

Re: PCI: remove pci_find_device usage from pci sysfs code.

In reply to Greg KH
Quoted 8 lines · Greg KH

ChangeSet 1.1998.11.23, 2005/02/25 08:26:11-08:00, [email protected]

PCI: remove pci_find_device usage from pci sysfs code.

diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c

drivers/pci/pci-sysfs.c line 487

Quoted 8 lines
drivers/pci/pci-sysfs.c +1 -1
@@ -481,7 +481,7 @@
 	struct pci_dev *pdev = NULL;
 
 	sysfs_initialized = 1;
-	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
+	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
 		pci_create_sysfs_dev_files(pdev);
 
 	return 0;

Any reasons why you are not using "for_each_pci_dev(pdev)" here?

Eike

author
#15 lore raw

Re: PCI: remove pci_find_device usage from pci sysfs code.

Quoted 11 lines · Rolf Eike Beer
Quoted 10 lines · Greg KH

ChangeSet 1.1998.11.23, 2005/02/25 08:26:11-08:00, [email protected]

PCI: remove pci_find_device usage from pci sysfs code.

diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c

drivers/pci/pci-sysfs.c +0 -0
@@ -481,7 +481,7 @@
 	struct pci_dev *pdev = NULL;
 
Quoted 8 lines

drivers/pci/pci-sysfs.c line 487

Quoted 6 lines
drivers/pci/pci-sysfs.c +1 -1
 	sysfs_initialized = 1;
-	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
+	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
 		pci_create_sysfs_dev_files(pdev);
 
 	return 0;

Any reasons why you are not using "for_each_pci_dev(pdev)" here?

Nope, I forgot it was there :)

Care to send a patch?

thanks,

greg k-h

#16 lore raw

Re: PCI: remove pci_find_device usage from pci sysfs code.

Quoted 9 lines · Greg KH
Quoted 6 lines · Rolf Eike Beer
Quoted 3 lines · Greg KH

ChangeSet 1.1998.11.23, 2005/02/25 08:26:11-08:00, [email protected]

PCI: remove pci_find_device usage from pci sysfs code.

Any reasons why you are not using "for_each_pci_dev(pdev)" here?

Nope, I forgot it was there :)

Patch is against 2.6.12-rc1-bk1 and does the same think like your one, except it uses for_each_pci_dev()

Eike

--- linux-2.6.11/drivers/pci/pci-sysfs.c 2005-03-21 11:41:56.000000000 +0100
+++ linux-2.6.12-rc1/drivers/pci/pci-sysfs.c 2005-03-24 19:20:50.000000000
+0100
@@ -481,7 +481,7 @@ static int __init pci_sysfs_init(void)
struct pci_dev *pdev = NULL;

sysfs_initialized = 1;
- while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)
+ for_each_pci_dev(pdev)
pci_create_sysfs_dev_files(pdev);

return 0;

author Applied
#17 lore raw

Re: PCI: remove pci_find_device usage from pci sysfs code.

Quoted 5 lines · Rolf Eike Beer
Quoted 4 lines · Greg KH
Quoted 3 lines · Rolf Eike Beer
Quoted 2 lines · Greg KH

ChangeSet 1.1998.11.23, 2005/02/25 08:26:11-08:00, [email protected]

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

PCI: remove pci_find_device usage from pci sysfs code.

Any reasons why you are not using "for_each_pci_dev(pdev)" here?

Nope, I forgot it was there :)

Patch is against 2.6.12-rc1-bk1 and does the same think like your one, except it uses for_each_pci_dev()

Applied, thanks.

greg k-h