public inbox for linux-kernel@vger.kernel.org
 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, Jani Nikula <jani.nikula@intel.com>,
	Matt Fleming <matt.fleming@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Seth Forshee <seth.forshee@canonical.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: [ 09/79] x86/PCI: Map PCI setup data with ioremap() so it can be in highmem
Date: Tue, 11 Jun 2013 13:02:35 -0700	[thread overview]
Message-ID: <20130611195313.629553357@linuxfoundation.org> (raw)
In-Reply-To: <20130611195312.352656079@linuxfoundation.org>

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

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

From: Matt Fleming <matt.fleming@intel.com>

commit 65694c5aaddfedd9da082e4e150cafc6b3fc8a6a upstream.

f9a37be0f0 ("x86: Use PCI setup data") added support for using PCI ROM
images from setup_data.  This used phys_to_virt(), which is not valid for
highmem addresses, and can cause a crash when booting a 32-bit kernel via
the EFI boot stub.

pcibios_add_device() assumes that the physical addresses stored in
setup_data are accessible via the direct kernel mapping, and that calling
phys_to_virt() is valid.  This isn't guaranteed to be true on x86 where the
direct mapping range is much smaller than on x86-64.

Calling phys_to_virt() on a highmem address results in the following:

 BUG: unable to handle kernel paging request at 39a3c198
 IP: [<c262be0f>] pcibios_add_device+0x2f/0x90
 ...
 Call Trace:
  [<c2370c73>] pci_device_add+0xe3/0x130
  [<c274640b>] pci_scan_single_device+0x8b/0xb0
  [<c2370d08>] pci_scan_slot+0x48/0x100
  [<c2371904>] pci_scan_child_bus+0x24/0xc0
  [<c262a7b0>] pci_acpi_scan_root+0x2c0/0x490
  [<c23b7203>] acpi_pci_root_add+0x312/0x42f
  ...

The solution is to use ioremap() instead of phys_to_virt() to map the
setup data into the kernel address space.

