linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Matthew Whitehead <mwhitehe@redhat.com>,
	Yinghai Lu <yinghai@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [ 22/64] EISA/PCI: Fix bus res reference
Date: Wed, 10 Apr 2013 15:46:19 -0700	[thread overview]
Message-ID: <20130410224338.272629766@linuxfoundation.org> (raw)
In-Reply-To: <20130410224333.114387235@linuxfoundation.org>

3.8-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yinghai Lu <yinghai@kernel.org>

commit 2cfda637e29ce9e3df31b59f64516b2e571cc985 upstream.

Matthew found that 3.8.3 is having problems with an old (ancient)
PCI-to-EISA bridge, the Intel 82375. It worked with the 3.2 kernel.
He identified the 82375, but doesn't assign the struct resource *res
pointer inside the struct eisa_root_device, and panics.

pci_eisa_init() was using bus->resource[] directly instead of
pci_bus_resource_n().  The bus->resource[] array is a PCI-internal
implementation detail, and after commit 45ca9e97 (PCI: add helpers for
building PCI bus resource lists) and commit 0efd5aab (PCI: add struct
pci_host_bridge_window with CPU/bus address offset), bus->resource[] is not
used for PCI root buses any more.

The 82375 is a subtractive-decode PCI device, so handle it the same
way we handle PCI-PCI bridges in subtractive-decode mode in
pci_read_bridge_bases().

