Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4596894pxj; Wed, 12 May 2021 08:57:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCle3aEcX4Gi0Qwun+2WK3a7HrvU1tkaby15fug9zDpEquFJBOq7pE6gVlrrRyreM2Ggnd X-Received: by 2002:a50:eb94:: with SMTP id y20mr6089076edr.85.1620835028528; Wed, 12 May 2021 08:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835028; cv=none; d=google.com; s=arc-20160816; b=KcRjsfNdMheYVZEiniu27qQvPV6f7a7LPST+hHsi1A8gJsRLYCXqhbkuxvRwS/2/IR jlDyhQYAM03/2QtiV0f70vTuU5ZhnO7707eRNOL/WoEIFFXhh4VbFHG42zZ+9xR+eSFS eVTSRnJE2LHWldlQ7zI472XjWntVjTu+yeO5gnEyWHtSCsW4oL0FwhlADKmO7sgJHCyL QKRE7/2bEvnsOnb+egSmOZWWpBC5FIB/44k4CXRrUQWIKxLA38r6EE2yxGM1n3y/Anio vP4VDMlnLxc0hyScMUuVtkJCaU3fSP9IjpIoES+KBLN80niwoHM6OUScICaqWWzI0qk9 SvGw== 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=vAwimMg+2DGczH3vn4+QcXl0GytA4cYW0AjZdhaWfCw=; b=LgKki/4B9xFs+NOYgd7ty7eLz7WFbHSLsoQop8kmHYwx5OYVTaCJZ7gqb0Q966mWH5 25ljtfFyMb+C0A/l/Dn+Du4YUEvg+C92zD7ssI/yucKwyD20Gn+bcP+nodT6MuMF7BvC dFRuA8hubKpSAkUUzpr3p5viZWloq3PEgYaEeNcv2WcmCDXQwLMoL+CIyFPjUxBzIH2m Wi/t8zZM4JTOXH7nrRCkIqk322TWcZVSEYWiy75GrL4suNsQlON/IZ8dxtuvnfLwXqOP N+ZyMDvVkmUKHLCOlN/7eb18+TUkqXu/KXmo2cPKpga6RzU85CayDvFhVEeUMcoyZlB1 9NMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZTXgj9oP; 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 z10si252379eja.84.2021.05.12.08.56.38; Wed, 12 May 2021 08:57:08 -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=ZTXgj9oP; 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 S237574AbhELPu4 (ORCPT + 99 others); Wed, 12 May 2021 11:50:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233362AbhELPZ2 (ORCPT ); Wed, 12 May 2021 11:25:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A43161422; Wed, 12 May 2021 15:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832229; bh=pPovKhZw2mgMWzFFSAEYKWm+uGOl1DjU4TKaU84EZBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTXgj9oPESWI2uKNtjxXAWgpYY1s5KG2WRa3IrDN0cGXDxT61wa2lh5W1hVec/joz rVe1rciFKeYsP12xpFpIE5tj9psaQ5diZ1DbbRFC31plz9iq3S3TgbUqLKTrMLTOoB pWCq7QOo8oBcm5DE+rkmzbABQwB1eFSP7WgB+AYQ= 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 5.10 195/530] crypto: qat - fix error path in adf_isr_resource_alloc() Date: Wed, 12 May 2021 16:45:05 +0200 Message-Id: <20210512144826.246843234@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 36136f7db509..da6ef007a6ae 100644 --- a/drivers/crypto/qat/qat_common/adf_isr.c +++ b/drivers/crypto/qat/qat_common/adf_isr.c @@ -286,19 +286,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