Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4591910pxj; Wed, 12 May 2021 08:50:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiKJV3i+QTLrlR/YVgSBo85woD+TteJ5DWhmVJW0zdI2UN4CUL83a0VPfDcL8QM+B153Ct X-Received: by 2002:a05:6830:24a5:: with SMTP id v5mr26627254ots.348.1620834658066; Wed, 12 May 2021 08:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834658; cv=none; d=google.com; s=arc-20160816; b=S3Th1bPRJX1P9nQR1+veCNi9QfmrWGwzM+WI4rxEB7BpGG+UCsH+PZP8tgT6t6Lw6d 7KhB8eK04NQL/n8AT5i3lEire+I1r3tJQIQgqL+fzMwbPdK5Zm92tPdfte7s+ED/n++I 5sJ/NfhLBzmfuXY2LMKx70s4+95TNANpJTxyFAMaeGRZWpW87A/qb8k0xdAKqV8733MK 9onxzwGU602rQo0D2JRasN31mThT08EX1BBJmHlTI7ZdvBrQefVnq23EcyhTUfDNT2Aj eYVguobSp4Yv3eBeZJZwe2hUzUhT/OltHy0p7tkPvFgxc2tNoYXfNHMwEXvMfq0XZhn1 E4iQ== 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=28hhjFBJItRvYjPgB1fcLe8MT5uaN28bqBQAk9dGgtg=; b=jN6m1qJmPBmvQa3oKVx2tpShQ4hvN0N7TxkUdy+7o1l3TQ/VmWloFGfGVH/fua4cWE A4daA3YV6iHeXdpOFg51RR2cDYLvnDadof79lRsdYCV3eZjhSUq3bK3SH5EVcTN3YzyW p5bZiwxllD3JH5VzPJUxVgBDUI0f1dX4FiMREi1NQ5xP4RCUCEoxxu+5oJaQLWJcg0+V JvKAXzmzPIquWDJcSiIA8EJnu7MVlYd2ptCpuu+xr9q9nLGfI3FuJo+TXC9IHsHeQ9sM lfkt5Tc2LB9gcblFK62Q5uEXKQXg4bZxkTSJEFEAKyGnKzjR6XqtXSojqgvQJvuhYX37 Ca8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S6vO0B5+; 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 k25si323740oiw.95.2021.05.12.08.50.44; Wed, 12 May 2021 08:50:58 -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=S6vO0B5+; 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 S234901AbhELPt0 (ORCPT + 99 others); Wed, 12 May 2021 11:49:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:59826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbhELPXs (ORCPT ); Wed, 12 May 2021 11:23:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EADB619B1; Wed, 12 May 2021 15:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832182; bh=yAmlWdb299FJodNRN8GhWQJ1o+7IO7byyt8e5N+4DBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S6vO0B5+XysC9H0kh66LkT+SS4AG6qp49Sp97BPRuqi5ncObw1B0VAVvABpZRkQkB Bxz0BOGXV2UbrPs9/YxlmeJohejxRbfcF4l0yjebC9M1l8ItfmikPCDqT6m1LJ7Kq4 YB5pVSJhMVKpzIA9dast51MsPb8kMPcmNVFIA2+U= 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 5.10 174/530] crypto: qat - dont release uninitialized resources Date: Wed, 12 May 2021 16:44:44 +0200 Message-Id: <20210512144825.550766240@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: 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_common/adf_vf_isr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c index c4a44dc6af3e..31a36288623a 100644 --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c @@ -260,17 +260,26 @@ 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; } EXPORT_SYMBOL_GPL(adf_vf_isr_resource_alloc); -- 2.30.2