[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <149692978205.11452.9161641214967386572.stgit@warthog.procyon.org.uk>
Date: Thu, 08 Jun 2017 14:49:42 +0100
From: David Howells <dhowells@...hat.com>
To: jmorris@...ei.org
Cc: Eric Biggers <ebiggers@...gle.com>,
Stephan Mueller <smueller@...onox.de>,
linux-kernel@...r.kernel.org, dhowells@...hat.com,
linux-security-module@...r.kernel.org, keyrings@...r.kernel.org
Subject: [PATCH 19/23] KEYS: DH: don't feed uninitialized "otherinfo" into
KDF
From: Eric Biggers <ebiggers@...gle.com>
If userspace called KEYCTL_DH_COMPUTE with kdf_params containing NULL
otherinfo but nonzero otherinfolen, the kernel would allocate a buffer
for the otherinfo, then feed it into the KDF without initializing it.
Fix this by always doing the copy from userspace (which will fail with
EFAULT in this scenario).
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Signed-off-by: David Howells <dhowells@...hat.com>
Acked-by: Stephan Mueller <smueller@...onox.de>
---
security/keys/dh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/keys/dh.c b/security/keys/dh.c
index 8abc70ebe22d..1c1cac677041 100644
--- a/security/keys/dh.c
+++ b/security/keys/dh.c
@@ -317,7 +317,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params,
* Concatenate SP800-56A otherinfo past DH shared secret -- the
* input to the KDF is (DH shared secret || otherinfo)
*/
- if (kdfcopy && kdfcopy->otherinfo &&
+ if (kdfcopy &&
copy_from_user(kbuf + resultlen, kdfcopy->otherinfo,
kdfcopy->otherinfolen) != 0) {
ret = -EFAULT;
Powered by blists - more mailing lists