Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp312367pxj; Thu, 20 May 2021 09:52:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/2lXvqZj5KbGmGCog6S1lrKY7jjJPFuuE+j3VhujOo/uxUx2rZQQbPf9rgz7LfrCEh/me X-Received: by 2002:a05:6402:cb8:: with SMTP id cn24mr5883553edb.325.1621529565556; Thu, 20 May 2021 09:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621529565; cv=none; d=google.com; s=arc-20160816; b=jioafic6Nuv9yX0rLJiytVorZ+UOvGuW741/3OpmMOzpmxulbNiMP/ijagNfZOsRfB ZqAAd8AvP7HpdOHI6W/3jAE//Ebo7x3iPrLddNxWurP0GfIspjLzgLCkEfTcrYlQPs97 apYmYQWg8N+ozHP8WcU5/AE5yy9s0MGMMG5RS4SJxTmuqUzSf+QsZPmK5cXcIgbWLfD5 O5kYtAMlCoJxPCMhcFu5vaRslTlC5sXxJ7G6/aE9IKRByA1m3nkY+We5VUUskpxlS6fD jEwxKLxI0sugOEIZeG9kMQeFCCgOLx8q0uaFPvBQ1EfG0rpURRvw0/nhJ4g9Q99RIBx7 w3/w== 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=qDhevaNl6Y3AwJ35lbdQ9j0f6RU6haBs0FuUVrg0rEg=; b=rZL2wZW/84+DvyjVDLotvTeJ53eIKVWkGK4kD6Oz78cLlYRBhTPT8jUMYyFa/InfmR sICoqCX+dubhjQy333+4N7MBBBUxKVovC/obvWAq90EfCgGwQg1xbdyLBhOwvbldlP9F gdlsD6RFCXbLwz81sqLR7qrZLCr3izniObjnPLm+FAtqtG4vi3CpbVMiGjBbQNN9/pMN Sm7bi9sVHPOV7OEe6pZ3RO5idGhSpJTeDiPEmijfdAYu7EVjpF2IYhS+iMV9RrOUcIp5 5u9Xu8DJndx2yw58xCHykKOr5xYWPnZ5umkHPNX2lTkdPtMM7DgGDWrQOEPFtf7ELdDZ oKxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tFXQBnH5; 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 p3si2857425ejo.95.2021.05.20.09.52.22; Thu, 20 May 2021 09:52:45 -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=tFXQBnH5; 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 S234546AbhETJ4d (ORCPT + 99 others); Thu, 20 May 2021 05:56:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:54318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234508AbhETJwq (ORCPT ); Thu, 20 May 2021 05:52:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD10561621; Thu, 20 May 2021 09:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503374; bh=PE01LIyECFqPjnY0GUwIa/Tan1yqYuihELgMAWizvOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tFXQBnH5TiW55lH0RSvKR27ADpA2/f3pRiqYWjmENPF5IGFXFUQItyAClNCgH8Su6 E0Va/kb9WTN1PWuNk92KyUFixSAOZuxWfPrI0wGTAlNpgDRB98KcH+8YFM7Dbhuevn 5c91Uo8yF72Rr/PqqI6BmMty49xLj1027a1wMfU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Marco Chiappero , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 193/425] crypto: qat - fix error path in adf_isr_resource_alloc() Date: Thu, 20 May 2021 11:19:22 +0200 Message-Id: <20210520092137.764158590@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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: Giovanni Cabiddu [ Upstream commit 83dc1173d73f80cbce2fee4d308f51f87b2f26ae ] The function adf_isr_resource_alloc() is not unwinding correctly in case of error. This patch fixes the error paths and propagate the errors to the caller. Fixes: 7afa232e76ce ("crypto: qat - Intel(R) QAT DH895xcc accelerator") Signed-off-by: Giovanni Cabiddu Reviewed-by: Marco Chiappero Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/adf_isr.c | 29 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c index cd1cdf5305bc..4898ef41fd9f 100644 --- a/drivers/crypto/qat/qat_common/adf_isr.c +++ b/drivers/crypto/qat/qat_common/adf_isr.c @@ -330,19 +330,32 @@ int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev) ret = adf_isr_alloc_msix_entry_table(accel_dev); if (ret) - return ret; - if (adf_enable_msix(accel_dev)) goto err_out; - if (adf_setup_bh(accel_dev)) - goto err_out; + ret = adf_enable_msix(accel_dev); + if (ret) + goto err_free_msix_table; - if (adf_request_irqs(accel_dev)) - goto err_out; + ret = adf_setup_bh(accel_dev); + if (ret) + goto err_disable_msix; + + ret = adf_request_irqs(accel_dev); + if (ret) + goto err_cleanup_bh; return 0; + +err_cleanup_bh: + adf_cleanup_bh(accel_dev); + +err_disable_msix: + adf_disable_msix(&accel_dev->accel_pci_dev); + +err_free_msix_table: + adf_isr_free_msix_entry_table(accel_dev); + err_out: - adf_isr_resource_free(accel_dev); - return -EFAULT; + return ret; } EXPORT_SYMBOL_GPL(adf_isr_resource_alloc); -- 2.30.2