From patchwork Tue Sep 1 15:09:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 310403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3009C433E2 for ; Tue, 1 Sep 2020 16:00:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8871206A5 for ; Tue, 1 Sep 2020 16:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598976057; bh=s0ggdQsQRTUXjPSnRMT/mKNOR2wQJ4J6Duk4z7ey7AI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p9PsaqCZtLgBfV4EcxhCpcHoUqHvg6FUVvyc0bAzd6+Geh085EY8bR5KjqyiF+MqG CDBqofjItmQQPYa9wS1OSVi8nGQiI0swezMygceSNHkrRapMtMR3hWJlT6ufn5L1oR YIRCehlt2l3oSA7Zy05HOvshrh+EL3JouQaYsuNk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731814AbgIAQA4 (ORCPT ); Tue, 1 Sep 2020 12:00:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:57636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbgIAQAa (ORCPT ); Tue, 1 Sep 2020 12:00:30 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ADAC8206A5; Tue, 1 Sep 2020 16:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598976029; bh=s0ggdQsQRTUXjPSnRMT/mKNOR2wQJ4J6Duk4z7ey7AI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NsvPncwcm3jI4EyLvjTW2QYsiyRTjLAqhWxlaD5W8JvYgCi+YpBHV6e2y1ScXX5Jm glJwFJaqKkOAZqLBmYp47x/+Fw3dRw3DuBqG059ynwh1Rm7kzFKw2fOKLZAbhR2Fhc hpbCIbUZFSpe1Z3+trSxJQYSXHZWqlsIX+5gYXBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhu Lingshan , Jason Wang , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.8 103/255] vdpa: ifcvf: free config irq in ifcvf_free_irq() Date: Tue, 1 Sep 2020 17:09:19 +0200 Message-Id: <20200901151005.649123147@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901151000.800754757@linuxfoundation.org> References: <20200901151000.800754757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jason Wang [ Upstream commit 2b9f28d5e8efad34f472542315911c5ee9a65b6c ] We don't free config irq in ifcvf_free_irq() which will trigger a BUG() in pci core since we try to free the vectors that has an action. Fixing this by recording the config irq in ifcvf_hw structure and free it in ifcvf_free_irq(). Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF") Cc: Zhu Lingshan Signed-off-by: Jason Wang Link: https://lore.kernel.org/r/20200723091254.20617-2-jasowang@redhat.com Signed-off-by: Michael S. Tsirkin Reviewed-by: Zhu Lingshan Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF") Cc: Zhu Lingshan <lingshan.zhu@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Sasha Levin --- drivers/vdpa/ifcvf/ifcvf_base.h | 2 +- drivers/vdpa/ifcvf/ifcvf_main.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h index f4554412e607f..29efa75cdfce5 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -84,7 +84,7 @@ struct ifcvf_hw { void __iomem * const *base; char config_msix_name[256]; struct vdpa_callback config_cb; - + unsigned int config_irq; }; struct ifcvf_adapter { diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index ae7110955a44d..7a6d899e541df 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -53,6 +53,7 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues) for (i = 0; i < queues; i++) devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]); + devm_free_irq(&pdev->dev, vf->config_irq, vf); ifcvf_free_irq_vectors(pdev); } @@ -72,8 +73,8 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter) snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", pci_name(pdev)); vector = 0; - irq = pci_irq_vector(pdev, vector); - ret = devm_request_irq(&pdev->dev, irq, + vf->config_irq = pci_irq_vector(pdev, vector); + ret = devm_request_irq(&pdev->dev, vf->config_irq, ifcvf_config_changed, 0, vf->config_msix_name, vf); if (ret) {