From patchwork Wed Jan 3 13:35:20 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: 123311 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10182233qgn; Wed, 3 Jan 2018 05:38:32 -0800 (PST) X-Google-Smtp-Source: ACJfBougO8QAWpsG81U43xLEFF3NnReLF0vCeqXwAy/9BoprPTNvL0sXO5bMYfy3i79VA7YXCCFM X-Received: by 10.99.121.79 with SMTP id u76mr1234146pgc.337.1514986712849; Wed, 03 Jan 2018 05:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514986712; cv=none; d=google.com; s=arc-20160816; b=gFjp3CHf+Nw6o0A8YghbGPAqpIDUfa56/wldKyK4CDaDu5Hgk9x8zOmxouUxxf3Azf EOEWyQ6n78RRGsw9GnPhsBJ38r2gZQHXO4Hd/zYPVyKwPgLrXDMMixxmmfjQmUaVFCWV O485Y96Plb9ePeSBuPgYshU4YOeRVDplcZJi2MPbAOjlQEGh+OL01dt/RlNtaOKKNWQn K1H5oI21v/qCCs4DzEgvRkYhZ/koX8NK5VGP+ii+azmoERJNzWMa2k13GjQtRWM+jvZj xO5Lk5Z2gTI2sdViUQJorw0zZuefI5rOO2ypZxNTsuyp9dJOgL0au0ynJsR/S0lBLufJ 2BYg== 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=ZltmZsFaV/0E1UoDKSy0exHoZ60onNkh2XuBpRE4WHw=; b=SnhNmdLfrGSZnnxHWfI4gCFOy0irVVHnv1mjMHmzwcmwZ31ZcN1drS8Y35CYr2m6Zf pVz31znfnp9Zw7yyzPpVfBUP2DJLgJsrrFHIiMzeUWtrBs1BI72Z1i8TmmepzsLX5gte QhoXN355pHDJpLci1gkb4KP2uwkr1p0eCW5ryvlYDrBl0JdEbFOtIODjCLAa/k1BW4dP oI5M2rWfIoOGmuoVmYJ/Mn+eibbpt7FJX4Kv+uld11p6/sxahgYFl9zUNhDhMuI7PXfn hvxRpnn5ripcZBkFcim4qx7HTmggWpztkjqf8KBx09xmMpKuPGdyJeJSuuE5YLEywx0O 251w== 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 k8si652844pgf.107.2018.01.03.05.38.32; Wed, 03 Jan 2018 05:38:32 -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 S1753104AbeACNi3 (ORCPT + 28 others); Wed, 3 Jan 2018 08:38:29 -0500 Received: from foss.arm.com ([217.140.101.70]:50126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbeACNi1 (ORCPT ); Wed, 3 Jan 2018 08:38:27 -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 1E38E1529; Wed, 3 Jan 2018 05:38:27 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 622DA3F24A; Wed, 3 Jan 2018 05:38:25 -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 v2 13/27] staging: ccree: check DMA pool buf !NULL before free Date: Wed, 3 Jan 2018 13:35:20 +0000 Message-Id: <1514986544-5888-14-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514986544-5888-1-git-send-email-gilad@benyossef.com> References: <1514986544-5888-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 5e3cff3..13cb062 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);