stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto/sha512-mb: Correct initialization value for lane lens
@ 2017-02-16 22:15 Tim Chen
  2017-02-16 22:15 ` [PATCH 2/2] crypto/sha512-mb: Add missing assignemnt of request context Tim Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Chen @ 2017-02-16 22:15 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Tim Chen, megha.dey, Dmitry Vyukov, stable

The wrong value was used to initialize the lane lens for sha512-mb's mgr
structure.  This could cause a NULL pointer access of jobs structure if
sha512_job_mgr_get_comp_job is called to get completed jobs.  We assume
that lens that don't have 0xFFFFFFFF in upper half of lens have valid
job and have a job structue, leading to invalide pointer access.

Cc: stable@vger.kernel.org
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
 arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c b/arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c
index 36870b2..5484d77 100644
--- a/arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c
+++ b/arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c
@@ -57,10 +57,10 @@ void sha512_mb_mgr_init_avx2(struct sha512_mb_mgr *state)
 {
 	unsigned int j;
 
-	state->lens[0] = 0;
-	state->lens[1] = 1;
-	state->lens[2] = 2;
-	state->lens[3] = 3;
+	state->lens[0] = 0xFFFFFFFF00000000;
+	state->lens[1] = 0xFFFFFFFF00000001;
+	state->lens[2] = 0xFFFFFFFF00000002;
+	state->lens[3] = 0xFFFFFFFF00000003;
 	state->unused_lanes = 0xFF03020100;
 	for (j = 0; j < 4; j++)
 		state->ldata[j].job_in_lane = NULL;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] crypto/sha512-mb: Add missing assignemnt of request context
  2017-02-16 22:15 [PATCH 1/2] crypto/sha512-mb: Correct initialization value for lane lens Tim Chen
@ 2017-02-16 22:15 ` Tim Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Chen @ 2017-02-16 22:15 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Tim Chen, megha.dey, Dmitry Vyukov, stable

When handling of error condition in sha512_mb_finup, we need
to set the correct request context for sha_complete_job
to finish notification to issuer of the crypto request.

Cc: stable@vger.kernel.org
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
 arch/x86/crypto/sha512-mb/sha512_mb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/crypto/sha512-mb/sha512_mb.c b/arch/x86/crypto/sha512-mb/sha512_mb.c
index 4d437b8..12d98dd 100644
--- a/arch/x86/crypto/sha512-mb/sha512_mb.c
+++ b/arch/x86/crypto/sha512-mb/sha512_mb.c
@@ -647,6 +647,7 @@ static int sha512_mb_finup(struct ahash_request *areq)
 
 	if (sha_ctx->error) {
 		ret = sha_ctx->error;
+		rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
 		goto done;
 	}
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-16 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16 22:15 [PATCH 1/2] crypto/sha512-mb: Correct initialization value for lane lens Tim Chen
2017-02-16 22:15 ` [PATCH 2/2] crypto/sha512-mb: Add missing assignemnt of request context Tim Chen

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).