mirror-linux/arch/s390/include/asm
Niklas Schnelle a46044a92a s390/pci: fix zpci_zdev_put() on reserve
Since commit 2a671f77ee ("s390/pci: fix use after free of zpci_dev")
the reference count of a zpci_dev is incremented between
pcibios_add_device() and pcibios_release_device() which was supposed to
prevent the zpci_dev from being freed while the common PCI code has
access to it. It was missed however that the handling of zPCI
availability events assumed that once zpci_zdev_put() was called no
later availability event would still see the device. With the previously
mentioned commit however this assumption no longer holds and we must
make sure that we only drop the initial long-lived reference the zPCI
subsystem holds exactly once.

Do so by introducing a zpci_device_reserved() function that handles when
a device is reserved. Here we make sure the zpci_dev will not be
considered for further events by removing it from the zpci_list.

This also means that the device actually stays in the
ZPCI_FN_STATE_RESERVED state between the time we know it has been
reserved and the final reference going away. We thus need to consider it
a real state instead of just a conceptual state after the removal. The
final cleanup of PCI resources, removal from zbus, and destruction of
the IOMMU stays in zpci_release_device() to make sure holders of the
reference do see valid data until the release.

Fixes: 2a671f77ee ("s390/pci: fix use after free of zpci_dev")
Cc: stable@vger.kernel.org
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2021-10-04 09:49:10 +02:00
..
fpu s390: convert to generic entry 2021-01-19 12:29:26 +01:00
trace
vdso s390/vdso: use system call functions 2021-07-27 09:39:15 +02:00
Kbuild local64.h: make <asm/local64.h> mandatory 2020-12-29 15:36:49 -08:00
airq.h
alternative-asm.h
alternative.h s390/alternatives: add alternative_input() / alternative_io() 2021-02-09 15:57:06 +01:00
ap.h s390/ap: get rid of register asm in ap_dqap() 2021-07-08 22:12:17 +02:00
appldata.h
archrandom.h s390/crypto: add arch_get_random_long() support 2020-12-10 21:02:08 +01:00
asm-const.h s390/kernel: unify EX_TABLE* implementations 2020-07-20 10:55:45 +02:00
asm-prototypes.h
atomic.h locking/atomic: make ARCH_ATOMIC a Kconfig symbol 2021-05-26 13:20:49 +02:00
atomic_ops.h s390/atomic,cmpxchg: make constraints work with old compilers 2021-04-15 17:47:42 +02:00
barrier.h
bitops.h s390/bitops: use register pair instead of register asm 2021-06-18 16:41:21 +02:00
boot_data.h
bug.h printk: Make linux/printk.h self-contained 2020-07-27 17:46:24 +09:00
bugs.h
cache.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
ccwdev.h s390/cio: remove duplicate struct ccw1 declaration 2021-04-05 11:30:57 +02:00
ccwgroup.h s390/qeth: fix deadlock during failing recovery 2021-09-21 20:02:24 -07:00
checksum.h s390/checksum: use register pair instead of register asm 2021-06-18 16:41:21 +02:00
chpid.h
chsc.h s390/cio: Add new Operation Code OC3 to PNSO 2020-09-15 13:21:46 -07:00
cio.h s390/cio: remove unused include linux/spinlock.h from cio.h 2021-07-27 09:39:13 +02:00
clocksource.h s390: convert to GENERIC_VDSO 2020-08-26 18:47:21 +02:00
clp.h s390/pci: Implement ioremap_wc/prot() with MIO 2020-09-14 10:30:07 +02:00
cmb.h
cmpxchg.h s390/cmpxchg: use register pair instead of register asm 2021-06-28 11:18:28 +02:00
compat.h arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
cpacf.h s390/cpacf: get rid of register asm 2021-07-27 09:39:15 +02:00
cpcmd.h
cpu.h
cpu_mcf.h s390/cpum_cf: move array from header to C file 2021-09-07 13:38:41 +02:00
cpu_mf-insn.h
cpu_mf.h
cpufeature.h s390/hwcaps: shorten HWCAP defines 2021-07-27 09:39:20 +02:00
cputime.h s390: convert to generic entry 2021-01-19 12:29:26 +01:00
crw.h
css_chars.h s390/cio: Add new Operation Code OC3 to PNSO 2020-09-15 13:21:46 -07:00
ctl_reg.h s390/ctl_reg: add ctlreg5 and ctlreg15 unions 2021-07-27 09:39:17 +02:00
current.h
debug.h s390/debug: add early tracing support 2021-08-25 11:03:35 +02:00
delay.h s390/delay: remove udelay_simple() 2020-12-16 14:55:49 +01:00
diag.h s390: rename dma section to amode31 2021-08-05 14:10:53 +02:00
dis.h
dma.h
dwarf.h
eadm.h s390/scm: Make struct scm_driver::remove return void 2021-07-21 11:53:42 +02:00
ebcdic.h
elf.h s390/hwcaps: make sie capability regular hwcap 2021-07-27 09:39:21 +02:00
entry-common.h s390/signal: remove sigreturn on stack 2021-07-08 22:12:17 +02:00
exec.h
extable.h s390: rename dma section to amode31 2021-08-05 14:10:53 +02:00
extmem.h
facility.h s390/facility: get rid of register asm 2021-06-18 16:41:23 +02:00
fcx.h
ftrace.h s390/ftrace: implement hotpatching 2021-08-03 14:31:40 +02:00
ftrace.lds.h s390/ftrace: implement hotpatching 2021-08-03 14:31:40 +02:00
futex.h s390/mm: remove set_fs / rework address space handling 2020-11-23 12:01:12 +01:00
gmap.h s390: remove orphaned function declarations 2020-09-30 12:09:54 +02:00
hardirq.h softirq: Move __ARCH_HAS_DO_SOFTIRQ to Kconfig 2021-02-10 23:34:16 +01:00
hugetlb.h mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
hw_irq.h s390/irq: make init_ext_interrupts static 2020-03-11 14:18:44 +01:00
idals.h
idle.h s390/time,idle: get rid of unsigned long long 2021-03-08 10:46:27 +01:00
io.h mm: remove xlate_dev_kmem_ptr() 2021-05-07 00:26:34 -07:00
ipl.h s390/cio: remove unused include linux/spinlock.h from cio.h 2021-07-27 09:39:13 +02:00
irq.h
irq_work.h s390/smp: implement arch_irq_work_raise() 2021-02-24 00:31:22 +01:00
irqflags.h s390/irqflags: always inline arch irqflags functions 2021-06-18 16:41:19 +02:00
isc.h
itcw.h
jump_label.h
kasan.h s390: setup kernel memory layout early 2021-06-18 16:41:19 +02:00
kdebug.h
kexec.h
kfence.h s390: add support for KFENCE 2021-07-30 17:09:02 +02:00
kprobes.h
kvm_host.h ARM: 2021-09-07 13:40:51 -07:00
kvm_para.h KVM: s390: generate kvm hypercall functions 2021-08-25 11:03:35 +02:00
linkage.h s390: rename dma section to amode31 2021-08-05 14:10:53 +02:00
livepatch.h livepatch: Use the default ftrace_ops instead of REGS when ARGS is available 2020-11-13 12:15:28 -05:00
lowcore.h s390/smp: enable DAT before CPU restart callback is called 2021-08-26 20:22:12 +02:00
mem_detect.h
mem_encrypt.h
mmu.h s390 updates for the 5.7 merge window 2020-04-04 09:45:50 -07:00
mmu_context.h s390/mm: ensure switch_mm() is executed with interrupts disabled 2021-06-07 17:06:59 +02:00
mmzone.h
module.h s390/ftrace: implement hotpatching 2021-08-03 14:31:40 +02:00
nmi.h s390/mcck: keep machine check interruption codes sorted 2021-07-05 12:44:23 +02:00
nospec-branch.h
nospec-insn.h
numa.h s390/mm: remove fake numa support 2020-02-27 16:02:21 +01:00
os_info.h
page-states.h
page.h s390/mm: remove unused cmma functions 2021-08-18 10:01:28 +02:00
pci.h s390/pci: fix zpci_zdev_put() on reserve 2021-10-04 09:49:10 +02:00
pci_clp.h s390/pci: Implement ioremap_wc/prot() with MIO 2020-09-14 10:30:07 +02:00
pci_debug.h
pci_dma.h s390/pci: improve DMA translation init and exit 2021-08-25 11:03:34 +02:00
pci_insn.h
pci_io.h s390/pci: Fix s390_mmio_read/write with MIO 2020-05-14 23:21:37 +02:00
percpu.h s390/cmpxchg: use register pair instead of register asm 2021-06-28 11:18:28 +02:00
perf_event.h
pgalloc.h mm/thp: define default pmd_pgtable() 2021-07-01 11:06:03 -07:00
pgtable.h s390/mm: don't print hashed values for pte_ERROR() & friends 2021-07-27 09:39:13 +02:00
pkey.h
pnet.h
preempt.h s390: preempt: Fix preempt_count initialization 2021-07-08 22:12:18 +02:00
processor.h s390/smp: enable DAT before CPU restart callback is called 2021-08-26 20:22:12 +02:00
ptdump.h s390: add ARCH_HAS_DEBUG_WX support 2020-09-14 11:38:35 +02:00
ptrace.h s390: rename PIF_SYSCALL_RESTART to PIF_EXECVE_PGSTE_RESTART 2021-07-08 22:12:17 +02:00
purgatory.h
qdio.h s390/qdio: remove unused support for SLIB parameters 2021-08-18 10:01:28 +02:00
runtime_instr.h
schid.h
sclp.h s390/sclp: reserve memory occupied by sclp early buffer 2021-08-18 10:01:29 +02:00
scsw.h s390: Simplify the calculation of variables 2021-02-09 15:57:04 +01:00
seccomp.h s390: Enable seccomp architecture tracking 2020-11-20 11:16:35 -08:00
sections.h s390: rename dma section to amode31 2021-08-05 14:10:53 +02:00
serial.h
set_memory.h s390/mm: implement set_memory_4k() 2021-07-30 17:09:01 +02:00
setup.h s390: make PCI mio support a machine flag 2021-07-27 09:39:19 +02:00
shmparam.h
signal.h
sigp.h s390/sigp: use register pair instead of register asm 2021-06-18 16:41:22 +02:00
smp.h s390/topology: fix topology information when calling cpu hotplug notifiers 2021-09-07 13:38:41 +02:00
softirq_stack.h s390/softirq: use call_on_stack() macro 2021-07-08 22:12:18 +02:00
sparsemem.h
spinlock.h s390/spinlock: use R constraint in inline assembly 2021-04-12 12:46:43 +02:00
spinlock_types.h s390/spinlock: remove align attribute from arch_spinlock_t 2021-03-28 20:23:54 +02:00
stacktrace.h s390/unwind: use current_frame_address() to unwind current task 2021-09-07 13:38:27 +02:00
stp.h s390/stp: add support for leap seconds 2020-09-26 15:51:21 +02:00
string.h s390/string: get rid of register asm 2021-06-28 11:18:28 +02:00
switch_to.h
syscall.h s390/syscall: provide generic system call functions 2021-07-27 09:39:15 +02:00
syscall_wrapper.h s390: pass struct pt_regs instead of registers to syscalls 2021-01-19 12:29:27 +01:00
sysinfo.h
termios.h
thread_info.h s390/thread_info.h: fix task_struct declaration warning 2021-02-09 15:57:04 +01:00
timex.h s390/timex: get rid of register asm 2021-06-28 11:18:28 +02:00
tlb.h s390/tlb: make cleared_pXs flags consistent with generic code 2021-01-19 12:29:25 +01:00
tlbflush.h s390: remove orphaned function declarations 2020-09-30 12:09:54 +02:00
topology.h s390/numa: set node distance to LOCAL_DISTANCE 2020-08-11 18:16:35 +02:00
tpi.h s390: add struct tpi_info to struct pt_regs 2021-06-07 17:07:01 +02:00
types.h s390: introduce register pair union 2021-06-18 16:41:21 +02:00
uaccess.h arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
unistd.h
unwind.h s390/unwind: use current_frame_address() to unwind current task 2021-09-07 13:38:27 +02:00
uprobes.h
user.h
uv.h s390/boot: move uv function declarations to boot/uv.h 2021-07-27 09:39:14 +02:00
vdso.h s390/vdso: add minimal compat vdso 2021-07-08 15:37:28 +02:00
vga.h
vmalloc.h
vmlinux.lds.h
vtime.h s390: convert to generic entry 2021-01-19 12:29:26 +01:00
vtimer.h s390: remove orphaned function declarations 2020-09-30 12:09:54 +02:00
vx-insn.h
xor.h