linux/arch/alpha/kernel
Lorenzo Pieralisi 814eae5982 alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata
The introduction of {map/swizzle}_irq() hooks in the struct pci_host_bridge
allowed to replace the pci_fixup_irqs() PCI IRQ allocation in alpha arch
PCI code with per-bridge map/swizzle functions with commit 0e4c2eeb75
("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping
hooks").

As a side effect of converting PCI IRQ allocation to the struct
pci_host_bridge {map/swizzle}_irq() hooks mechanism, the actual PCI IRQ
allocation function (ie pci_assign_irq()) is carried out per-device in
pci_device_probe() that is called when a PCI device driver is about to be
probed.

This means that, for drivers compiled as loadable modules, the actual PCI
device IRQ allocation can now happen after the system has booted so the
struct pci_host_bridge {map/swizzle}_irq() hooks pci_assign_irq() relies on
must stay valid after the system has booted so that PCI core can carry out
PCI IRQ allocation correctly.

Most of the alpha board structures pci_map_irq() and pci_swizzle() hooks
(that are used to initialize their struct pci_host_bridge equivalent
through the alpha_mv global variable - that represents the struct
alpha_machine_vector of the running kernel) are marked as
__init/__initdata; this causes freed memory dereferences when PCI IRQ
allocation is carried out after the kernel has booted (ie when loading PCI
drivers as loadable module) because when the kernel tries to bind the PCI
device to its (module) driver, the function pci_assign_irq() is called,
that in turn retrieves the struct pci_host_bridge {map/swizzle}_irq() hooks
to carry out PCI IRQ allocation; if those hooks are marked as __init
code/__initdata they point at freed/invalid memory.

Fix the issue by removing the __init/__initdata markers from all subarch
struct alpha_machine_vector.pci_map_irq()/pci_swizzle() functions (and
data).

Fixes: 0e4c2eeb75 ("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
Link: http://lkml.kernel.org/r/alpine.LRH.2.21.1710251043170.7098@math.ut.ee
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Meelis Roos <mroos@linux.ee>
Cc: Matt Turner <mattst88@gmail.com>
2017-10-26 11:53:38 -05:00
..
.gitignore
Makefile alpha: move exports to actual definitions 2016-08-07 23:47:18 -04:00
asm-offsets.c
audit.c
binfmt_loader.c
console.c
core_apecs.c
core_cia.c
core_irongate.c PCI: Remove unnecessary #includes of <asm/pci.h> 2015-06-08 07:56:09 -05:00
core_lca.c
core_marvel.c alpha: marvel: make use of raw_spinlock variants 2017-09-04 12:04:31 -07:00
core_mcpcia.c
core_polaris.c
core_t2.c
core_titan.c alpha: Fix build error without CONFIG_VGA_HOSE. 2017-08-29 12:01:41 -07:00
core_tsunami.c
core_wildfire.c
entry.S
err_common.c
err_ev6.c alpha: delete non-required instances of <linux/init.h> 2015-05-26 10:01:48 -07:00
err_ev7.c
err_impl.h
err_marvel.c
err_titan.c
es1888.c
gct.c
head.S
io.c
irq.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
irq_alpha.c
irq_i8259.c
irq_impl.h
irq_pyxis.c
irq_srm.c
machvec_impl.h alpha: move exports to actual definitions 2016-08-07 23:47:18 -04:00
module.c alpha: support R_ALPHA_REFLONG relocations for module loading 2017-08-29 12:01:52 -07:00
osf_sys.c osf_sigstack(): switch to put_user() 2017-05-27 16:38:39 -04:00
pc873xx.c
pc873xx.h
pci-noop.c alpha: squash lines for immediate return 2017-09-04 12:04:32 -07:00
pci-sysfs.c alpha: use kobj_to_dev() 2017-09-04 12:04:33 -07:00
pci.c pci-v4.14-changes 2017-09-08 15:47:43 -07:00
pci_impl.h
pci_iommu.c treewide: Constify most dma_map_ops structures 2017-01-24 12:23:35 -05:00
perf_event.c
process.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
proto.h
ptrace.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
rtc.c rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h 2016-06-04 00:20:00 +02:00
setup.c alpha: silence a buffer overflow warning 2017-09-04 12:04:32 -07:00
signal.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
smc37c93x.c
smc37c669.c alpha: squash lines for immediate return 2017-09-04 12:04:32 -07:00
smp.c alpha: Fix section mismatches 2017-08-29 12:01:55 -07:00
srm_env.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
srmcons.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
sys_alcor.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_cabriolet.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_dp264.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_eb64p.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_eiger.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_jensen.c
sys_marvel.c alpha: marvel: make use of raw_spinlock variants 2017-09-04 12:04:31 -07:00
sys_miata.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_mikasa.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_nautilus.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_noritake.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_rawhide.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_ruffian.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_rx164.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_sable.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_sio.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_sx164.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_takara.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
sys_titan.c
sys_wildfire.c alpha/PCI: Move pci_map_irq()/pci_swizzle() out of initdata 2017-10-26 11:53:38 -05:00
systbls.S alpha: Update for new syscalls 2017-08-29 12:01:43 -07:00
time.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
traps.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2017-09-11 18:34:47 -07:00
vmlinux.lds.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00