Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp433633pxj; Thu, 20 May 2021 12:47:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+VSQAPSAf4vL0vqxHqj88J6wqQvf515QnoW18XxK9a4aUBzviHHL/4fQSp9ZAlunJYeco X-Received: by 2002:a17:906:1399:: with SMTP id f25mr6437793ejc.29.1621540041674; Thu, 20 May 2021 12:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621540041; cv=none; d=google.com; s=arc-20160816; b=YALhkYV68oVN0FvFCSDF7F3vRe6CH16G87Bf9HZIingmzxbnm2EpLzWj9BiJpANypY Smw1lceFa0fvCN+Du1TDuORkVE/Vt2nPMgHIiU3SU2OpQps/pFRDPEzHFxS0OZPkiCpL oZD0VMuToB8J3mp4qvTqftHV2WtceNHhjyOpwFJdhhZxk2mbasp+9wbGYpeAk/LXRiXD T3CeMZv8RobU5qKEUoUw4Si4Ibgk3P3CKtGyKAvjlzPnTdgF8U1SMfOjklKErN8PeG4N +2BhDgiSoIdG4JtnuJvdy5+TNedCrP60UQAP6gSbZ/kgURqnLJ3gqfkdlhBi6uQG+Cfg LZoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pp7VssTOPfT55fMdIg5++Je60rKDUuvhaNlWoF1U7cc=; b=pYTxRaGMVzrfiUUILaiI4nGUlcONLSCZMEpgrXd+MddQ25/s9JyhS03QWD6YC7pKMB CrzLVfcfi2cU5B2CeP20lFR6zl57p5IecBvoruyS3xcORWtm56n8KJPCblCPbCn0lwP2 3YCNTF3e5iD1olF97fv5FcLfnCSUv/mAKxSwOvpDubXZQSZpETHiUIXtuTTNwPTa7INy fNPofnfyMqty20ITdmyIVo+BnoeBlwCfVbP7/IQbVS2jtJ76BgpELwhHIDxpBc64//83 D0zCnQsLQ1k27lt2eHKYruSJMVxW3XsN0k2qeXP5vwmnDvfsB7VnvzlCm4sA5MgGz58h r4Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HwN7nfW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr2si3653795ejc.274.2021.05.20.12.46.57; Thu, 20 May 2021 12:47:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HwN7nfW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237670AbhETKm2 (ORCPT + 99 others); Thu, 20 May 2021 06:42:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236667AbhETK05 (ORCPT ); Thu, 20 May 2021 06:26:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AB0961C26; Thu, 20 May 2021 09:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504226; bh=+qUpnmvumi9wFaNS6zSghXEbPM3w5EdTruS5jqAL/UY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HwN7nfW+GZiK0JmgcEAliYMe/ggsOHaUJ9H0uwHpZAO1SIQeJCDSqPxul9JDhAvs5 jBXDLj+aQ/JuoQVhjgTHWM1nHbWOO2zrpX9ewQSkqyt1W9hg9eBXdKVexDlRw9Y47U psSA0rcoMrLya8607ZihvKtQxKmW50uzFBjgMg8g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tong Zhang , Andy Shevchenko , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 149/323] crypto: qat - dont release uninitialized resources Date: Thu, 20 May 2021 11:20:41 +0200 Message-Id: <20210520092125.215364508@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tong Zhang [ Upstream commit b66accaab3791e15ac99c92f236d0d3a6d5bd64e ] adf_vf_isr_resource_alloc() is not unwinding correctly when error happens and it want to release uninitialized resources. To fix this, only release initialized resources. [ 1.792845] Trying to free already-free IRQ 11 [ 1.793091] WARNING: CPU: 0 PID: 182 at kernel/irq/manage.c:1821 free_irq+0x202/0x380 [ 1.801340] Call Trace: [ 1.801477] adf_vf_isr_resource_free+0x32/0xb0 [intel_qat] [ 1.801785] adf_vf_isr_resource_alloc+0x14d/0x150 [intel_qat] [ 1.802105] adf_dev_init+0xba/0x140 [intel_qat] Signed-off-by: Tong Zhang Reviewed-by: Andy Shevchenko Fixes: dd0f368398ea ("crypto: qat - Add qat dh895xcc VF driver") Acked-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/adf_vf_isr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c index 4a73fc70f7a9..df9a1f35b832 100644 --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c @@ -304,17 +304,26 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev) goto err_out; if (adf_setup_pf2vf_bh(accel_dev)) - goto err_out; + goto err_disable_msi; if (adf_setup_bh(accel_dev)) - goto err_out; + goto err_cleanup_pf2vf_bh; if (adf_request_msi_irq(accel_dev)) - goto err_out; + goto err_cleanup_bh; return 0; + +err_cleanup_bh: + adf_cleanup_bh(accel_dev); + +err_cleanup_pf2vf_bh: + adf_cleanup_pf2vf_bh(accel_dev); + +err_disable_msi: + adf_disable_msi(accel_dev); + err_out: - adf_vf_isr_resource_free(accel_dev); return -EFAULT; } EXPORT_SYMBOL_GPL(adf_vf_isr_resource_alloc); -- 2.30.2