From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385195; b=rAsJ3hUacavV76RmWHWT1TSazLQR2bJICyBlCOFxYbNKHGnd1uYzukFlDSlNwIl9NoM4 vaczwO1L2CYjGJB+ZizpRWVKjq5akxRR2TAOrAksirtkl2T5QsjwmxAQx9MAGFZ7D4Zr9 5S1F+qWvg16LtOjWnd3gaJ3SCezzRdxrSLeUlnX8rhiJSIqWE6+Oas1Ni6E1dpJuY5Glh g/1Fr6rEwBfdDnE40lj1kCCDUReoauAbpwogs0eldRBprUoYerVEZH0zyRWleC6GP4BIc WglrnCRu/b8KiT/RCyHEGO8J/yC4mVUrIVDFMT2rYLDoOnSxr8etVG3IwrxtYWRxg3Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385195; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=g7Q3WIfF+ClR8P3aVabb0xtISNMvAyWOB7V6LwUZrHY=; b=mRvW7EyrdATDNyf3lRfreH4DAgEIszSd+vy/CsZN0shnduGZNaogjXgGDPdBsctskWFP FFPC1LM7hkVRvN0F7YxWn0Tfu1kke56tV+ClIB+eASbZtiHM1o/Pf49Tb90TInd9+Zrlj /zTWhlFMbP4PU9sRJ6R5KQRbSvdlHgJsVDN18OmlbawEldShCBXZ5DVnJKUUUXeKIT1LZ EvERw/hSpC6yb19WvTrRz93NlRVn1Q1XKfz+RdpNS+hvzHtJiH7Ciz4A9pxia7oibIlQQ SMC+47AYOG76G81qKzVi2sQYKmct1JEmSCOdQXSRDoIyc07n3cLKBoMtocGOdNovsRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wyxdWkOb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09608606A32C; Fri, 4 Dec 2026 11:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wyxdWkOb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 571321F000C2; Fri, 4 Dec 2026 11:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385194; bh=g7Q3WIfF+ClR8P3aVabb0xtISNMvAyWOB7V6LwUZrHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wyxdWkOb0393lSTqkJPvNUZXpJOYQEBK9pOjelqnQtnbxb9/fw7i5yqo69vqpzHf5 OYsCxSSfioeC+OoUziSjM8f6f6D1ObeZlAWGfVsDOfTXXfEi6tm80SjsteUiGFgslP 4fXhEIfqIiyyapEupM2KVQLE29T1W7A4tgfAz7yA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pengpeng Hou , Thomas Gleixner , Radu Rendec , Sasha Levin Subject: [PATCH 6.6 0417/1167] irqchip/mst-intc: Validate the DT interrupt range Date: Fri, 4 Dec 2026 18:57:24 +0900 Message-ID: <20261204100712.884654721@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pengpeng Hou [ Upstream commit 16f25d326e5d3b9fd51bc5e3916ecbffbca63e7b ] The driver takes an inclusive interrupt range from the device tree without checking its endpoints. A reversed range wraps the unsigned count calculation, and a range larger than MST_INTC_MAX_IRQS exceeds the controller capacity used by the driver. Reject these ranges before calculating nr_irqs or creating the domain. Check the difference after ordering the endpoints so the validation itself cannot wrap. The issue was found by our static-analysis tool. Fixes: ad4c938c92af ("irqchip/irq-mst: Add MStar interrupt controller support") Signed-off-by: Pengpeng Hou Signed-off-by: Thomas Gleixner Assisted-by: gpt 5 Reviewed-by: Radu Rendec Link: https://patch.msgid.link/20260920034236.16229-1-hppiscas@163.com [ sashal: adjusted context: the call is kzalloc(sizeof(*cd), GFP_KERNEL) here instead of upstream's kzalloc_obj(*cd), so the added range check was inserted before that call. ] Signed-off-by: Sasha Levin --- drivers/irqchip/irq-mst-intc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-mst-intc.c b/drivers/irqchip/irq-mst-intc.c index f6133ae281556..e30c91ab4790f 100644 --- a/drivers/irqchip/irq-mst-intc.c +++ b/drivers/irqchip/irq-mst-intc.c @@ -259,6 +259,9 @@ static int __init mst_intc_of_init(struct device_node *dn, of_property_read_u32_index(dn, "mstar,irqs-map-range", 1, &irq_end)) return -EINVAL; + if (irq_end < irq_start || irq_end - irq_start >= MST_INTC_MAX_IRQS) + return -EINVAL; + cd = kzalloc(sizeof(*cd), GFP_KERNEL); if (!cd) return -ENOMEM; -- 2.53.0