Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp816288ybl; Wed, 11 Dec 2019 07:58:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwPpocXG4sw20v2KGSa1qL+UB1QZkmv0mp/Jt2cbsHjmOQ+AeRqT9+GohVF22bQvtdARCD6 X-Received: by 2002:a05:6830:579:: with SMTP id f25mr2899590otc.248.1576079883753; Wed, 11 Dec 2019 07:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079883; cv=none; d=google.com; s=arc-20160816; b=BxXy6lJOPx4CxdRjIV33vt3GY9q0gYey6f/JkmZLUdIAmZ7/vXNjIMjt3o6wCKe1mh gQFKP8ixQGdqygkNrzDNvCuw9q3O/MURoX7CDoiLrpWATt1VRTGzaLS7/Ru9uFoJfbsf S+JOwWiuEIcrALaxLthI5vYM//t7CtjX+2/AzgzwrSllx26P+Ahz4BvhIHy17CPKEIT8 PURSLcCKsDVHYS1FRjcK9GKNlc3qmrp0ah9D7YM+vB98J0RgkJQfBoD+49Z7K6hQo1ju G8vNlFbRNc2yuHAATB0tPubvuTlbOvfcdj2GMuztXVDVGImZlhuoPeLJb2KWLQSjmxqx gV/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Z08dDmu1C9Y5rlwYUg2F9MWbLWZioHW0FB6sUmv3cw=; b=EPL7xK03nxRCbAT3Wr5AFTFyAfb34dDHmcdBtoWJ8NARo+Dtee1/7Y0Ye+OEcRGm7e +CVmr0R3evgx8ROCb4kqvrdVEhWgnu8kWEOKNwdhuIvSsFg9L0FVzuvHpcJj2/nFPGbZ iXhKueiWJ0welFg5OOHMGmluBX1R9pvXplfR6fVnwJxtGtsFbsg1xgo2FnZivueATnwc ll8ZWKUBsJkk2shH2VSPnmvYtqNpB7SjGMRoYVx56TLc/zh9cQYfzjhZOZp4qHtep66D DTn3AWW4ga0r4BR2bnt+WYSFP5Y1qwoHqr22hujIp21uiyIAj432Z9cTEN7tofco8Anx HC/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KQApkc+S; 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 t18si1386681oij.133.2019.12.11.07.57.50; Wed, 11 Dec 2019 07:58:03 -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; dkim=pass header.i=@kernel.org header.s=default header.b=KQApkc+S; 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 S1731578AbfLKPPp (ORCPT + 99 others); Wed, 11 Dec 2019 10:15:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:40746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729955AbfLKPPB (ORCPT ); Wed, 11 Dec 2019 10:15:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E8DAB24654; Wed, 11 Dec 2019 15:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077300; bh=bEPZPVL0vaFMoN9AWWf5BU7pfcm6B55ATdt3z0aCsvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQApkc+Sb+2lnhOSH4dwYhmmmW4qG8nXgIsZfH+1pmxVrtQuUIaXjtB+1KcJ62Y12 Nw1JpemlS0qObvBxUa4y5gbrNc0hHBeFLjYibZm5kVZXmgoB3dYzzG/4Q3n2h/bcvD 82ZkPFxsvNuPNpGJA7a0filYaPddI/KzMWwIMvgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Lamparter , Herbert Xu Subject: [PATCH 5.3 085/105] crypto: crypto4xx - fix double-free in crypto4xx_destroy_sdr Date: Wed, 11 Dec 2019 16:06:14 +0100 Message-Id: <20191211150258.847739471@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Lamparter commit 746c908c4d72e49068ab216c3926d2720d71a90d upstream. This patch fixes a crash that can happen during probe when the available dma memory is not enough (this can happen if the crypto4xx is built as a module). The descriptor window mapping would end up being free'd twice, once in crypto4xx_build_pdr() and the second time in crypto4xx_destroy_sdr(). Fixes: 5d59ad6eea82 ("crypto: crypto4xx - fix crypto4xx_build_pdr, crypto4xx_build_sdr leak") Cc: Signed-off-by: Christian Lamparter Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/amcc/crypto4xx_core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c @@ -365,12 +365,8 @@ static u32 crypto4xx_build_sdr(struct cr dma_alloc_coherent(dev->core_dev->device, PPC4XX_SD_BUFFER_SIZE * PPC4XX_NUM_SD, &dev->scatter_buffer_pa, GFP_ATOMIC); - if (!dev->scatter_buffer_va) { - dma_free_coherent(dev->core_dev->device, - sizeof(struct ce_sd) * PPC4XX_NUM_SD, - dev->sdr, dev->sdr_pa); + if (!dev->scatter_buffer_va) return -ENOMEM; - } for (i = 0; i < PPC4XX_NUM_SD; i++) { dev->sdr[i].ptr = dev->scatter_buffer_pa +