PCI updates for v4.0:

APM X-Gene host bridge driver
     - Add register offset to config space base address (Feng Kan)
 
   Miscellaneous
     - Don't read past the end of sysfs "driver_override" buffer (Sasha Levin)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVAbsOAAoJEFmIoMA60/r858gP/0eW9rgawzcdtsidmvmPligj
 NLJ/L8H+z4n9az0o3EDef4Tcv4lO0J6bLgr+YblTLJaYWQfbKZo3cXCXi3EnM0MF
 +vkWh8TQvHeTW7L3e/KwwWtkg14zpJ6KTgpLSGzW87BNcSOzC76dfGNyZJ5CIuSf
 nJgQtQ2gFQNRM0BgR5S+BGGeXPOtOE8ytJyOV6Z3MOtzTYprMaixzDs9XgDLASEu
 6vzb7S62f//FWbTLF+gvBuAMb6VFv/ORZOHxlsZPjhXSJ1bfHKO6caYIgJsYuau1
 E9OYuIdsAr0sXm6ejNmlgSxSGB1yUvEi7onOwGe3N11AwRzzd/BfyFbS46sqzpBN
 IwflhW4SNX8dfZYB3lowd2aDirwGlBLSxOsepTBlDgBlQ7ANoemoAmOY0pOvIkCu
 jUObW8PaD3sCfwMCNNwu+eISYBAP7GC2KfgWK2jvCqjfEH5+myP+ibDed8Z01Yie
 838QRgPys+Z4nVmeDi0HnXkwYpDmcwez6YKpYukl62GJUb5zSbZDDjoYE7kVk90h
 8aBeaQO0SkR3DB++hirQPhWz5YAIJ4Looxr/86SbZ6y2zQhDimDQ15eKmV11PyfO
 CkmiQCJ0rf3n0AhVgHPt7OCaZ8hmmDShQs32Xtf26+MVf59lBYTsM3zAs93kOyqN
 kKMKQknE6rJ09FOFmVnC
 =4mzw
 -----END PGP SIGNATURE-----

Merge tag 'pci-v4.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:
 "Here are a couple updates for v4.0.

  One fixes a config accessor problem on APM X-Gene that we introduced
  when switching to generic config accessors, and the other fixes an
  older read-past-end-of-buffer problem in sysfs.

  APM X-Gene host bridge driver
    - Add register offset to config space base address (Feng Kan)

  Miscellaneous
    - Don't read past the end of sysfs "driver_override" buffer (Sasha Levin)"

* tag 'pci-v4.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI: xgene: Add register offset to config space base address
  PCI: Don't read past the end of sysfs "driver_override" buffer
This commit is contained in:
Linus Torvalds 2015-03-12 09:45:46 -07:00
commit 91e9134eda
2 changed files with 5 additions and 4 deletions

View File

@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
return false; return false;
} }
static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
int offset) int offset)
{ {
struct xgene_pcie_port *port = bus->sysdata; struct xgene_pcie_port *port = bus->sysdata;
@ -137,7 +137,7 @@ static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
return NULL; return NULL;
xgene_pcie_set_rtdid_reg(bus, devfn); xgene_pcie_set_rtdid_reg(bus, devfn);
return xgene_pcie_get_cfg_base(bus); return xgene_pcie_get_cfg_base(bus) + offset;
} }
static struct pci_ops xgene_pcie_ops = { static struct pci_ops xgene_pcie_ops = {

View File

@ -521,7 +521,8 @@ static ssize_t driver_override_store(struct device *dev,
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
char *driver_override, *old = pdev->driver_override, *cp; char *driver_override, *old = pdev->driver_override, *cp;
if (count > PATH_MAX) /* We need to keep extra room for a newline */
if (count >= (PAGE_SIZE - 1))
return -EINVAL; return -EINVAL;
driver_override = kstrndup(buf, count, GFP_KERNEL); driver_override = kstrndup(buf, count, GFP_KERNEL);
@ -549,7 +550,7 @@ static ssize_t driver_override_show(struct device *dev,
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
return sprintf(buf, "%s\n", pdev->driver_override); return snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override);
} }
static DEVICE_ATTR_RW(driver_override); static DEVICE_ATTR_RW(driver_override);