Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp340556pxj; Thu, 20 May 2021 10:30:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIWyNrfRvU6ocfa/x8zboZa5RyxuOPwQX0Itd9hyv414CUqNCbVLKT+qATqMbTg1E8JkY/ X-Received: by 2002:a05:6402:40d6:: with SMTP id z22mr6298236edb.125.1621531841804; Thu, 20 May 2021 10:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531841; cv=none; d=google.com; s=arc-20160816; b=ym0vjgkEQ7xIWJrUhjHvCQw+2bNmYsqbtQiaulus6YCpVl3zfq1W3YoEvcStU59d+z V1xBlC+yJB51BJpoctAFESEtIqib3B3x8D90XaYU9Kf9CxvfY5OnapO/VaM0rofxlrkK Mgs6PnMHdTt3mTbs+tjW10N8HEhFYhIrGxuCEDeUe67HHQpxVdwxPztuQXbagt0rk+qq OwY2qWmLed2KhbR0m6ulL16qKN0MNkOUSXusBEy5r5iZZ7+z32MTg1kFRANsR0sqY5zS C2e6x8UsUDOp/ZPgDaDZZTf0V8kXYqCXzmt7pn3q6Lo47FJKxn+c8KaaGHO7dfinMCFM 0Aqg== 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=pp7VssTOPfT55fMdIg5++Je60rKDUuvhaNlWoF1U7cc=; b=T1RyVWmUZRnvVs65ZZTSNFIQcfe7YxYwJJfOz5gIl1tVhB0xqN+GQn1h0XtlBoVdDS di05XLwkusGXtlytALlwPhgfwL6j4agfIgrrC4YWxpM4ESASdllq/q+nR1HUwz5PffVL p7mA5TiwHT6rueh6kQYePbDe2thhkGugC0KVZVFsz05LQZakjZNp3cHODxkPO3jLewR5 eJgTH7An+2cghYYN+BeinnhuTC8G5QZpeLL/xxFFyGxdWqDTqsLy+TZjl38Omvs9mBNY brYv23GrqLyDyEL7hKLIz6BV3IlQUgvaQ2PzkEvE/+kt34r87QGw7p0eT5puzsrGG0PF Z/XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u8bPrf9x; 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 i8si17528ejj.74.2021.05.20.10.30.17; Thu, 20 May 2021 10:30:41 -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=u8bPrf9x; 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 S234217AbhETJ4i (ORCPT + 99 others); Thu, 20 May 2021 05:56:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:52918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234536AbhETJxP (ORCPT ); Thu, 20 May 2021 05:53:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BA9D61403; Thu, 20 May 2021 09:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503387; bh=+qUpnmvumi9wFaNS6zSghXEbPM3w5EdTruS5jqAL/UY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8bPrf9xw67sBnMMXoCXScvRTtlSjX7Vay07MH/4b8U1v5FVlzb1GROYfi57pkk7h olmIOCfUbZwwOSxG7q3d8qdtS0OCLTAT8yn8ffkoW1FNj1gYtJpohUvAceQrfez+am 0ea08SnvSXudsb3X2+/1zjsBJmdqZrecDE/UB9Iw= 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.19 181/425] crypto: qat - dont release uninitialized resources Date: Thu, 20 May 2021 11:19:10 +0200 Message-Id: <20210520092137.378212130@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 4a73fc70f7a9..df9a1f35b832 100644 --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c @@ -304,17 +304,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