Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp63937pxj; Thu, 20 May 2021 04:39:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfOPYZApu7jEO6UKKipUYn+lTv0zxW1VT26QUOe8Ezd4OLs2ERnZM2C/32Z/tCVNinum8l X-Received: by 2002:a17:906:4704:: with SMTP id y4mr4362664ejq.68.1621510799170; Thu, 20 May 2021 04:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510799; cv=none; d=google.com; s=arc-20160816; b=xN42GpO1TFG2YCH9funAsr7N37RAJXmDEHgjFIyQ3O+4FcgTmhoTP62YQ2/x2NzqkB DVf8SyQJvMpncuzMnHRin7v8nFUmIWrvhKpv2N/JHfOGXZq7MTBFUlwXnXZ89RozUlSu sdl+abC6uyMuYwCBzO7ock1JKfk4AT6m9poWrXuBempH4Xy5e6+HmqQwQJLfoMYib+em uufJ9zTVmqnUZNOKf+mPymQ+T5PUXwCWNhEGWVFUVCgV0SjHrIoBVM/4Ef0WZs8rpVOm qkvqXVvC85khWix7D06E0MG8PjQbvX29MaOTNJ3iU/J2988SZwWAvW2MH5s3Rmz0DEAO c54A== 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=kjXdORzn6+ZtmGLztvcyYrJiUFJGizVoKCgcLRyLxJ0=; b=WRbzY3mOm4FdL7YV6Qo1NNmmm0UNg8jzaAH15CDo5KebQ0BUkHtiIID4puXV8gJ3MT 95UAjiRqoyNTngBrl5/fEUwpaA00U76tPaJcNzZSTriaZBKp/BQZiIP+U1lq2XVmkWSi 28wZLhMzTPUc+JCQpTwegUveGDBIVgCswuUdkJNDdrX2llFQA5fik69E+YsoNsyTcoRj P6GHzz05+aTiv1Rv93xR1bR0Cm2KuTz8SCAn98OjP1goUmDPwgqaqZJvmFu86ZTyQW+V V7L/ktexViUk2qc7B62lhlpr85OA4ZvS9enLgIs7jxm768KlX0mAdf986npiSnWdg50v 2Haw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RpxObpoz; 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 w14si2155086edd.111.2021.05.20.04.39.14; Thu, 20 May 2021 04:39:59 -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=RpxObpoz; 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 S242439AbhETLf1 (ORCPT + 99 others); Thu, 20 May 2021 07:35:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:37946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240670AbhETLPI (ORCPT ); Thu, 20 May 2021 07:15:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 816BE61D59; Thu, 20 May 2021 10:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505338; bh=ou+ENJV3i4smoiBloGJ1ZtjRG07d5GSqNtGIYXSHB/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RpxObpozKvb/bTkrdFoC8CkLTZuY6qdb0Rt9IlSmedp3kkK4glhbQDiCtT9QsqnJ8 /ksOtNw0dOq1Gv4zAt/rOdvmiC9W78fNyq9jj9EOQVXxvG2+FLX27mCZMM85pwc75G 4Y6B6cSaGCdwDwhmHIYLpBqZJ0RnD0LqR2JfjxTY= 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.4 090/190] crypto: qat - fix error path in adf_isr_resource_alloc() Date: Thu, 20 May 2021 11:22:34 +0200 Message-Id: <20210520092105.182195486@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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_dh895xcc/adf_isr.c | 29 ++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c index 5570f78795c1..ddbb43da1a13 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c @@ -315,18 +315,31 @@ 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; } -- 2.30.2