Skip to contentSkip to conversation

FAILED: patch "[PATCH] crypto: ccree - only try to map auth tag if needed" failed to apply to 4.19-stable tree

PATCH [email protected] 3 participants 3 messages Apr 15, 2020 – Apr 16, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 504e84abec7a635b861afd8d7f92ecd13eaa2b09 Mon Sep 17 00:00:00 2001
From: Gilad Ben-Yossef <[email protected]>
Date: Wed, 29 Jan 2020 16:37:55 +0200
Subject: [PATCH] crypto: ccree - only try to map auth tag if needed

Make sure to only add the size of the auth tag to the source mapping for encryption if it is an in-place operation. Failing to do this previously caused us to try and map auth size len bytes from a NULL mapping and crashing if both the cryptlen and assoclen are zero.

drivers/crypto/ccree/cc_buffer_mgr.c +4 -2
index b938ceae7ae7..885347b5b372 100644
@@ -1109,9 +1109,11 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req)
 	}
 
 	size_to_map = req->cryptlen + areq_ctx->assoclen;
-	if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT)
+	/* If we do in-place encryption, we also need the auth tag */
+	if ((areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT) &&
+	   (req->src == req->dst)) {
 		size_to_map += authsize;
-
+	}
 	if (is_gcm4543)
 		size_to_map += crypto_aead_ivsize(tfm);
 	rc = cc_map_sg(dev, req->src, size_to_map, DMA_BIDIRECTIONAL,
maintainer
#1 lore raw
Quoted 22 lines · On Wed, Apr 15, 2020 at 01:07:08PM +0200, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 504e84abec7a635b861afd8d7f92ecd13eaa2b09 Mon Sep 17 00:00:00 2001
From: Gilad Ben-Yossef <[email protected]>
Date: Wed, 29 Jan 2020 16:37:55 +0200
Subject: [PATCH] crypto: ccree - only try to map auth tag if needed

Make sure to only add the size of the auth tag to the source mapping for encryption if it is an in-place operation. Failing to do this previously caused us to try and map auth size len bytes from a NULL mapping and crashing if both the cryptlen and assoclen are zero.

Quoted 5 lines

Grabbing:

da3cf67f1bcf ("crypto: ccree - don't mangle the request assoclen") 9f31eb6e08cc ("crypto: ccree - zero out internal struct before use") ccba2f1112d4 ("crypto: ccree - improve error handling")

resolved this conflict.

Signature · 2 lines
Thanks,
Sasha
maintainer Acked-by
#2 lore raw
Quoted 30 lines · Sasha Levin
Quoted 22 lines · On Wed, Apr 15, 2020 at 01:07:08PM +0200, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 504e84abec7a635b861afd8d7f92ecd13eaa2b09 Mon Sep 17 00:00:00 2001
From: Gilad Ben-Yossef <[email protected]>
Date: Wed, 29 Jan 2020 16:37:55 +0200
Subject: [PATCH] crypto: ccree - only try to map auth tag if needed

Make sure to only add the size of the auth tag to the source mapping for encryption if it is an in-place operation. Failing to do this previously caused us to try and map auth size len bytes from a NULL mapping and crashing if both the cryptlen and assoclen are zero.

Quoted 5 lines
Quoted 8 lines

Grabbing:

da3cf67f1bcf ("crypto: ccree - don't mangle the request assoclen") 9f31eb6e08cc ("crypto: ccree - zero out internal struct before use") ccba2f1112d4 ("crypto: ccree - improve error handling")

resolved this conflict.

Thanks,
Gilad

Signature · 8 lines
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!
Acked-by: Gilad Ben-Yossef <[email protected]>

Thanks,
Gilad