WSL2-Linux-Kernel/drivers/firmware/google
Guilherme G. Piccoli 3e081438b8 firmware: google: Test spinlock on panic path to avoid lockups
Currently the gsmi driver registers a panic notifier as well as
reboot and die notifiers. The callbacks registered are called in
atomic and very limited context - for instance, panic disables
preemption and local IRQs, also all secondary CPUs (not executing
the panic path) are shutdown.

With that said, taking a spinlock in this scenario is a dangerous
invitation for lockup scenarios. So, fix that by checking if the
spinlock is free to acquire in the panic notifier callback - if not,
bail-out and avoid a potential hang.

Fixes: 74c5b31c66 ("driver: Google EFI SMI")
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julius Werner <jwerner@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-24 14:59:44 +02:00
..
Kconfig firmware: google: Properly state IOMEM dependency 2022-03-18 14:18:15 +01:00
Makefile firmware: coreboot: Collapse platform drivers into bus core 2018-09-14 15:37:23 +02:00
coreboot_table.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
coreboot_table.h firmware: google: make coreboot driver's remove callback return void 2021-02-09 12:12:43 +01:00
framebuffer-coreboot.c firmware: google: make coreboot driver's remove callback return void 2021-02-09 12:12:43 +01:00
gsmi.c firmware: google: Test spinlock on panic path to avoid lockups 2022-09-24 14:59:44 +02:00
memconsole-coreboot.c firmware: google: make coreboot driver's remove callback return void 2021-02-09 12:12:43 +01:00
memconsole-x86-legacy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 287 2019-06-05 17:36:37 +02:00
memconsole.c Merge 5.2-rc4 into char-misc-next 2019-06-09 09:11:21 +02:00
memconsole.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 287 2019-06-05 17:36:37 +02:00
vpd.c firmware: google: make coreboot driver's remove callback return void 2021-02-09 12:12:43 +01:00
vpd_decode.c firmware: google: increment VPD key_len properly 2019-10-11 08:41:34 +02:00
vpd_decode.h firmware: google: check if size is valid when decoding VPD data 2019-09-04 13:31:28 +02:00