From patchwork Tue Mar 31 04:22:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 6127421 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C878B9F32E for ; Tue, 31 Mar 2015 04:22:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8646200EC for ; Tue, 31 Mar 2015 04:22:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAC7C200E1 for ; Tue, 31 Mar 2015 04:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750725AbbCaEWi (ORCPT ); Tue, 31 Mar 2015 00:22:38 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:53734 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907AbbCaEWg (ORCPT ); Tue, 31 Mar 2015 00:22:36 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t2V4MWa7021089; Mon, 30 Mar 2015 23:22:32 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t2V4MVcU014952; Mon, 30 Mar 2015 23:22:31 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Mon, 30 Mar 2015 23:22:30 -0500 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t2V4MSvu017567; Mon, 30 Mar 2015 23:22:28 -0500 From: Lokesh Vutla To: , CC: , , , , Subject: [PATCH] crypto: omap-sham: Check for HIGHMEM before mapping SG pages Date: Tue, 31 Mar 2015 09:52:23 +0530 Message-ID: <1427775745-4674-1-git-send-email-lokeshvutla@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 26a05489ee0e ("crypto: omap-sham - Map SG pages if they are HIGHMEM before accessing") says that HIGHMEM pages may not be mapped so we must kmap them before accessing, but it doesn't check whether the corresponding page is in highmem or not. Because of this all the crypto tests are failing. 00000000: d9 a1 1b 7c aa 90 3b aa 11 ab cb 25 00 b8 ac bf [ 2.338169] 00000010: c1 39 cd ff 48 d0 a8 e2 2b fa 33 a1 [ 2.344008] alg: hash: Chunking test 1 failed for omap-sha256 So Checking for HIGHMEM before mapping SG pages. Fixes: 26a05489ee0 ("crypto: omap-sham - Map SG pages if they are HIGHMEM before accessing") Signed-off-by: Lokesh Vutla --- drivers/crypto/omap-sham.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 3c76696..ace5852 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -639,13 +639,17 @@ static size_t omap_sham_append_sg(struct omap_sham_reqctx *ctx) const u8 *vaddr; while (ctx->sg) { - vaddr = kmap_atomic(sg_page(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, vaddr + ctx->offset, ctx->sg->length - ctx->offset); - kunmap_atomic((void *)vaddr); + if (PageHighMem(sg_page(ctx->sg))) + kunmap_atomic((void *)vaddr); if (!count) break;