[bhelgaas: changelog]
Reported-by: Matthew Whitehead <mwhitehe@redhat.com>
Tested-by: Matthew Whitehead <mwhitehe@redhat.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/eisa/pci_eisa.c |   28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -21,7 +21,8 @@ static struct eisa_root_device pci_eisa_
 
 static int __init pci_eisa_init(struct pci_dev *pdev)
 {
-	int rc;
+	int rc, i;
+	struct resource *res, *bus_res = NULL;
 
 	if ((rc = pci_enable_device (pdev))) {
 		printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
@@ -29,9 +30,30 @@ static int __init pci_eisa_init(struct p
 		return rc;
 	}
 
+	/*
+	 * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
+	 * device, so the resources available on EISA are the same as those
+	 * available on the 82375 bus.  This works the same as a PCI-PCI
+	 * bridge in subtractive-decode mode (see pci_read_bridge_bases()).
+	 * We assume other PCI-EISA bridges are similar.
+	 *
+	 * eisa_root_register() can only deal with a single io port resource,
+	*  so we use the first valid io port resource.
+	 */
+	pci_bus_for_each_resource(pdev->bus, res, i)
+		if (res && (res->flags & IORESOURCE_IO)) {
+			bus_res = res;
+			break;
+		}
+
+	if (!bus_res) {
+		dev_err(&pdev->dev, "No resources available\n");
+		return -1;
+	}
+
 	pci_eisa_root.dev              = &pdev->dev;
-	pci_eisa_root.res	       = pdev->bus->resource[0];
-	pci_eisa_root.bus_base_addr    = pdev->bus->resource[0]->start;
+	pci_eisa_root.res	       = bus_res;
+	pci_eisa_root.bus_base_addr    = bus_res->start;
 	pci_eisa_root.slots	       = EISA_MAX_SLOTS;
 	pci_eisa_root.dma_mask         = pdev->dma_mask;
 	dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);



  parent reply	other threads:[~2013-04-10 23:14 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 22:45 [ 00/64] 3.8.7-stable review Greg Kroah-Hartman
2013-04-10 22:45 ` [ 01/64] ASoC: imx-ssi: Fix occasional AC97 reset failure Greg Kroah-Hartman
2013-04-10 22:45 ` [ 02/64] ASoC: dma-sh7760: Fix compile error Greg Kroah-Hartman
2013-04-10 22:46 ` [ 03/64] ASoC: spear_pcm: Update to new pcm_new() API Greg Kroah-Hartman
2013-04-10 22:46 ` [ 04/64] regmap: Initialize `map->debugfs before regcache Greg Kroah-Hartman
2013-04-10 22:46 ` [ 05/64] regmap: cache Fix regcache-rbtree sync Greg Kroah-Hartman
2013-04-10 22:46 ` [ 06/64] MIPS: Fix logic errors in bitops.c Greg Kroah-Hartman
2013-04-10 22:46 ` [ 07/64] HID: magicmouse: fix race between input_register() and probe() Greg Kroah-Hartman
2013-04-10 22:46 ` [ 08/64] spi/s3c64xx: modified error interrupt handling and init Greg Kroah-Hartman
2013-04-10 22:46 ` [ 09/64] spi/mpc512x-psc: optionally keep PSC SS asserted across xfer segmensts Greg Kroah-Hartman
2013-04-10 22:46 ` [ 10/64] gpio: stmpe: pass DT node to irqdomain Greg Kroah-Hartman
2013-04-10 22:46 ` [ 11/64] UBIFS: make space fixup work in the remount case Greg Kroah-Hartman
2013-04-10 22:46 ` [ 12/64] reiserfs: Fix warning and inode leak when deleting inode with xattrs Greg Kroah-Hartman
2013-04-10 22:46 ` [ 13/64] ALSA: hda - bug fix on return value when getting HDMI ELD info Greg Kroah-Hartman
2013-04-10 22:46 ` [ 14/64] ALSA: hda - Enabling Realtek ALC 671 codec Greg Kroah-Hartman
2013-04-10 22:46 ` [ 15/64] ALSA: hda - fix typo in proc output Greg Kroah-Hartman
2013-04-10 22:46 ` [ 16/64] drm/nouveau: fix handling empty channel list in ioctls Greg Kroah-Hartman
2013-04-10 22:46 ` [ 17/64] drm/i915: Be sure to turn hsync/vsync back on at crt enable (v2) Greg Kroah-Hartman
2013-04-10 22:46 ` [ 18/64] drm: correctly restore mappings if drm_open fails Greg Kroah-Hartman
2013-04-10 22:46 ` [ 19/64] Revert "drivers/rtc/rtc-at91rm9200.c: use a variable for storing IMR" Greg Kroah-Hartman
2013-04-10 22:46 ` [ 20/64] mm: prevent mmap_cache race in find_vma() Greg Kroah-Hartman
2013-04-10 22:46 ` [ 21/64] EISA/PCI: Init EISA early, before PNP Greg Kroah-Hartman
2013-04-10 22:46 ` Greg Kroah-Hartman [this message]
2013-04-10 22:46 ` [ 23/64] ixgbe: fix registration order of driver and DCA nofitication Greg Kroah-Hartman
2013-04-10 22:46 ` [ 24/64] libata: Use integer return value for atapi_command_packet_set Greg Kroah-Hartman
2013-04-10 22:46 ` [ 25/64] libata: Set max sector to 65535 for Slimtype DVD A DS8A8SH drive Greg Kroah-Hartman
2013-04-10 22:46 ` [ 26/64] libata: fix DMA to stack in reading devslp_timing parameters Greg Kroah-Hartman
2013-04-10 22:46 ` [ 27/64] MIPS: Unbreak function tracer for 64-bit kernel Greg Kroah-Hartman
2013-04-10 22:46 ` [ 28/64] alpha: Add irongate_io to PCI bus resources Greg Kroah-Hartman
2013-04-10 22:46 ` [ 29/64] PCI/ACPI: Always resume devices on ACPI wakeup notifications Greg Kroah-Hartman
2013-04-10 22:46 ` [ 30/64] PCI/PM: Disable runtime PM of PCIe ports Greg Kroah-Hartman
2013-04-10 22:46 ` [ 31/64] ata_piix: Fix DVD not dectected at some Haswell platforms Greg Kroah-Hartman
2013-04-10 22:46 ` [ 32/64] ftrace: Consistently restore trace function on sysctl enabling Greg Kroah-Hartman
2013-04-10 22:46 ` [ 33/64] powerpc: pSeries_lpar_hpte_remove fails from Adjunct partition being performed before the ANDCOND test Greg Kroah-Hartman
2013-04-10 22:46 ` [ 34/64] mwifiex: limit channel number not to overflow memory Greg Kroah-Hartman
2013-04-10 22:46 ` [ 35/64] mac80211: fix remain-on-channel cancel crash Greg Kroah-Hartman
2013-04-10 22:46 ` [ 36/64] x86: remove the x32 syscall bitmask from syscall_get_nr() Greg Kroah-Hartman
2013-04-10 22:46 ` [ 37/64] hwspinlock: fix __hwspin_lock_request error path Greg Kroah-Hartman
2013-04-10 22:46 ` [ 38/64] remoteproc/ste: fix memory leak on shutdown Greg Kroah-Hartman
2013-04-10 22:46 ` [ 39/64] remoteproc: fix error path of handle_vdev Greg Kroah-Hartman
2013-04-10 22:46 ` [ 40/64] remoteproc: fix FW_CONFIG typo Greg Kroah-Hartman
2013-04-10 22:46 ` [ 41/64] spinlocks and preemption points need to be at least compiler barriers Greg Kroah-Hartman
2013-04-10 22:54   ` Linus Torvalds
2013-04-10 23:00     ` Greg Kroah-Hartman
2013-04-10 22:46 ` [ 42/64] crypto: ux500 - add missing comma Greg Kroah-Hartman
2013-04-10 22:46 ` [ 43/64] crypto: gcm - fix assumption that assoc has one segment Greg Kroah-Hartman
2013-04-10 22:46 ` [ 44/64] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal Greg Kroah-Hartman
2013-04-10 22:46 ` [ 45/64] block: avoid using uninitialized value in from queue_var_store Greg Kroah-Hartman
2013-04-10 22:46 ` [ 46/64] SUNRPC: Remove extra xprt_put() Greg Kroah-Hartman
2013-04-10 22:46 ` [ 47/64] NFSv4: Fix a memory leak in nfs4_discover_server_trunking Greg Kroah-Hartman
2013-04-10 22:46 ` [ 48/64] NFSv4/4.1: Fix bugs in nfs4[01]_walk_client_list Greg Kroah-Hartman
2013-04-10 22:46 ` [ 49/64] drm/i915: Fix build failure Greg Kroah-Hartman
2013-04-10 22:46 ` [ 50/64] x86: Fix rebuild with EFI_STUB enabled Greg Kroah-Hartman
2013-04-10 22:46 ` [ 51/64] Revert "PCI/ACPI: Request _OSC control before scanning PCI root bus" Greg Kroah-Hartman
2013-04-10 22:46 ` [ 52/64] thermal: return an error on failure to register thermal class Greg Kroah-Hartman
2013-04-10 22:46 ` [ 53/64] msi-wmi: Fix memory leak Greg Kroah-Hartman
2013-04-10 22:46 ` [ 54/64] cpufreq: exynos: Get booting freq value in exynos_cpufreq_init Greg Kroah-Hartman
2013-04-10 22:46 ` [ 55/64] ARM: EXYNOS: Fix crash on soft reset on EXYNOS5440 Greg Kroah-Hartman
2013-04-10 22:46 ` [ 56/64] drm/i915: add quirk to invert brightness on eMachines G725 Greg Kroah-Hartman
2013-04-10 22:46 ` [ 57/64] drm/i915: add quirk to invert brightness on eMachines e725 Greg Kroah-Hartman
2013-04-10 22:46 ` [ 58/64] drm/i915: add quirk to invert brightness on Packard Bell NCL20 Greg Kroah-Hartman
2013-04-10 22:46 ` [ 59/64] r8169: fix auto speed down issue Greg Kroah-Hartman
2013-04-10 22:46 ` [ 60/64] vfio-pci: Fix possible integer overflow Greg Kroah-Hartman
2013-04-10 22:46 ` [ 61/64] NFSv4: Doh! Typo in the fix to nfs41_walk_client_list Greg Kroah-Hartman
2013-04-10 22:46 ` [ 62/64] can: gw: use kmem_cache_free() instead of kfree() Greg Kroah-Hartman
2013-04-10 22:47 ` [ 63/64] mwifiex: complete last internal scan Greg Kroah-Hartman
2013-04-10 22:47 ` [ 64/64] rt2x00: rt2x00pci_regbusy_read() - only print register access failure once Greg Kroah-Hartman
2013-04-11 16:30 ` [ 00/64] 3.8.7-stable review Shuah Khan
2013-04-11 16:45   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130410224338.272629766@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwhitehe@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).