[bhelgaas: changelog]
Tested-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/pci/common.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -617,7 +617,9 @@ int pcibios_add_device(struct pci_dev *d
 
 	pa_data = boot_params.hdr.setup_data;
 	while (pa_data) {
-		data = phys_to_virt(pa_data);
+		data = ioremap(pa_data, sizeof(*rom));
+		if (!data)
+			return -ENOMEM;
 
 		if (data->type == SETUP_PCI) {
 			rom = (struct pci_setup_rom *)data;
@@ -634,6 +636,7 @@ int pcibios_add_device(struct pci_dev *d
 			}
 		}
 		pa_data = data->next;
+		iounmap(data);
 	}
 	return 0;
 }



  parent reply	other threads:[~2013-06-11 20:22 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 20:02 [ 00/79] 3.9.6-stable review Greg Kroah-Hartman
2013-06-11 20:02 ` [ 01/79] USB: serial: Add Option GTM681W to qcserial device table Greg Kroah-Hartman
2013-06-11 20:02 ` [ 02/79] USB: option: blacklist network interface on Huawei E1820 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 03/79] USB: option,zte_ev: move most ZTE CDMA devices to zte_ev Greg Kroah-Hartman
2013-06-11 20:02 ` [ 04/79] usb: dwc3: pci: PHY should be deleted later than dwc3 core Greg Kroah-Hartman
2013-06-11 20:02 ` [ 05/79] xhci - correct comp_mode_recovery_timer on return from hibernate Greg Kroah-Hartman
2013-06-11 20:02 ` [ 06/79] xhci-mem: init list heads at the beginning of init Greg Kroah-Hartman
2013-06-11 20:02 ` [ 07/79] xhci: fix list access before init Greg Kroah-Hartman
2013-06-11 20:02 ` [ 08/79] xhci: Disable D3cold for buggy TI redrivers Greg Kroah-Hartman
2013-06-11 20:02 ` Greg Kroah-Hartman [this message]
2013-06-11 20:02 ` [ 10/79] usb: musb: make use_sg flag URB specific Greg Kroah-Hartman
2013-06-11 20:02 ` [ 11/79] ALSA: usb-audio: fix Roland/Cakewalk UM-3G support Greg Kroah-Hartman
2013-06-11 20:02 ` [ 12/79] ALSA: usb-audio - Apply Logitech QuickCam Pro 9000 quirk only to audio iface Greg Kroah-Hartman
2013-06-11 20:02 ` [ 13/79] ALSA: usb-audio - Fix invalid volume resolution on Logitech HD webcam c270 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 14/79] USB: iuu_phoenix: fix bulk-message timeout Greg Kroah-Hartman
2013-06-11 20:02 ` [ 15/79] USB: keyspan: fix bogus array index Greg Kroah-Hartman
2013-06-11 20:02 ` [ 16/79] USB: ark3116: fix control-message timeout Greg Kroah-Hartman
2013-06-11 20:02 ` [ 17/79] USB: visor: fix initialisation of Treo/Kyocera devices Greg Kroah-Hartman
2013-06-11 20:02 ` [ 18/79] USB: zte_ev: fix control-message timeouts Greg Kroah-Hartman
2013-06-11 20:02 ` [ 19/79] USB: zte_ev: fix broken open Greg Kroah-Hartman
2013-06-11 20:02 ` [ 20/79] USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device Greg Kroah-Hartman
2013-06-11 20:02 ` [ 21/79] USB: whiteheat: fix broken port configuration Greg Kroah-Hartman
2013-06-11 20:02 ` [ 22/79] USB: serial: fix Treo/Kyocera interrrupt-in urb context Greg Kroah-Hartman
2013-06-11 20:02 ` [ 23/79] USB: revert periodic scheduling bugfix Greg Kroah-Hartman
2013-06-11 20:02 ` [ 24/79] USB: mos7840: fix DMA to stack Greg Kroah-Hartman
2013-06-11 20:02 ` [ 25/79] USB: mos7720: " Greg Kroah-Hartman
2013-06-11 20:02 ` [ 26/79] USB: mos7720: fix message timeouts Greg Kroah-Hartman
2013-06-11 20:02 ` [ 27/79] USB: mos7720: fix hardware flow control Greg Kroah-Hartman
2013-06-11 20:02 ` [ 28/79] acpi-cpufreq: set current frequency based on target P-State Greg Kroah-Hartman
2013-06-11 20:02 ` [ 29/79] ACPI / video: ignore BIOS initial backlight value for HP m4 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 30/79] ACPI / video: ignore BIOS initial backlight value for HP Pavilion g6 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 31/79] ACPI / scan: do not match drivers against objects having scan handlers Greg Kroah-Hartman
2013-06-11 20:02 ` [ 32/79] ACPI / PM: Do not execute _PS0 for devices without _PSC during initialization Greg Kroah-Hartman
2013-06-11 20:02 ` [ 33/79] x86 / platform / hp_wmi: Fix bluetooth_rfkill misuse in hp_wmi_rfkill_setup() Greg Kroah-Hartman
2013-06-11 20:03 ` [ 34/79] ALSA: hda/via - Disable broken dynamic power control Greg Kroah-Hartman
2013-06-11 20:03 ` [ 35/79] ALSA: hda/via - Fix wrongly cleared pins after suspend on VT1802 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 36/79] ALSA: hda - Allow setting automute/automic hooks after parsing Greg Kroah-Hartman
2013-06-11 20:03 ` [ 37/79] ALSA: hda - Add keep_eapd_on flag to generic parser Greg Kroah-Hartman
2013-06-11 20:03 ` [ 38/79] ARM: Kirkwood: TS219: Fix crash by double PCIe instantiation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 39/79] ARM: 7742/1: topology: export cpu_topology Greg Kroah-Hartman
2013-06-11 20:03 ` [ 40/79] ARM: 7743/1: compressed/head.S: work around new binutils warning Greg Kroah-Hartman
2013-06-11 20:03 ` [ 41/79] ARM: 7747/1: pcpu: ensure __my_cpu_offset cannot be re-ordered across barrier() Greg Kroah-Hartman
2013-06-11 20:03 ` [ 42/79] powerpc/eeh: Dont check RTAS token to get PE addr Greg Kroah-Hartman
2013-06-11 20:03 ` [ 43/79] powerpc/hw_breakpoints: Add DABRX cpu feature to fix 32-bit regression Greg Kroah-Hartman
2013-06-11 20:03 ` [ 44/79] powerpc/perf: Fix deadlock caused by calling printk() in PMU exception Greg Kroah-Hartman
2013-06-11 20:03 ` [ 45/79] dmaengine: ste_dma40: fix pm runtime ref counting Greg Kroah-Hartman
2013-06-11 20:03 ` [ 46/79] radeon: Fix system hang issue when using KMS with older cards Greg Kroah-Hartman
2013-06-11 20:03 ` [ 47/79] drm/radeon: dont allow audio on DCE6 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 48/79] hpfs: fix warnings when the filesystem fills up Greg Kroah-Hartman
2013-06-11 20:03 ` [ 49/79] cifs: fix off-by-one bug in build_unc_path_to_root Greg Kroah-Hartman
2013-06-11 20:03 ` [ 50/79] ecryptfs: fixed msync to flush data Greg Kroah-Hartman
2013-06-11 20:03 ` [ 51/79] eCryptfs: Check return of filemap_write_and_wait during fsync Greg Kroah-Hartman
2013-06-11 20:03 ` [ 52/79] hwmon: (adm1021) Strengthen chip detection for ADM1021, LM84 and MAX1617 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 53/79] drm/mgag200: Add missing write to index before accessing data register Greg Kroah-Hartman
2013-06-11 20:03 ` [ 54/79] drm: fix a use-after-free when GPU acceleration disabled Greg Kroah-Hartman
2013-06-11 20:03 ` [ 55/79] drm/i915/sdvo: Use &intel_sdvo->ddc instead of intel_sdvo->i2c for DDC Greg Kroah-Hartman
2013-06-11 20:03 ` [ 56/79] drm/i915: no lvds quirk for hp t5740 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 57/79] drm/i915: Fix spurious -EIO/SIGBUS on wedged gpus Greg Kroah-Hartman
2013-06-11 20:03 ` [ 58/79] Revert "ACPI / scan: do not match drivers against objects having scan handlers" Greg Kroah-Hartman
2013-06-11 20:03 ` [ 59/79] powerpc: Fix build error in stable/3.9 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 60/79] usb: dwc3: gadget: free trb pool only from epnum 2 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 61/79] drm/gma500: Increase max resolution for mode setting Greg Kroah-Hartman
2013-06-11 20:03 ` [ 62/79] pci: Set dev->dev.type in alloc_pci_dev Greg Kroah-Hartman
2013-06-11 20:03 ` [ 63/79] powerpc: Set default VGA device Greg Kroah-Hartman
2013-06-11 20:03 ` [ 64/79] powerpc/pseries: Force 32 bit MSIs for devices that require it Greg Kroah-Hartman
2013-06-11 20:03 ` [ 65/79] powerpc/pseries: Make 32-bit MSI quirk work on systems lacking firmware support Greg Kroah-Hartman
2013-06-12 17:19   ` Kleber Sacilotto de Souza
2013-06-11 20:03 ` [ 66/79] powerpc/pseries: Perform proper max_bus_speed detection Greg Kroah-Hartman
2013-06-11 20:03 ` [ 67/79] radeon: use max_bus_speed to activate gen2 speeds Greg Kroah-Hartman
2013-06-11 20:03 ` [ 68/79] iio:inkern: Fix typo/bug in convert raw to processed Greg Kroah-Hartman
2013-06-11 20:03 ` [ 69/79] iio: frequency: ad4350: Fix bug / typo in mask Greg Kroah-Hartman
2013-06-11 20:03 ` [ 70/79] drm/i915: force full modeset if the connector is in DPMS OFF mode Greg Kroah-Hartman
2013-06-11 20:03 ` [ 71/79] USB: serial: add wait_until_sent operation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 72/79] USB: serial: add generic wait_until_sent implementation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 73/79] USB: ftdi_sio: clean up get_modem_status Greg Kroah-Hartman
2013-06-11 20:03 ` [ 74/79] USB: ftdi_sio: fix chars_in_buffer overhead Greg Kroah-Hartman
2013-06-11 20:03 ` [ 75/79] USB: io_ti: " Greg Kroah-Hartman
2013-06-11 20:03 ` [ 76/79] Fix lockup related to stop_machine being stuck in __do_softirq Greg Kroah-Hartman
2013-06-11 20:03 ` [ 77/79] xen/smp: Fixup NOHZ per cpu data when onlining an offline CPU Greg Kroah-Hartman
2013-06-11 20:03 ` [ 78/79] timekeeping: Correct run-time detection of persistent_clock Greg Kroah-Hartman
2013-06-11 20:03 ` [ 79/79] s390: Add pgste to ptep_modify_prot_start() Greg Kroah-Hartman
2013-06-12 14:06 ` [ 00/79] 3.9.6-stable review Guenter Roeck
2013-06-12 14:15   ` Josh Boyer
2013-06-12 14:21     ` Guenter Roeck
2013-06-12 15:49 ` Shuah Khan
2013-06-12 16:58   ` Greg Kroah-Hartman
2013-06-12 20:29 ` Guenter Roeck
2013-06-12 20:34   ` Guenter Roeck
2013-06-12 20:53     ` Kleber Sacilotto de Souza
2013-06-13 17:41       ` Greg Kroah-Hartman
2013-06-13 17: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=20130611195313.629553357@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=jani.nikula@intel.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=seth.forshee@canonical.com \
    --cc=stable@vger.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