From patchwork Tue Feb 27 13:30:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 129783 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp280242edc; Tue, 27 Feb 2018 05:31:06 -0800 (PST) X-Google-Smtp-Source: AH8x227BaVJ4FdLTUd6s+EWFICV14+Z0crC9qfdszS+RB8u7jWVzgIFn+fMkz70JSHF/1qSPXodb X-Received: by 2002:a17:902:4d:: with SMTP id 71-v6mr14316580pla.341.1519738266658; Tue, 27 Feb 2018 05:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519738266; cv=none; d=google.com; s=arc-20160816; b=H6NB5XhnOfEFD/B0rlffazTvftoVOuNhiLPyB4fkIYGtS6xzkjFG5GAV2Bxii/qqBZ LhuSPZ7tL6a1pDD9V7SdPV/BlikrQmrFc5GOjI9EA6QXW3NFzYrm7HRn3RwoArIdlZ3S J+qF2BLo+qSjZ+CmCJaS+VKOwM9J34IMMieShBHU3kGPvpu2FSvmQwpM5KlmprRYA/zR qPfj6eRPhH11kfQjMapvdxFDa6WnLUIZgH6SAu47gGlV341pek4lUXK/tuV1x5ddK990 qheT5L4o0jhSGr42rBK6ThIrMrZK6H4DhwCybsAPJBUpb6ylVkQNY7eOI0+LO4Tr2GQM tNaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=5mJb3Dn5Fwe3nXWLdsI7sR2om/QuzeaIpmSVTJovV5c=; b=GDgg6gDWe7Mj3/txvkx9ZVB/68/BVlYLLGgTmiBg3HlaN0kCyQ8FKaESrJ3+58j9RM EKondYGlyRTziiNwsFY9o41sWS3SP5BUhC+UMTm23/C6hE8D263R9YUt5innaP2cf0zP 3/o13/SJ6ZHU2S57gDvAm8uIPeCUE45tNtGlp1LkZrf1/4JE0TLNTDgfgL64ggxOKGis hF2ZhJRe5IpxHjclo6rDp+HuuBKt55n/sfa0uK9+XfVG3Uca3wYDaVvAhhfghIf6e680 hWhlY8kUQ0MxkZbb8Llpe7v1Vzw08bMZ2bMF/2MlyNT4GI3Na/np+w9uQRToiv5+IAcS 3Ufg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Wi57y/Q4; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si5585201plf.98.2018.02.27.05.31.06; Tue, 27 Feb 2018 05:31:06 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=Wi57y/Q4; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753362AbeB0NbE (ORCPT + 1 other); Tue, 27 Feb 2018 08:31:04 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:14437 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297AbeB0NbB (ORCPT ); Tue, 27 Feb 2018 08:31:01 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1RDUtFW019887; Tue, 27 Feb 2018 07:30:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519738255; bh=ic4QSj95eDhraZMnE3xmEb/IdzPN90VvXvw8nOG9fHI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Wi57y/Q4UZHUznf/C1ozwCMAVrtz2dSEtVvTUMhqY68+tPeMfEgzYvBC4ljn4X5mF +EtWPOZ7+Cl2Mt6Ridrb9oO6+jWEsN8ArCK+bKoHYXkR96tNI6L7ga6aCsVZCB72gk XQFTlFHeG+UdszsxdDm3X6rgxHJMPBwGsBotpKmI= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RDUtEA020174; Tue, 27 Feb 2018 07:30:55 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 27 Feb 2018 07:30:54 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 27 Feb 2018 07:30:54 -0600 Received: from gomoku.home (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RDUoJ1022412; Tue, 27 Feb 2018 07:30:53 -0600 From: Tero Kristo To: , , , CC: Subject: [PATCH 1/6] crypto: omap-sham: Verify page zone of scatterlists before starting DMA Date: Tue, 27 Feb 2018 15:30:34 +0200 Message-ID: <1519738239-28616-2-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519738239-28616-1-git-send-email-t-kristo@ti.com> References: <1519738239-28616-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org In certain platforms like DRA7xx having memory > 2GB with LPAE enabled has a constraint that DMA can be done with the initial 2GB and marks it as ZONE_DMA. But openssl when used with cryptodev does not make sure that input buffer is DMA capable. So, adding a check to verify if the input buffer is capable of DMA. Signed-off-by: Tero Kristo Reported-by: Aparna Balasubramanian Reviewed-by: Lokesh Vutla --- drivers/crypto/omap-sham.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 1.9.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 86b89ac..ce398b7 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -759,6 +759,13 @@ static int omap_sham_align_sgs(struct scatterlist *sg, while (nbytes > 0 && sg_tmp) { n++; +#ifdef CONFIG_ZONE_DMA + if (page_zonenum(sg_page(sg_tmp)) != ZONE_DMA) { + aligned = false; + break; + } +#endif + if (offset < sg_tmp->length) { if (!IS_ALIGNED(offset + sg_tmp->offset, 4)) { aligned = false;