From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 132DB19048A; Tue, 10 Sep 2024 10:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725964981; cv=none; b=bgb6cVW1o0EmQHX+XTI23Wrd5g/GrGzBCPaKbq5ofCSY7bVyorTAW2Zx8j7eMDarSs9B7Lf/87LE2V4sgQIAGI2MYh96g9/wf4DGgvUXspX6Y/MBXyKd3bWjj7zEqA2oM/rm94AaE9qby/tHlvMG3xiEKy9mH58149O8nCMrtVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725964981; c=relaxed/simple; bh=oHD67WEKSO/Vdr6Vcie1cgckRui2S5L0t9BEcUZ+Lm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IEynHq0KQXoQ0hFNcm/h64ttgHBfiYoUgQg0BVv87kw8XIW9ef5EVpYbTN0XnI7SRTaDueoK2Tc2i/8q73eeNOVcxXXVWAEvAA+XTFkXIvNVbR/mqCMbPv5TVGAI/60r0nOt8BZLSEgsz+siJfus86lptUYfenZFB9rcOzIHxRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AVRJdUOA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AVRJdUOA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F92FC4CEC3; Tue, 10 Sep 2024 10:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725964980; bh=oHD67WEKSO/Vdr6Vcie1cgckRui2S5L0t9BEcUZ+Lm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVRJdUOAG1bMou7t0KkmFm5RnWrI/jnR8Mzox42dB8xtxGo6slygTkhD6YAn3m5Vp CgxX8P3hK3vJYS6j6UwqyNebjCCqwdNuXDcEqzVZsi3hi9HRL50mvNPP6VnOu9aqVG PQKBPNQ510U8uLs3GLjT8ews7frSJXJgcZi0xUVU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ma Ke , Thomas Gleixner , Marc Zyngier Subject: [PATCH 5.10 060/186] irqchip/gic-v2m: Fix refcount leak in gicv2m_of_init() Date: Tue, 10 Sep 2024 11:32:35 +0200 Message-ID: <20240910092556.958159150@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092554.645718780@linuxfoundation.org> References: <20240910092554.645718780@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ma Ke commit c5af2c90ba5629f0424a8d315f75fb8d91713c3c upstream. gicv2m_of_init() fails to perform an of_node_put() when of_address_to_resource() fails, leading to a refcount leak. Address this by moving the error handling path outside of the loop and making it common to all failure modes. Fixes: 4266ab1a8ff5 ("irqchip/gic-v2m: Refactor to prepare for ACPI support") Signed-off-by: Ma Ke Signed-off-by: Thomas Gleixner Reviewed-by: Marc Zyngier Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20240820092843.1219933-1-make24@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman --- drivers/irqchip/irq-gic-v2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -442,12 +442,12 @@ static int __init gicv2m_of_init(struct ret = gicv2m_init_one(&child->fwnode, spi_start, nr_spis, &res, 0); - if (ret) { - of_node_put(child); + if (ret) break; - } } + if (ret && child) + of_node_put(child); if (!ret) ret = gicv2m_allocate_domains(parent); if (ret)