All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing
@ 2014-01-28 23:43 Joel Fernandes
  2014-02-14 19:53 ` Joel Fernandes
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Fernandes @ 2014-01-28 23:43 UTC (permalink / raw)
  To: Linux Crypto Mailing List; +Cc: Lokesh Vutla, 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.

Signed-off-by: Joel Fernandes <joelf@ti.com>
---
 drivers/crypto/omap-sham.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 8bdde57..fcf6562 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -636,11 +636,21 @@ 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) {
+		if (PageHighMem(sg_page(ctx->sg)))
+			vaddr = kmap_atomic(sg_page(ctx->sg));
+		else
+			vaddr = sg_virt(ctx->sg);
+
 		count = omap_sham_append_buffer(ctx,
-				sg_virt(ctx->sg) + ctx->offset,
+				vaddr + ctx->offset,
 				ctx->sg->length - ctx->offset);
+
+		if (PageHighMem(sg_page(ctx->sg)))
+			kunmap_atomic((void *)vaddr);
+
 		if (!count)
 			break;
 		ctx->offset += count;
-- 
1.7.9.5

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

* Re: [PATCH] crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing
  2014-01-28 23:43 [PATCH] crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing Joel Fernandes
@ 2014-02-14 19:53 ` Joel Fernandes
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Fernandes @ 2014-02-14 19:53 UTC (permalink / raw)
  To: Linux Crypto Mailing List

Gentle ping for this fix patch. Could it be accepted for -rc? Thanks.

-Joel

On 01/28/2014 05:43 PM, Joel Fernandes wrote:
> 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.
> 
> Signed-off-by: Joel Fernandes <joelf@ti.com>
> ---
>  drivers/crypto/omap-sham.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
> index 8bdde57..fcf6562 100644
> --- a/drivers/crypto/omap-sham.c
> +++ b/drivers/crypto/omap-sham.c
> @@ -636,11 +636,21 @@ 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) {
> +		if (PageHighMem(sg_page(ctx->sg)))
> +			vaddr = kmap_atomic(sg_page(ctx->sg));
> +		else
> +			vaddr = sg_virt(ctx->sg);
> +
>  		count = omap_sham_append_buffer(ctx,
> -				sg_virt(ctx->sg) + ctx->offset,
> +				vaddr + ctx->offset,
>  				ctx->sg->length - ctx->offset);
> +
> +		if (PageHighMem(sg_page(ctx->sg)))
> +			kunmap_atomic((void *)vaddr);
> +
>  		if (!count)
>  			break;
>  		ctx->offset += count;
> 

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

end of thread, other threads:[~2014-02-14 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 23:43 [PATCH] crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing Joel Fernandes
2014-02-14 19:53 ` Joel Fernandes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.