From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] crypto: skcipher - fix crash in skcipher_walk_aead()
Date: Tue, 29 Nov 2016 13:05:31 +0000 [thread overview]
Message-ID: <1480424733-10797-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1480424733-10797-1-git-send-email-ard.biesheuvel@linaro.org>
The new skcipher_walk_aead() may crash in the following way due to
the walk flag SKCIPHER_WALK_PHYS not being cleared at the start of the
walk:
Unable to handle kernel NULL pointer dereference at virtual address 00000001
[..]
Internal error: Oops: 96000044 [#1] PREEMPT SMP
[..]
PC is at skcipher_walk_next+0x208/0x450
LR is at skcipher_walk_next+0x1e4/0x450
pc : [<ffff2b93b7104e20>] lr : [<ffff2b93b7104dfc>] pstate: 40000045
sp : ffffb925fa517940
[...]
[<ffff2b93b7104e20>] skcipher_walk_next+0x208/0x450
[<ffff2b93b710535c>] skcipher_walk_first+0x54/0x148
[<ffff2b93b7105664>] skcipher_walk_aead+0xd4/0x108
[<ffff2b93b6e77928>] ccm_encrypt+0x68/0x158
So clear the flag at the appropriate time.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
crypto/skcipher.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 0f3071991b13..5367f817b40e 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -506,6 +506,8 @@ int skcipher_walk_aead(struct skcipher_walk *walk, struct aead_request *req,
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
int err;
+ walk->flags &= ~SKCIPHER_WALK_PHYS;
+
scatterwalk_start(&walk->in, req->src);
scatterwalk_start(&walk->out, req->dst);
--
2.7.4
next prev parent reply other threads:[~2016-11-29 13:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 13:05 [PATCH 1/4] crypto: arm/aes-ce: fix broken monolithic build Ard Biesheuvel
2016-11-29 13:05 ` Ard Biesheuvel [this message]
2016-11-29 13:05 ` [PATCH 3/4] crypto: arm64/aes-ce-ccm - fix decrypt path with new skcipher interface Ard Biesheuvel
2016-11-30 13:14 ` Herbert Xu
2016-11-30 13:17 ` Herbert Xu
2016-11-30 13:24 ` Ard Biesheuvel
2016-11-29 13:05 ` [PATCH 4/4] crypto: arm64/aes-ce-ctr: fix skcipher conversion Ard Biesheuvel
2016-11-30 13:18 ` [PATCH 1/4] crypto: arm/aes-ce: fix broken monolithic build Herbert Xu
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=1480424733-10797-2-git-send-email-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).