lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Apr 2009 22:37:53 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Andrew Morton <akpm@...ux-foundation.org>
CC:	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	linux-pci@...r.kernel.org, Greg KH <gregkh@...e.de>
Subject: [PATCH] pci: keep pci device resource name pointer right.


Impact: fix bug

notice one system /proc/iomem some entries missed the name for pci_devices

# cat /proc/iomem
00000000-000973ff : System RAM
00097400-0009ffff : reserved
000a0000-000bffff : PCI Bus #00
000c0000-000cffff : pnp 00:0c
000e0000-000fffff : reserved
00100000-b7f9ffff : System RAM
 00200000-00c67b4b : Kernel code
 00c67b4c-01331edf : Kernel data
 015a5000-01fc9657 : Kernel bss
 20000000-23ffffff : GART
b7fae000-b7faffff : System RAM
b7fb0000-b7fbdfff : ACPI Tables
b7fbe000-b7feffff : ACPI Non-volatile Storage
b7ff0000-b7ffffff : reserved
b8000000-beffffff : PCI Bus #00
bf000000-bfffffff : PCI Bus #80
 bfe80000-bfebffff : pnp 00:0e
 bfef9000-bfef9fff :
   bfef9000-bfef9fff : forcedeth
 bfefa000-bfefa00f :
   bfefa000-bfefa00f : forcedeth
 bfefa400-bfefa4ff :
   bfefa400-bfefa4ff : forcedeth
 bfefa800-bfefa80f :
   bfefa800-bfefa80f : forcedeth
 bfefac00-bfefacff :
   bfefac00-bfefacff : forcedeth
 bfefb000-bfefbfff :
   bfefb000-bfefbfff : forcedeth
 bfefc000-bfefcfff :
   bfefc000-bfefcfff : sata_nv
 bfefd000-bfefdfff :
   bfefd000-bfefdfff : sata_nv
 bfefe000-bfefefff :
   bfefe000-bfefefff : sata_nv
 bfeff000-bfefffff : IOAPIC 1
   bfeff000-bfefffff :
...

it turns that we need to reget res->name because dev->dev.kobj name is changed
after device_add.

Signed-off-by: Yinghai Lu <yinghai@...nel.org>

---
 drivers/pci/bus.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: linux-2.6/drivers/pci/bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/bus.c
+++ linux-2.6/drivers/pci/bus.c
@@ -70,6 +70,19 @@ pci_bus_alloc_resource(struct pci_bus *b
 	return ret;
 }
 
+static void pci_dev_update_res_name(struct pci_dev *dev)
+{
+	int idx;
+
+	/* after device_add will get new name, reget it */
+	for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
+		struct resource *res = &dev->resource[idx];
+
+		if (res->name)
+			res->name = pci_name(dev);
+	}
+}
+
 /**
  * pci_bus_add_device - add a single device
  * @dev: device to add
@@ -84,6 +97,7 @@ int pci_bus_add_device(struct pci_dev *d
 	if (retval)
 		return retval;
 
+	pci_dev_update_res_name(dev);
 	dev->is_added = 1;
 	pci_proc_attach_device(dev);
 	pci_create_sysfs_dev_files(dev);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