Re: [PATCH] pci: keep pci device resource name pointer right.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> Impact: fix bug

i think this needs to be marked Cc: <stable@xxxxxxxxxx> as well, for 
2.6.29.x, maybe even 2.6.28.x ?

( Please note a small commit log detail: a few days go we started 
  putting impact lines to the end of the commit as 'footers', in 
  square brackets - right before the signoff lines. We do this to 
  move them closer to other mechanic-looking tags and to not intrude 
  the flow of the natural-language story line of the commit.

  Also note that 'fix bug' is not a good impact line even if it was 
  a footer, because it does not really summarize the effects of a 
  patch specifically enough. A better variant would be:

     [ Impact: fix corrupted names in /proc/iomem ]

  I've inserted this impact line into your commit below, to show the 
  exact placement we started using. Note, this impact line would 
  also be a perfect summary line, if the 'pci: ' tag is added before 
  it:

     pci: fix corrupted names in /proc/iomem

  Jesse or Linus might opt to remove the impact line - it's a per 
  subsystem discretion thing. )

	Ingo

> 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.
> 
> [ Impact: fix corrupted names in /proc/iomem ]
>
> Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> 
> ---
>  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-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux