]> git.baikalelectronics.ru Git - kernel.git/commit
efi: ssdt: Don't free memory if ACPI table was loaded successfully
authorArd Biesheuvel <ardb@kernel.org>
Fri, 14 Oct 2022 10:25:52 +0000 (12:25 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 21 Oct 2022 09:09:40 +0000 (11:09 +0200)
commit4d662f8458563edb698c4d1410c58bd59bb44291
tree403cdf74e256b38e383983ad6e8b99675c3076de
parentda4536b1245b241d6300a681c0343c580e68fbc0
efi: ssdt: Don't free memory if ACPI table was loaded successfully

Amadeusz reports KASAN use-after-free errors introduced by commit
08c29826d439 ("efi: avoid efivars layer when loading SSDTs from
variables"). The problem appears to be that the memory that holds the
new ACPI table is now freed unconditionally, instead of only when the
ACPI core reported a failure to load the table.

So let's fix this, by omitting the kfree() on success.

Cc: <stable@vger.kernel.org> # v6.0
Link: https://lore.kernel.org/all/a101a10a-4fbb-5fae-2e3c-76cf96ed8fbd@linux.intel.com/
Fixes: 08c29826d439 ("efi: avoid efivars layer when loading SSDTs from variables")
Reported-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi.c