efi: fix NULL-deref in init error path
authorJohan Hovold <johan+linaro@kernel.org>
Mon, 19 Dec 2022 09:10:04 +0000 (10:10 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 3 Jan 2023 09:52:15 +0000 (10:52 +0100)
commit703c13fe3c9af557d312f5895ed6a5fda2711104
treed160ac839ccc9d17d8e259b7ffae4ea3438789f4
parent88603b6dc419445847923fcb7fe5080067a30f98
efi: fix NULL-deref in init error path

In cases where runtime services are not supported or have been disabled,
the runtime services workqueue will never have been allocated.

Do not try to destroy the workqueue unconditionally in the unlikely
event that EFI initialisation fails to avoid dereferencing a NULL
pointer.

Fixes: 98086df8b70c ("efi: add missed destroy_workqueue when efisubsys_init fails")
Cc: stable@vger.kernel.org
Cc: Li Heng <liheng40@huawei.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi.c