Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5438018ybe; Tue, 10 Sep 2019 03:47:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmlZPmkDO09Ge+q42XGO+6ZFVQVSLpp0gy5E3hxjBh8stciGe9/npUzvtLYocpauf/xtW9 X-Received: by 2002:a17:906:5813:: with SMTP id m19mr3648280ejq.246.1568112445681; Tue, 10 Sep 2019 03:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568112445; cv=none; d=google.com; s=arc-20160816; b=PACVuLKLAHVN2RRHsgfkIowuluXC5Qm3kHEggfFTY8OOwYbqJTn6oIBSJWyRzRbjC2 gc3TAzeTZIw88/GGpoXi7XqS+DuZ/BngTl35WqMtGNMYG+i5l2M6fy8liVeZJSlWhz78 WWenBz6JP3XlVfOrkRDVZJT9tINX1MaUCBxrSHylssIzZ3Ks5ECQ96TDlFrerLu84olk 4IO9MH/lHAHt84xeBFMoghrardktyvgzicEDtwWbGaYbtrzbyP24DBN9Jf+VHBspJGtv PjSfBQqEAEH9PbaQXr8eEPMGH4ZGeVgK5jKWuN0ospWxI2HBjex0gaiGQXyRQZ5iyDjA dfxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:cc:to:subject:from :dkim-signature; bh=gaHQgkUONjgM7e5sTpiG9hKW2wcu3sDKClNiLbQr+G0=; b=nz9hpRzb9C71BLd/TJYraFBVIBCU8bw9caUBP2dJdzu0uaIw0VU9a2/EpouU8We2SN mF3dvCOVh6lmQQ25vBhov7CJ+AZKTOkNtDLcwzNmcsOVwIw68v4NqfScsYbpM7I6irYM S5vqp/M1uKSmojRB39+cD6O3JWrepT0bM01QhWdAEznwVhfFzlGYXuph3rV2YUdVbX9d jzJKtSWRw3/vcjAfUyyJq9hzIvzeOnJ25oMwaZg91d4U7PRXjl/32jSdWV7Rw182YlFA chO9wlpBMtO493aJBv9nchkYau8mpzRbFm9OBF/Mz54mff1ucIcXJpQUh/d6iOcyRUBi Bhhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=dGp+kTd8; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 27si11345279edz.186.2019.09.10.03.46.59; Tue, 10 Sep 2019 03:47:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=dGp+kTd8; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390412AbfIJGER (ORCPT + 99 others); Tue, 10 Sep 2019 02:04:17 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:56985 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730054AbfIJGEQ (ORCPT ); Tue, 10 Sep 2019 02:04:16 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46SDxp5XBpz9twm3; Tue, 10 Sep 2019 08:04:14 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=dGp+kTd8; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 0jE7q2QeiFSq; Tue, 10 Sep 2019 08:04:14 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46SDxp4Qjkz9twm2; Tue, 10 Sep 2019 08:04:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1568095454; bh=gaHQgkUONjgM7e5sTpiG9hKW2wcu3sDKClNiLbQr+G0=; h=From:Subject:To:Cc:Date:From; b=dGp+kTd8MFb+A6ub88VAvyIgBL+gNtMDiPIk6eBeQK7XvuqYXkCQksKXTLZJuRGGv edeH6l45cXSt2adFoPN8yzRPDhWXBeWKHwAsRVmfrBQtrh1EEkm/tOESAVTvLRGsJ0 5ACi3HRB8g0sQUBfz7t4mc4/f2XitC8NRbON+vAk= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 75ACC8B78E; Tue, 10 Sep 2019 08:04:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Ztk9dE8IcFel; Tue, 10 Sep 2019 08:04:15 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 35A448B754; Tue, 10 Sep 2019 08:04:15 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 0) id C1E3D6B734; Tue, 10 Sep 2019 06:04:14 +0000 (UTC) From: Christophe Leroy Subject: [PATCH] crypto: talitos - fix hash result for VMAP_STACK To: Herbert Xu , "David S. Miller" , Eric Biggers Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Message-Id: <20190910060414.C1E3D6B734@pc16032vm.idsi0.si.c-s.fr> Date: Tue, 10 Sep 2019 06:04:14 +0000 (UTC) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org When VMAP_STACK is selected, stack cannot be DMA-mapped. Therefore, the hash result has to be DMA-mapped in the request context and copied into areq->result at completion. Signed-off-by: Christophe Leroy --- drivers/crypto/talitos.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index c9d686a0e805..9bd9ff312e2d 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1728,6 +1728,7 @@ static void common_nonsnoop_hash_unmap(struct device *dev, struct ahash_request *areq) { struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); struct talitos_private *priv = dev_get_drvdata(dev); bool is_sec1 = has_ftr_sec1(priv); struct talitos_desc *desc = &edesc->desc; @@ -1738,6 +1739,9 @@ static void common_nonsnoop_hash_unmap(struct device *dev, if (desc->next_desc && desc->ptr[5].ptr != desc2->ptr[5].ptr) unmap_single_talitos_ptr(dev, &desc2->ptr[5], DMA_FROM_DEVICE); + if (req_ctx->last) + memcpy(areq->result, req_ctx->hw_context, + crypto_ahash_digestsize(tfm)); if (req_ctx->psrc) talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL, 0, 0); @@ -1869,7 +1873,7 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, if (req_ctx->last) map_single_talitos_ptr(dev, &desc->ptr[5], crypto_ahash_digestsize(tfm), - areq->result, DMA_FROM_DEVICE); + req_ctx->hw_context, DMA_FROM_DEVICE); else map_single_talitos_ptr_nosync(dev, &desc->ptr[5], req_ctx->hw_context_size, -- 2.13.3