Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp415795pxj; Thu, 20 May 2021 12:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJZpx0Z73BLAzJ9lpWbiz0UQgUGDbeea7X9bBd+OwN/3bcht4ZoURPsmxANY9AiaeOxiGv X-Received: by 2002:a17:906:6042:: with SMTP id p2mr4057028ejj.244.1621538266115; Thu, 20 May 2021 12:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621538266; cv=none; d=google.com; s=arc-20160816; b=GxvGK1WD/+4MtvGHzfTMkDw5MA0FHkzXHqdPmsjR71uPhxShbOq3Gb3QAz93b/wxWp 7g+i0fxaJEJaDn9tSrGVFSBSs3xQvjHR/7LjZB0t5UUdS2AmaUrODd7u4DfyKzC5nRM7 LTfu+nlAKNU9TAkSEgXGs8lkwwv3wdMntHssky5OTj7H8umzA1iwDTtrLK1ryZU1v3oW MDxPyENzWar8rMXG+340wBq8sL58WuYAVb3rcqDU3UX9FaNiVUftxl8pGcir5nx+PXas 4v/ysYn+fCiDST9zO0E6w+i9SxNZz+atcOxPhf4OSsOeIX7GruTA/ufAxRAUKDjtGXUV JBVw== 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=B9PdLUeKc/T+WeQ0ijFbQA/Lq9j8Tjw6Lwg4oA77v8Y=; b=dvcmTdw+saTgVQVL3nfbjt51zlIY4ki3TOJxVPeZJ6GJ1cJOWzsKElfBeZl60oHq+1 rOXAO7AHlgFiglc6P2E0oQzY6OpgA08jwGJPkt1f97Tvb0RJNjjNoCKSYWyoug1Ui0Eh 5ujxRb+ejVj1mL0KDKskcK9UOI5PGD08ptoDMMBBEiOfhTl2zWVt11w9CwcOU9EzBJ+I UErzOJ3p5WC0AzxuJKG18eIENo8/0x47wPM8bgw+Dv7plyaMWfN2njuz0PGiYdT7fkWA TKAihWtCsCehKBhQxx1dZxagjKCIYAm6Isb4tX7JWRrzagdgM9P0eoQ5/ounCH3Fix1Y KS5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xPJRKjse; 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 gb34si2976264ejc.697.2021.05.20.12.17.21; Thu, 20 May 2021 12:17:46 -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=xPJRKjse; 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 S237888AbhETKoE (ORCPT + 99 others); Thu, 20 May 2021 06:44:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236356AbhETK2J (ORCPT ); Thu, 20 May 2021 06:28:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 845E161C29; Thu, 20 May 2021 09:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504253; bh=h4oVZeCEfoj+K1QV0e9G89MhnUpYbCrEBM748xBcTko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xPJRKjseQd0CPQpr2u8msWFwdrzPWhtT+SGENZEflik81K2uGaqd6JJFSo+sDAkNJ lN1+muy5FAsKla7CrVIdDr484h/xAiH7DbWLr6nZXbnRpcQqXSjiphljTEUt0XAEaf 76Ax22YCnwc1Rf3eOtRDXUTp7KNkCsHYZARyrbcM= 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.14 160/323] crypto: qat - fix error path in adf_isr_resource_alloc() Date: Thu, 20 May 2021 11:20:52 +0200 Message-Id: <20210520092125.591553861@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: 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 06d49017a52b..2c0be14309cf 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