kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
From: Dan Aloni <dan@kernelim.com>
To: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Subject: [kernel-hardening] [PATCHv2 1/7] crypto: fix memory leak in rsa-kcs1pad encryption
Date: Sat, 13 Jan 2018 23:34:35 +0200	[thread overview]
Message-ID: <20180113213441.52047-2-dan@kernelim.com> (raw)
In-Reply-To: <20180113213441.52047-1-dan@kernelim.com>

The encryption mode of pkcs1pad never uses out_sg and out_buf, so
there's no need to allocate the buffer, which presently is not even
being freed.

CC: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Dan Aloni <dan@kernelim.com>
---
 crypto/rsa-pkcs1pad.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
index 2908f93c3e55..e8354084ef4e 100644
--- a/crypto/rsa-pkcs1pad.c
+++ b/crypto/rsa-pkcs1pad.c
@@ -261,15 +261,6 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
 	pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf,
 			ctx->key_size - 1 - req->src_len, req->src);
 
-	req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
-	if (!req_ctx->out_buf) {
-		kfree(req_ctx->in_buf);
-		return -ENOMEM;
-	}
-
-	pkcs1pad_sg_set_buf(req_ctx->out_sg, req_ctx->out_buf,
-			ctx->key_size, NULL);
-
 	akcipher_request_set_tfm(&req_ctx->child_req, ctx->child);
 	akcipher_request_set_callback(&req_ctx->child_req, req->base.flags,
 			pkcs1pad_encrypt_sign_complete_cb, req);
-- 
2.14.3

  reply	other threads:[~2018-01-13 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-13 21:34 [kernel-hardening] [PATCHv2 0/7] RFC: Public key encryption of dmesg by the kernel Dan Aloni
2018-01-13 21:34 ` Dan Aloni [this message]
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 2/7] Move net/ceph/armor to lib/ and add docs Dan Aloni
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 3/7] base64-armor: add bounds checking Dan Aloni
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 4/7] certs: allow in-kernel access of trusted keys Dan Aloni
2018-01-15  9:11   ` [kernel-hardening] " David Howells
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 5/7] printk: allow kmsg to be encrypted using public key encryption Dan Aloni
2018-01-14  1:48   ` [kernel-hardening] " Sergey Senozhatsky
2018-01-14  8:01     ` Dan Aloni
2018-01-15 12:52       ` Steven Rostedt
2018-01-16  2:09         ` Sergey Senozhatsky
2018-01-16 23:44         ` Daniel Micay
2018-01-17 15:01           ` Steven Rostedt
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 6/7] tools: add dmesg decryption program Dan Aloni
2018-01-13 21:34 ` [kernel-hardening] [PATCHv2 7/7] docs: add dmesg encryption doc Dan Aloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180113213441.52047-2-dan@kernelim.com \
    --to=dan@kernelim.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).