]> git.baikalelectronics.ru Git - kernel.git/commit
efi/efi_test: Prevent an Oops in efi_runtime_query_capsulecaps()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 25 Oct 2017 10:04:47 +0000 (11:04 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 25 Oct 2017 10:10:59 +0000 (12:10 +0200)
commit20df96c98023385d1de9aa4d1b975a2794f8f15f
tree83b287433e6af410d15432ba9466ca7dc70d01e6
parent7e9aa07753026c662c1eed97d4d845bedec840c7
efi/efi_test: Prevent an Oops in efi_runtime_query_capsulecaps()

If "qcaps.capsule_count" is ULONG_MAX then "qcaps.capsule_count + 1"
will overflow to zero and kcalloc() will return the ZERO_SIZE_PTR.  We
try to dereference it inside the loop and crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Ivan Hu <ivan.hu@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Fixes: a8153024bafc ("efi: Add efi_test driver for exporting UEFI runtime service interfaces")
Link: http://lkml.kernel.org/r/20171025100448.26056-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/firmware/efi/test/efi_test.c