From patchwork Wed Nov 27 08:49:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 180274 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp5815010ilf; Wed, 27 Nov 2019 00:49:27 -0800 (PST) X-Google-Smtp-Source: APXvYqxaBhu6zPwlWbSmojcZoW7wqDPAPnwKGBEMR0vTwXBVpXZ8PAg58lIavH6eIs6sDoTej+ri X-Received: by 2002:aa7:d904:: with SMTP id a4mr25910213edr.44.1574844567137; Wed, 27 Nov 2019 00:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574844567; cv=none; d=google.com; s=arc-20160816; b=PdduBRL5nLKFvybN8s3hTzZmhM+y882uXtY17WE/snhNLkPPjWmnZ12SCW7Yv9+HMD b25IkPLKn8pKkIJfaiMVg34XayV/m8wsxa59tykpdPyaKCnu9xTw5lQ2ZYLlRZjjTjOQ 0Ds8QqgFuzY+OIdrJUbicY3K9+3fASSzM3ArVyYrBoAZKPEVZo7tDyF6MNAfxf5/AyeT ciDq8pelEVQ5LM5/W1d8pYUAyXSs6a7akI04Es+C1QIKZKxvMBEaEIcRYKkOkr3WfKPb YNQwVb4z3XvN+NThMbm4ubxodE+wLzXl1hh5s4S60uxVOiSvAtUV45bQzvhrUOBs4FTY dxow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=m3Ru12+focgmVJCoZuVMQX9o+opiE4JNiHa2Kk8i3OQ=; b=SmC+FO+sV1RKDQu8pfvy8Nqf/54fUd3NE4qA2ZkzEGrwnUJXEzvHe7qRcH34jh6i+q q129+R4Lv7nqOitAqnYuCvcIn6rAZMtwIDtpNiEiJgFCrnf7JLQGvd7d0ftTza1dSGyg ysKQjEBOE9+ESByX5QhDGStHA8HCcFUTBZW+3MzzLIXNE6cWTJX0qXgqhg2tf+D7LnGG I4CJ1Gi8UTqS5P0LnZJXKo08uV2iUoPTyyX43U40UDC5Lin6t2gUpNMw5Zc9UMd300u5 /EmGr5hctRyMDupQfQhWD3J/gwx/CS/DNwoHe/PTpEyUimsjLF6IXhHsukgH+jqPYI1t 421g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 l16si1469516eds.161.2019.11.27.00.49.26; Wed, 27 Nov 2019 00:49:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726673AbfK0ItY (ORCPT + 26 others); Wed, 27 Nov 2019 03:49:24 -0500 Received: from foss.arm.com ([217.140.110.172]:44544 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbfK0ItW (ORCPT ); Wed, 27 Nov 2019 03:49:22 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DDF03328; Wed, 27 Nov 2019 00:49:20 -0800 (PST) Received: from e110176-lin.kfn.arm.com (unknown [10.50.4.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A99453F52E; Wed, 27 Nov 2019 00:49:19 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] crypto: ccree: remove useless define Date: Wed, 27 Nov 2019 10:49:05 +0200 Message-Id: <20191127084909.14472-2-gilad@benyossef.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191127084909.14472-1-gilad@benyossef.com> References: <20191127084909.14472-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The define of CC_DEV_SHA_MAX is not needed since we moved to runtime detection of capabilities. Remove it. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_driver.h | 1 - drivers/crypto/ccree/cc_hash.c | 2 -- 2 files changed, 3 deletions(-) -- 2.23.0 diff --git a/drivers/crypto/ccree/cc_driver.h b/drivers/crypto/ccree/cc_driver.h index ab31d4a68c80..7b6b5d6f1b33 100644 --- a/drivers/crypto/ccree/cc_driver.h +++ b/drivers/crypto/ccree/cc_driver.h @@ -28,7 +28,6 @@ /* Registers definitions from shared/hw/ree_include */ #include "cc_host_regs.h" -#define CC_DEV_SHA_MAX 512 #include "cc_crypto_ctx.h" #include "cc_hw_queue_defs.h" #include "cc_sram_mgr.h" diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c index bc71bdf44a9f..aee5db5f8538 100644 --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -2358,11 +2358,9 @@ cc_digest_len_addr(void *drvdata, u32 mode) case DRV_HASH_SHA256: case DRV_HASH_MD5: return digest_len_addr; -#if (CC_DEV_SHA_MAX > 256) case DRV_HASH_SHA384: case DRV_HASH_SHA512: return digest_len_addr + sizeof(cc_digest_len_init); -#endif default: return digest_len_addr; /*to avoid kernel crash*/ } From patchwork Wed Nov 27 08:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 180277 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp5815159ilf; Wed, 27 Nov 2019 00:49:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwORHDFKZ+5x0JczVpzRKHWWNtz5qCqopEbB2u5jMqEVFY7NiCXHzlMRsiVyYLuUe1nb30k X-Received: by 2002:a05:6402:1d8f:: with SMTP id dk15mr1247092edb.29.1574844576539; Wed, 27 Nov 2019 00:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574844576; cv=none; d=google.com; s=arc-20160816; b=WPS2DaSLDfYfau8bUkopR10aQ3loZc+qqVrDr2VoSHV+EFQ3YXSHYJJZvqB+kF0bIi fbemPQkscZt2KjbP/i7bOUXSMVZeSChh6rcIi9u4alwWaR1K83RgntSMtm0fHzo8ZErZ Zm0ip1zn+ixeX1eam76W/o6Q4UFiBIPhPK+D2mpJ6y/6Wb+N48raTC9K4c5k7bF6vFmQ xTgdLWC9/92aUir6e3VMRMV9tOhYfJYl6zcEIQYJpSKBO6OdhuY2zOg08NVPICdB7VrD mKkZk8csNBU6B8O8GdW2AQStqUgOJImvtO6mulCzwLErfaXWXUb1Z81nbbU5L2eVw3DX 4Jwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=o873lY7sS08UnyFnQ1V9h7KzCynMaRiQYvbnwbg71VQ=; b=zi+J954im9uUEgDG8lGlnv8ZPeRZoWUlX/hs29l352zBOMBz8BIidoD0/c+EZJWRzL sdNMCTczISwXTX4bo68Fb0dEp8Y9UiK4IwSfebRT5TV7tDep5MSRBFzYFMjGnNcfofAi giAbLRaY2YPFGc33HSrTx8qGEL3PZVAluMAialI7BeTi/E7LLf/r8/AO5K27MTWdp+ys jafOeH6TWytG04Wr7cZ2SKLF/P44qfZCRb1gizQc03bijIzNZHF6v44TXxuAOPFsdMFI TC5CjKh+dhXJYaDTio10Jevla2RLFjDcMy1loXmbztkdRkt1Scq8h8ZSDQjyv7mNokHZ iDww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 ce17si10238670edb.368.2019.11.27.00.49.36; Wed, 27 Nov 2019 00:49:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbfK0Itd (ORCPT + 26 others); Wed, 27 Nov 2019 03:49:33 -0500 Received: from foss.arm.com ([217.140.110.172]:44570 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbfK0It2 (ORCPT ); Wed, 27 Nov 2019 03:49:28 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FC6031B; Wed, 27 Nov 2019 00:49:28 -0800 (PST) Received: from e110176-lin.kfn.arm.com (unknown [10.50.4.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D4DCF3F52E; Wed, 27 Nov 2019 00:49:26 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , stable@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] crypto: ccree: fix backlog memory leak Date: Wed, 27 Nov 2019 10:49:08 +0200 Message-Id: <20191127084909.14472-5-gilad@benyossef.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191127084909.14472-1-gilad@benyossef.com> References: <20191127084909.14472-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix brown paper bag bug of not releasing backlog list item buffer when backlog was consumed causing a memory leak when backlog is used. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ --- drivers/crypto/ccree/cc_request_mgr.c | 1 + 1 file changed, 1 insertion(+) -- 2.23.0 diff --git a/drivers/crypto/ccree/cc_request_mgr.c b/drivers/crypto/ccree/cc_request_mgr.c index 3ed3164820eb..a5606dc04b06 100644 --- a/drivers/crypto/ccree/cc_request_mgr.c +++ b/drivers/crypto/ccree/cc_request_mgr.c @@ -404,6 +404,7 @@ static void cc_proc_backlog(struct cc_drvdata *drvdata) spin_lock(&mgr->bl_lock); list_del(&bli->list); --mgr->bl_len; + kfree(bli); } spin_unlock(&mgr->bl_lock);