From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9B713D3CF4 for ; Tue, 9 Jun 2026 20:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781038622; cv=none; b=ZIyY1pIoy96ZZJRPWsgGs6tWh6r7+usiyGOfZg5gc+SwsUYMPkI4t4wjdhoiZ/kdNkGi0J74V0CClO5o3KDWiWI9wDlw32bYVCPqzboZEphnIKGYUsFTt6iiWdSqu5MaVauAjU/Jt7KtsDxIKdg5r4LJKl9rXQpnQ1oor8lXwfA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781038622; c=relaxed/simple; bh=CAxlSZZmNlWikBwc7mhI/m9qDXWuSmTGxeUKKE1zCas=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I8mOuLD2z/LX8jj/xfDwq1PDhdv5kNypY8ui3613U9AWDH3OuDZ5NUkpN+jhZOQTvXCnXiEyI4omu86cU4CkvrI0wrH/BUQCVneWUA6VbWI0N/TppO/0yk6pABDM+hmJ02y99YQwWf4nhxYFDU7Y+kdx+3AnAKZFqzb5F5pIdfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TvPc9mVQ; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TvPc9mVQ" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2bf22eab320so6499595ad.2 for ; Tue, 09 Jun 2026 13:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781038620; x=1781643420; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=74l0A/qsNQnWZPXlRttzV5NtMqwLxzQs3dbEKT6Fl9M=; b=TvPc9mVQQVpMNc/ETWYKvmFQRWVhdmmXRGRtoFESVwtnE5gVboh7F2cRGHhalng1vY 5IBiH3+eb1+DC0fxPwFv+XbNXZon9Y+knCdg2ScwzLd2XkulhrL9xE96wx+RkcOcEEBe uzjq9QZzhK1qRvDndt56/9mfdL8Q16gPgRlDg0hiw2kYlGWSdkltO+NC9mkh3lRxsSgx XovVdL0aMpgn1hu9XKp2HYyVLYC6BH2hpsb5wEAaxOUJi0vF5H2F8O8Ool8oKpyh8o/q eDDlqG+EPjMnetWkqAO4bKi1T/ktwQCbiwDT0s9Z5TKVHD00G+HRLd6Ua8wFy78cKWYW p35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781038620; x=1781643420; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=74l0A/qsNQnWZPXlRttzV5NtMqwLxzQs3dbEKT6Fl9M=; b=bveeu8dUuI2zXAmXyyGBeeqSrmrB+qknlohEBHOVMHqWKfvy03KvqgHZt0JMCfmG8g p3If1g7jThvhUeEzPpoOvY5zFrgewYCemn60RllBDfo6ZiybZCYh0CtQHyjKNfeijjP9 RMl6NSTNivQjqMGjlX/0gx3QskZ6A0svyQgIPWXV3tZ/GceEzOLcS3aM0h8q4iF2VNWr UwkEaL7YjkIwbzPUL0msLYfLD8CkKVah51XH2xxRLTr3OtfR8PjfRJgVbQQMW2m0rxqE ZneAlWnz/UvJg22+jLpdpCbrPFnBZd9SfDUeB/vlCc0yUdYGM93xGC0K5s4K5Fnp9YjC N3Tg== X-Gm-Message-State: AOJu0YydqmnJiayJfI2aTQ4pHjCrvJKgrigtpo0V7BQ+YReIsKkxdekZ WjB6+z4PnhKDV/Z28W0ltw9ebFM0QvJzW2LLk1VKdJvAx+sVUFEpLRiA X-Gm-Gg: Acq92OGHFWRM/qCXaxzzE4ANGARxRv1sEZVV56uUUfyP2iiHK4XCVEPwCKJXq5oFWdt Bd1r1S/olYEENJ63l2inWowtFikMe9VtwZ8oD+pfXtJ3LgXUGj4oIgnKN8FZF3CSlXj9d3AGi+R rn6VjUZ3T7YMfrxaur0/NBAN5BTm3kcHD0F7MyZhDNvLuwKcYHNjNxpTnGfXSzsX6B6u7UPGcX6 fSWW+W3b48RhcOlf5FcGtCMNGksPj32eIGLgIeywVBeXzR9IkuweM5BQcqPhje65AVAiUZVPwWo ASjAMezvq1++p4uj+fmjAUiYaWelL0XH4y+edTrMsNGDFxPjo73gQDPBL5pPB/y9BAhiXdvY2+s qRHjpBqv50E8La7um964dNK9YNEqnGqcJLc+MKi8oFil94T50idnNmV/t68VXe0A/A19Oh2N/SO QGWXrjiV9dyMeUHMHK8R+tzzC04D6stQTS7G+2Fnh6cNs= X-Received: by 2002:a17:902:e78f:b0:2c0:b359:99c1 with SMTP id d9443c01a7336-2c1e7af05f6mr112875445ad.2.1781038620243; Tue, 09 Jun 2026 13:57:00 -0700 (PDT) Received: from [192.168.1.3] ([2401:4900:881f:2fc6:d283:d7e3:f45b:e3d1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c249aeb62csm101260415ad.68.2026.06.09.13.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 13:56:59 -0700 (PDT) From: Bhargav Joshi Date: Wed, 10 Jun 2026 02:26:43 +0530 Subject: [PATCH 1/2] irqchip: crossbar: Fix out-of-bounds access in crossbar_domain_free() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260610-irq-crossbar-fix-v1-1-26797369ff6a@gmail.com> References: <20260610-irq-crossbar-fix-v1-0-26797369ff6a@gmail.com> In-Reply-To: <20260610-irq-crossbar-fix-v1-0-26797369ff6a@gmail.com> To: Thomas Gleixner , Tony Lindgren , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, goledhruva@gmail.com, m-chawdhry@ti.com, daniel.baluta@gmail.com, simona.toaca@nxp.com, j.bhargav.u@gmail.com X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781038612; l=1445; i=j.bhargav.u@gmail.com; h=from:subject:message-id; bh=CAxlSZZmNlWikBwc7mhI/m9qDXWuSmTGxeUKKE1zCas=; b=/e2SNAYEPH+jpY0kyq2joYYFP3T2zSkXeOJ5pZZ5wqwtLY2kw6CPzHxLRvrzjdHxpdTCr58Pk jDfa/YurAHyA5UkOP4ALyJ8mP4qbWxQt8p+mVPGJqTwJmqQwweJWTOK X-Developer-Key: i=j.bhargav.u@gmail.com; a=ed25519; pk=IqNDwUZKECEA+n8wXctFLBbYL9NhFstZNbOznm/nX1k= crossbar_domain_free() uses 'd->hwirq' (crossbar source index which can go up to 0 to 399) as the index for cb->irq_map and cb->write(), rather than the GIC SPI index. This can cause out of out-of-bounds write. but irq_domain_reset_irq_data() which zeros d->hwirq is called before d->hwirq is read. subsequent accesses use hwirq=0 which is always in-bounds but writes to the wrong slot. Fix this by using the GIC SPI index from the parent domain's irq_data, moving the reset after cleanup. Fixes: 783d31863fb82 ("irqchip: crossbar: Convert dra7 crossbar to stacked domains") Signed-off-by: Bhargav Joshi --- drivers/irqchip/irq-crossbar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index cd1134101ace..6a4718be0c58 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -158,9 +158,9 @@ static void crossbar_domain_free(struct irq_domain *domain, unsigned int virq, for (i = 0; i < nr_irqs; i++) { struct irq_data *d = irq_domain_get_irq_data(domain, virq + i); + cb->irq_map[d->parent_data->hwirq - GIC_IRQ_START] = IRQ_FREE; + cb->write(d->parent_data->hwirq - GIC_IRQ_START, cb->safe_map); irq_domain_reset_irq_data(d); - cb->irq_map[d->hwirq] = IRQ_FREE; - cb->write(d->hwirq, cb->safe_map); } raw_spin_unlock(&cb->lock); } -- 2.54.0