linux-stable/drivers/firmware/efi
Kees Cook f72ecfe93a pstore: Convert buf_lock to semaphore
commit ea84b580b9 upstream.

Instead of running with interrupts disabled, use a semaphore. This should
make it easier for backends that may need to sleep (e.g. EFI) when
performing a write:

|BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
|in_atomic(): 1, irqs_disabled(): 1, pid: 2236, name: sig-xstate-bum
|Preemption disabled at:
|[<ffffffff99d60512>] pstore_dump+0x72/0x330
|CPU: 26 PID: 2236 Comm: sig-xstate-bum Tainted: G      D           4.20.0-rc3 #45
|Call Trace:
| dump_stack+0x4f/0x6a
| ___might_sleep.cold.91+0xd3/0xe4
| __might_sleep+0x50/0x90
| wait_for_completion+0x32/0x130
| virt_efi_query_variable_info+0x14e/0x160
| efi_query_variable_store+0x51/0x1a0
| efivar_entry_set_safe+0xa3/0x1b0
| efi_pstore_write+0x109/0x140
| pstore_dump+0x11c/0x330
| kmsg_dump+0xa4/0xd0
| oops_exit+0x22/0x30
...

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: 21b3ddd39f ("efi: Don't use spinlocks for efi vars")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-11 12:21:48 +02:00
..
libstub efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted 2019-04-05 22:31:36 +02:00
test License cleanup: add SPDX license identifiers to some files 2017-11-02 10:04:46 -07:00
apple-properties.c treewide: Consolidate Apple DMI checks 2017-08-03 23:26:22 +02:00
arm-init.c efi/arm: Revert deferred unmap of early memmap mapping 2018-12-01 09:42:54 +01:00
arm-runtime.c efi/arm: Revert deferred unmap of early memmap mapping 2018-12-01 09:42:54 +01:00
capsule-loader.c efi/capsule-loader: Reinstate virtual capsule mapping 2018-01-10 09:31:18 +01:00
capsule.c
cper.c efi: cper: Fix possible out-of-bounds access 2019-04-05 22:31:31 +02:00
dev-path-parser.c
efi-bgrt.c efi/bgrt: Use efi_mem_type() 2017-08-26 09:20:33 +02:00
efi-pstore.c pstore: Convert buf_lock to semaphore 2019-06-11 12:21:48 +02:00
efi.c efi: Move some sysfs files to be read-only by root 2017-12-14 09:52:52 +01:00
efibc.c
efivars.c
esrt.c efi/esrt: Only call efi_mem_reserve() for boot services memory 2018-09-26 08:38:10 +02:00
fake_mem.c
Kconfig x86/efi: Clarify that reset attack mitigation needs appropriate userspace 2018-02-03 17:39:25 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
memattr.c efi/memattr: Don't bail on zero VA if it equals the region's PA 2019-04-05 22:31:36 +02:00
memmap.c efi/arm: Revert deferred unmap of early memmap mapping 2018-12-01 09:42:54 +01:00
reboot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
runtime-map.c efi: Move some sysfs files to be read-only by root 2017-12-14 09:52:52 +01:00
runtime-wrappers.c x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls 2019-02-20 10:20:53 +01:00
vars.c firmware/efi: Add NULL pointer checks in efivars API functions 2019-02-12 19:46:01 +01:00