From patchwork Mon Jan 1 12:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123044 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7796821qgn; Mon, 1 Jan 2018 04:09:44 -0800 (PST) X-Google-Smtp-Source: ACJfBovoz92QQ7hEre/UT/rDJSD3csuOHtHje8RJNyu+HgjFW4Bqv7ZNOOud7fthxMJZDQDUsa+F X-Received: by 10.159.211.10 with SMTP id bc10mr43267916plb.160.1514808584122; Mon, 01 Jan 2018 04:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514808584; cv=none; d=google.com; s=arc-20160816; b=gMCd7AjxD8raEYC2Y0HQkDEvtLMtfWGR+iY+8695S2mEXfvbmOk4Dh9W8KNc6/cH+U EmaVQ8r1uxw9Grif5DgtOOAX4rVpXJcOq2H6mdi8oAOM+AnOsS6gbArFCkE1SVmyz1/i NFt4TFpl5haB4/dFoCR/nDxqVFvjQOsWhVmUH1GoWi5pDBRh4Ym/Eo4jE/8xDirqsiz1 wX9zhdKU/jqGdEz9qzBXri6SzolyYTSvwINg8aR1fu1DUqhMoPUT7/Nomo4/YWVsuru2 gQKIyy9vibkZ2DI3WSVNcL2T4j0dp0RvK1zumdPnlSdPvRQoZynPSSJ+jUowa2Ai7nxn nPmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tWRz3pw317y5hi/qKj935PxHrtyjXuaiAipPW7KCxzQ=; b=M0DvGER52F2ksH5uBM8oNUMNwh4Xr4uga8+jxPeUluNNqQVbEhH7NvF0UrnDRjlV2c o/FjCmYBZ7snxoXWjzyIMWzMDFWT1bHXidXKVZaaaXqZB9rKExIJvRnqABhnpS/FZRjz e3bUgirQHLph68Hrf+F7THvrqazy6FGLIiqudPII83kneg76/7lWRWaL0w+YO2ZLEr/B g3iYFU2tUC1QUUvT6PJqsRb3cYgfBd15e1mbQxmblOtG1E1lIdk/T2nNeKBQ9H15R+4z UqvZcnQ+jZlv11YGNKRRs2UybqUGc60MKeLdVh8siBzg63jAGKF5r6K6N2F3b57hU4eJ uZAw== 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 i1si31928345plt.485.2018.01.01.04.09.43; Mon, 01 Jan 2018 04:09:44 -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 S1751390AbeAAMJi (ORCPT + 28 others); Mon, 1 Jan 2018 07:09:38 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59156 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbeAAMJf (ORCPT ); Mon, 1 Jan 2018 07:09:35 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9691280D; Mon, 1 Jan 2018 04:09:35 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A47483F41F; Mon, 1 Jan 2018 04:09:33 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 13/26] staging: ccree: check DMA pool buf !NULL before free Date: Mon, 1 Jan 2018 12:06:40 +0000 Message-Id: <1514808421-21993-14-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514808421-21993-1-git-send-email-gilad@benyossef.com> References: <1514808421-21993-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 795f403..33b9709 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -465,7 +465,8 @@ void cc_unmap_blkcipher_request(struct device *dev, void *ctx, DMA_TO_DEVICE); } /* Release pool */ - if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI) { + if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI && + req_ctx->mlli_params.mlli_virt_addr) { dma_pool_free(req_ctx->mlli_params.curr_pool, req_ctx->mlli_params.mlli_virt_addr, req_ctx->mlli_params.mlli_dma_addr);