mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Acked-by: Ivan Hu <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Fixes: ff6301dabc ("efi: Add efi_test driver for exporting UEFI runtime service interfaces")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
f34157878d
commit
092e72c9ed
1 changed files with 3 additions and 0 deletions
|
|
@ -593,6 +593,9 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
|
|||
if (copy_from_user(&qcaps, qcaps_user, sizeof(qcaps)))
|
||||
return -EFAULT;
|
||||
|
||||
if (qcaps.capsule_count == ULONG_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
capsules = kcalloc(qcaps.capsule_count + 1,
|
||||
sizeof(efi_capsule_header_t), GFP_KERNEL);
|
||||
if (!capsules)
|
||||
|
|
|
|||
Loading…
Reference in a new issue