lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-092e72c9edab16d4d6ad10c683a95047d53b6db4@git.kernel.org>
Date:   Wed, 25 Oct 2017 04:09:52 -0700
From:   tip-bot for Dan Carpenter <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, ard.biesheuvel@...aro.org,
        mingo@...nel.org, torvalds@...ux-foundation.org,
        peterz@...radead.org, hpa@...or.com, dan.carpenter@...cle.com,
        ivan.hu@...onical.com, matt@...eblueprint.co.uk, tglx@...utronix.de
Subject: [tip:efi/urgent] efi/efi_test: Prevent an Oops in
 efi_runtime_query_capsulecaps()

Commit-ID:  092e72c9edab16d4d6ad10c683a95047d53b6db4
Gitweb:     https://git.kernel.org/tip/092e72c9edab16d4d6ad10c683a95047d53b6db4
Author:     Dan Carpenter <dan.carpenter@...cle.com>
AuthorDate: Wed, 25 Oct 2017 11:04:47 +0100
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 25 Oct 2017 12:10:59 +0200

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@...cle.com>
Signed-off-by: Matt Fleming <matt@...eblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Acked-by: Ivan Hu <ivan.hu@...onical.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-efi@...r.kernel.org
Fixes: ff6301dabc3c ("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@...nel.org>
---
 drivers/firmware/efi/test/efi_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 08129b7..41c48a1 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