Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp546146pxj; Thu, 20 May 2021 15:53:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyij+nhUj0qcxIAIub6pzVqdE+1ljdv57G6msJRez6SuvnBiYpj3LXBlMi3kjOcjNKucDf9 X-Received: by 2002:a05:6e02:1cac:: with SMTP id x12mr6563715ill.43.1621551201387; Thu, 20 May 2021 15:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621551201; cv=none; d=google.com; s=arc-20160816; b=Z3j1o/uhDra9Cd4eBerwBijT5KKOYwhh9qcH5ORNAxo3YdcC68Tm0ErwbZ88QNwvvw JMXwgiyQkFBkaaUVZcIZ1hFkpiFFQQ2iivwP9207CB0XZR1jS2Recv4b+QbzxO69w9k7 /YPGPLQjz+CKiP2RGKwUN0Wx2e8gwHWKa1Zls1Sl8U0GR8t4Mzmz1KaKNRbhgGAAFzl0 wZauvyn4WZ/itUTU/R6nd0o0xGjhhckLkQOJ+qH6lTks8J69AFDv7Z3ToZNyvc1u45CY MyjiGrPnEUiXx13VIHiuStStpBziO41DGAC/nwoNgcCrX+zBv4LnZrPcmmT8spvHMNmr REoQ== 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=pFWcPUaRd312MzZHVBO72qn06W49pswnOIy5Z6KVyjjqaCujodHGQuL2pFEGNa5ew+ KbHE5GPVQWGS7XAniMi4DPOKGOSuWKawaix/3/l5EOydZYpxl8fm0Fr3TbNAhVwhfVHX /cieJXg+260bKFWMCM3XnaUdnV3JoE0Y8dEt0QDXLg9by8Wdwll3sj3pl+HO3p0C6q2H Q37B4TDVpL4slxsJ6TzQU3YSLA6Ol1Ib1vfuAkmSUcxWzSkmxepeskZLq2IeOv8TN1Nd evLMYaUx8X6DQfAFHZtf5Vtgp69qaj17YU7szlCfT05kTRdo3H1uuudkFGiHKICIOoTy I8dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WsMhvr04; 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 e194si3762744iof.53.2021.05.20.15.53.08; Thu, 20 May 2021 15:53: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=WsMhvr04; 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 S239652AbhETLQD (ORCPT + 99 others); Thu, 20 May 2021 07:16:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:52024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238761AbhETKzs (ORCPT ); Thu, 20 May 2021 06:55:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 134AE61CE5; Thu, 20 May 2021 10:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504888; bh=h4oVZeCEfoj+K1QV0e9G89MhnUpYbCrEBM748xBcTko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WsMhvr04De+SS0XF/yU3Flx2zWcPEWb7Leq4y2zAcBCho6cfO5nXgjzjMlTH8noI3 uMQGAF4Ba/wh019tf7cvBVqu5kUPJpD3EVo3NiGd/6L72+odQuEZFnpKi782/PZK1+ jLBWa8Xj7S0o3Np8/WKFrJCEhMEa3JTgTUZ7t4co= 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.9 109/240] crypto: qat - fix error path in adf_isr_resource_alloc() Date: Thu, 20 May 2021 11:21:41 +0200 Message-Id: <20210520092112.338541929@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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