Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c4393df authored by Gary R Hook's avatar Gary R Hook Committed by Greg Kroah-Hartman
Browse files

crypto: ccp - Fix oops by properly managing allocated structures



commit 25e44338321af545ab34243a6081c3f0fc6107d0 upstream.

A plaintext or ciphertext length of 0 is allowed in AES, in which case
no encryption occurs. Ensure that we don't clean up data structures
that were never allocated.

Fixes: 36cf515b ("crypto: ccp - Enable support for AES GCM on v5 CCPs")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarGary R Hook <gary.hook@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9de2157
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -862,11 +862,11 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q,
	ccp_dm_free(&final_wa);

e_dst:
	if (aes->src_len && !in_place)
	if (ilen > 0 && !in_place)
		ccp_free_data(&dst, cmd_q);

e_src:
	if (aes->src_len)
	if (ilen > 0)
		ccp_free_data(&src, cmd_q);

e_aad: