From nobody Sat Dec 21 12:14:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502296948290.1697187178279; Mon, 18 Feb 2019 07:04:56 -0800 (PST) Received: from localhost ([127.0.0.1]:60093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkTS-0007ew-Sz for importer@patchew.org; Mon, 18 Feb 2019 10:04:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjws-0005XA-54 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwo-0002dp-SN for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:09 -0500 Received: from ozlabs.org ([203.11.71.1]:54685) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwo-0002b3-6k; Mon, 18 Feb 2019 09:31:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd3QCBz9sPg; Tue, 19 Feb 2019 01:30:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=9PgqAm8HLA7qmBJ2NAl+3kOHG3J5eeOd898CPW/ctBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3XYFwKAT3sLVdj+U1SI5/Kv6eFSsNgSJ1BHPZgVIzPSJqdH18ZvJ6BEbq1chexYT 7wVV+gG3UBW9lCjQrRRmy4pqXQxlAa8sQOIl6YVNcw4unCo7HZTz7z8MpFETABOp/a 5yH0ry/v9JTgRS4mIZE8RqbfwGFvEML8x3ouTuZk= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:11 +1100 Message-Id: <20190218143049.17142-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 05/43] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz Now that IRQ allocation has been split in two (first allocate IRQ numbers, then claim them), if the claiming fails, we must release the IRQs. Fixes: 4fe75a8ccd80 "spapr: split the IRQ allocation sequence" Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 41d81f4a85..c3fb0ac884 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -393,6 +393,12 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPR= MachineState *spapr, for (i =3D 0; i < req_num; i++) { spapr_irq_claim(spapr, irq + i, false, &err); if (err) { + if (i) { + spapr_irq_free(spapr, irq, i); + } + if (!smc->legacy_irq_allocation) { + spapr_irq_msi_free(spapr, irq, req_num); + } error_reportf_err(err, "Can't allocate MSIs for device %x: ", config_addr); rtas_st(rets, 0, RTAS_OUT_HW_ERROR); --=20 2.20.1