Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp62818pxj; Thu, 20 May 2021 04:38:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdvgsb6yBRxjdxbNIHy0decsUAfs2G9CiGOuJaq3lKW62iKuumfoC4LEEoQeud0OwEWPf3 X-Received: by 2002:a17:906:f6cd:: with SMTP id jo13mr2336420ejb.493.1621510699246; Thu, 20 May 2021 04:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510699; cv=none; d=google.com; s=arc-20160816; b=GXi0NTDS0yz0nZWPCJiWvXgSJ0vA6UjnTseR0szwBZCSug5+ps7CDJznjHiYX3PGZA Kam4zdPd2t7wcQxrLJVYYZGfO7hPsLfkBnkQ+B1S8h1RPBA8isvqL37Ga4jIwzPF/9c6 1jfMPovLqdhJsrvzyk+SWa2BQP/BYV7gngIlWiXS06LeMRwAAfaGqh2wDTt9Zm2p7b54 BZ8pZsCUHgM/hR9dGjNm3kR2cI0syBO6n8dKxJIHQ8deZ56ediDgRnSEMVT/42RZF3Z5 LfnvqtcN37JioVokBq6t+eXjsE45QTeSoqhza3bmglc3owyCni6OEVFw+LY7BFQawcO8 gEDw== 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=hQ3EqCMmOvQoqH6zfbH3JwEkG3a65/8mTHcxQDR5z/w=; b=ynK8DZ0qxDcLDBty14nGsqmNovUHafZE2qoBkFxXAgf98FuOnYw+Vnimhu+np3N6EO ybxgO64exdZipdZru5xw+B0ZWJRag3QObJYo6vVlLOrySyxxgO3U9snBGkgOZcIz7nNh LC4bvBlaKO1CuHMbICUrA21IB9s0n/YFDD3bnHBloqWKAs9yB5bzFnSuRDFXABcEjN/z nKk0w4oHuPYFK8bR3ZX58+MwCURQ5KrousPZ7uqBxPk77vR27kX8FkESdU5eXaFbgTUi JL7J+ed8Z61dKX6v3Z/9r3NS8L5byg2vetBdmRohjLzx74av0/4flofrIPD7Zph87mlg zwTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xuAvh9em; 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 a22si2117242edv.404.2021.05.20.04.37.55; Thu, 20 May 2021 04:38:19 -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=xuAvh9em; 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 S242281AbhETLfQ (ORCPT + 99 others); Thu, 20 May 2021 07:35:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:37104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240588AbhETLO6 (ORCPT ); Thu, 20 May 2021 07:14:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE7D261D53; Thu, 20 May 2021 10:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505320; bh=mm6V7jTVqyfkYM37+H9mcbPuLHSTEq9joh/dDz7BSXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuAvh9em52bdiATjHKzPL86ICwiDSngRcaSfWgFnVn38MfUZOspAJixVKV75A22Mj S8A4f3a1r6zzY6s1Z+NG34daaItuP+fNZrEJjJP3m2srz5FZX86+rtkWBREpIrLSFA xYJP/waOkgEkGPlq4WYMs+Lw2abuiu2NSHZdyKqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tong Zhang , Andy Shevchenko , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 4.4 082/190] crypto: qat - dont release uninitialized resources Date: Thu, 20 May 2021 11:22:26 +0200 Message-Id: <20210520092104.907887953@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: Tong Zhang [ Upstream commit b66accaab3791e15ac99c92f236d0d3a6d5bd64e ] adf_vf_isr_resource_alloc() is not unwinding correctly when error happens and it want to release uninitialized resources. To fix this, only release initialized resources. [ 1.792845] Trying to free already-free IRQ 11 [ 1.793091] WARNING: CPU: 0 PID: 182 at kernel/irq/manage.c:1821 free_irq+0x202/0x380 [ 1.801340] Call Trace: [ 1.801477] adf_vf_isr_resource_free+0x32/0xb0 [intel_qat] [ 1.801785] adf_vf_isr_resource_alloc+0x14d/0x150 [intel_qat] [ 1.802105] adf_dev_init+0xba/0x140 [intel_qat] Signed-off-by: Tong Zhang Reviewed-by: Andy Shevchenko Fixes: dd0f368398ea ("crypto: qat - Add qat dh895xcc VF driver") Acked-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_dh895xccvf/adf_isr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_isr.c b/drivers/crypto/qat/qat_dh895xccvf/adf_isr.c index 87c5d8adb125..32f9c2b79681 100644 --- a/drivers/crypto/qat/qat_dh895xccvf/adf_isr.c +++ b/drivers/crypto/qat/qat_dh895xccvf/adf_isr.c @@ -243,16 +243,25 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev) goto err_out; if (adf_setup_pf2vf_bh(accel_dev)) - goto err_out; + goto err_disable_msi; if (adf_setup_bh(accel_dev)) - goto err_out; + goto err_cleanup_pf2vf_bh; if (adf_request_msi_irq(accel_dev)) - goto err_out; + goto err_cleanup_bh; return 0; + +err_cleanup_bh: + adf_cleanup_bh(accel_dev); + +err_cleanup_pf2vf_bh: + adf_cleanup_pf2vf_bh(accel_dev); + +err_disable_msi: + adf_disable_msi(accel_dev); + err_out: - adf_vf_isr_resource_free(accel_dev); return -EFAULT; } -- 2.30.2