Skip to contentSkip to conversation

crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing

PATCH In review Joel Fernandes 2 participants 2 messages Mar 7, 2014 – Mar 10, 2014 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing

HIGHMEM pages may not be mapped so we must kmap them before accessing. This resolves a random OOPs error that was showing up during OpenSSL SHA tests.

---
v2: Don't check for HIGHMEM, already done by kmap/unmap
v3: Use atomic as call can happen in irq context.

 drivers/crypto/omap-sham.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/crypto/omap-sham.c +7 -1
index 8bdde57..54b3ed1 100644
@@ -636,11 +636,17 @@ static size_t omap_sham_append_buffer(struct omap_sham_reqctx *ctx,
 static size_t omap_sham_append_sg(struct omap_sham_reqctx *ctx)
 {
 	size_t count;
+	const u8 *vaddr;
 
 	while (ctx->sg) {
+		vaddr = kmap_atomic(sg_page(ctx->sg));
+
 		count = omap_sham_append_buffer(ctx,
-				sg_virt(ctx->sg) + ctx->offset,
+				vaddr + ctx->offset,
 				ctx->sg->length - ctx->offset);
+
+		kunmap_atomic((void *)vaddr);
+
 		if (!count)
 			break;
 		ctx->offset += count;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 4 lines · Joel Fernandes

HIGHMEM pages may not be mapped so we must kmap them before accessing. This resolves a random OOPs error that was showing up during OpenSSL SHA tests.

Patch applied. Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt