From: Herbert Xu <20160318144240.GA20816@gondor.apana.org.au> Date: Thu, 17 Mar 2016 17:42:00 +0000 (+0900) Subject: gcm - Fix rfc4543 decryption crash X-Git-Tag: v4.1.12-92~3^2~256 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=83c2104a99da69885da1381ab3eeabb04467c7fc;p=users%2Fjedix%2Flinux-maple.git gcm - Fix rfc4543 decryption crash Orabug: 25243093 This bug has already bee fixed upstream since 4.2. However, it was fixed during the AEAD conversion so no fix was backported to the older kernels. When we do an RFC 4543 decryption, we will end up writing the ICV beyond the end of the dst buffer. This should lead to a crash but for some reason it was never noticed. This patch fixes it by only writing back the ICV for encryption. Fixes: d733ac90f9fe ("crypto: gcm - fix rfc4543 to handle async...") Reported-by: Patrick Meyer Signed-off-by: Herbert Xu Signed-off-by: Ethan Zhao --- diff --git a/crypto/gcm.c b/crypto/gcm.c index b56200eff029..33adbc4a4b51 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c @@ -1173,6 +1173,9 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, aead_request_set_tfm(subreq, ctx->child); aead_request_set_callback(subreq, req->base.flags, crypto_rfc4543_done, req); + if (!enc) + aead_request_set_callback(subreq, req->base.flags, + req->base.complete, req->base.data); aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv); aead_request_set_assoc(subreq, assoc, assoclen);