Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp872153lqj; Mon, 3 Jun 2024 03:37:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVB8kmWdmgRxo76rO8sXn857O6uBlvul+nftVw6FkGY4BN0FCDuyRvX9cyTTU2IBwSex2I6LAKhG8Nim+FFYMrOa2Jtki3U7Le3n8/pA== X-Google-Smtp-Source: AGHT+IFqW0x5WnzLjhcDHthhq2dFPgyFY5smTkSnIV1X+W3kt4oSeU1IKFtGlJvMEMH2UmjSZ8Cm X-Received: by 2002:a17:906:1645:b0:a61:ab74:413e with SMTP id a640c23a62f3a-a6820beda7fmr569930466b.46.1717411073351; Mon, 03 Jun 2024 03:37:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717411073; cv=pass; d=google.com; s=arc-20160816; b=s7ac3ZqeAWGWLg6tGj9LJomKyrEJ9lHAHDGOZGWqyzY2wcKYuHrVIeT+mo4Ttxju8c NnFqDU/l1tyW2bdLdTZ4wVRzI7VfiWjIXNlSvgEA9qn/WSbtuxqZ9pq9muj4pQevW27B 1cnp+ftXWwfuuxD91ImzRU14AlDs+dA9fUIlHYi+y3Y/hv9nh6I6LwSU5jUdcXWS3P7n nbLjiR+uXYuQ3QIVxy65YOIsqI4irNritGMwKnMLk9/DocOt/z6dNKXDe4dTlMNU3opo B8xukOB7/wP58AEl/Uq8b1Q9CY8pQ/NfetPcnzph0L7tZnoyb+zGCQQMyitTBK7FSZxO jLCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=jjtlOTPaOIgUVbAWMc4atfx/AHmzxrJPiglFci9YRlg=; fh=1h6Y3upPovWVD9UH8XfSnGaTpJxfF8vE8HP4n1bzzdE=; b=BzedBYX5faBAJ6vlL4SGNEU1kDVOk6IFC+LMJkT1Fube1Fl18AxhxtRqy9nlXXf2K8 xQ6kbhjS4tKRdk3SOj+95O+We3GdUnoRduLaufFG+8buKdEO8vjkVM4j/88zE30eAZLv vEy8+lv4MRXGlHQhA2p8spGLXUSOoW6XznKM2eyWP0WhtizPiiBO7pDwiSwNuhzOfB2q RnnAKRddte9SfTUSq2O7ckBBW1zz3ruPBtSlqsGnc8krDCrK/uSNoKI2LJ+WWmKX+Iau JpJSFsxoKBYRq1UgYU6/cSFvruwdTiHg5VxNWV3X1MqLRaCVZbwvPSsHO3nu8I+wKC0f s0LQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Pu+BK2j9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-198989-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198989-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a69064f89e6si104526366b.625.2024.06.03.03.37.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 03:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198989-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Pu+BK2j9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-198989-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198989-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E6F051F22D83 for ; Mon, 3 Jun 2024 10:37:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F5CA839FF; Mon, 3 Jun 2024 10:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Pu+BK2j9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MoijTguv" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C1C782487; Mon, 3 Jun 2024 10:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717410989; cv=none; b=ocqJowsogMiU70suN3gSaEYTW4EcsKxNKNu75IEJmvCssF74fyTfqwS/M0A1IdzFZhAow+8lUW2bvztuOHO+fORhYLv2u/8+RnbYdHAQej8wi5wl0k50gEaJge9xZyYqpPEdpUO2ZgJ0ytuYXq/arPMyJN3UFUGWMuo85cQXwg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717410989; c=relaxed/simple; bh=7Bk8a5XKoqld68DuYkGTzx/fVfXv5gS4p9UqRcye2pc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=kMuwCsvlz8AKgORaIq6mGBM4YkF/eswhjqPXC5njyxStRWYJptP4HiPUQgrgAW72QqZO0yc3AfrbqVvR1SoWItntYz1VtA9Kr+Kj8UWuNNzD9u4Vu9NYrZDoaddxOewxw5sAsk/M17adBBAzK+7EWXeDhktHd0PvYtlVbe3Nsbs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Pu+BK2j9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=MoijTguv; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 03 Jun 2024 10:36:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1717410986; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jjtlOTPaOIgUVbAWMc4atfx/AHmzxrJPiglFci9YRlg=; b=Pu+BK2j97JI06LClrainV9UU3mgnc5NJUWnZTyh4dYOi/Ye8exKjK9GeLFkfxZ4+EwkAe7 w33+sBnjyNhy8mNVNDzf0qx3oRbjDhIzMbzfkD+bH0EwERIm9IIhaxe6hmKonJ4RxGBCty 2/isL1YbdRYD6HzPHsgSCxJLOQwxT9efzykowZJdnGq7WN9lmDPArG4lj8Goc/XVfYZHoX INv+jIzYlBRGCHDEci318CdXH66VzhgsIxqXBN1bFu7zk+hPlRnD3a6yoFTZpJYKvjwn71 3RT54wRm08JHV2tMTDvJGlLyWclX8s9fa3RgkOjh9nMCON2TE8gEZgpvXScewg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717410986; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jjtlOTPaOIgUVbAWMc4atfx/AHmzxrJPiglFci9YRlg=; b=MoijTguveVGfqVYLkT7vu2XDn8FfhghN9Uui0d7oxxJlViSboxPI2Jng9nGVMVj6O3zpaT zL0AgnoDv9v+VeAw== From: "tip-bot2 for Sunil V L" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqchip/riscv-intc: Prevent memory leak when riscv_intc_init_common() fails Cc: Sunil V L , Thomas Gleixner , Anup Patel , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20240527081113.616189-1-sunilvl@ventanamicro.com> References: <20240527081113.616189-1-sunilvl@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171741098562.10875.13157753436022438155.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the irq/urgent branch of tip: Commit-ID: 0110c4b110477bb1f19b0d02361846be7ab08300 Gitweb: https://git.kernel.org/tip/0110c4b110477bb1f19b0d02361846be7ab08300 Author: Sunil V L AuthorDate: Mon, 27 May 2024 13:41:13 +05:30 Committer: Thomas Gleixner CommitterDate: Mon, 03 Jun 2024 12:29:35 +02:00 irqchip/riscv-intc: Prevent memory leak when riscv_intc_init_common() fails When riscv_intc_init_common() fails, the firmware node allocated is not freed. Add the missing free(). Fixes: 7023b9d83f03 ("irqchip/riscv-intc: Add ACPI support") Signed-off-by: Sunil V L Signed-off-by: Thomas Gleixner Reviewed-by: Anup Patel Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240527081113.616189-1-sunilvl@ventanamicro.com --- drivers/irqchip/irq-riscv-intc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c index 9e71c44..4f3a123 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -253,8 +253,9 @@ IRQCHIP_DECLARE(andes, "andestech,cpu-intc", riscv_intc_init); static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header, const unsigned long end) { - struct fwnode_handle *fn; struct acpi_madt_rintc *rintc; + struct fwnode_handle *fn; + int rc; rintc = (struct acpi_madt_rintc *)header; @@ -273,7 +274,11 @@ static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header, return -ENOMEM; } - return riscv_intc_init_common(fn, &riscv_intc_chip); + rc = riscv_intc_init_common(fn, &riscv_intc_chip); + if (rc) + irq_domain_free_fwnode(fn); + + return rc; } IRQCHIP_ACPI_DECLARE(riscv_intc, ACPI_MADT_TYPE_RINTC, NULL,