Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3444989imw; Thu, 7 Jul 2022 01:44:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2QMSIGQUZEhzl5pP3YrDP5X4WyVnkimb7XBhILe1IfVL8jh3lAwwfm5fTgeGwrMCEYHlC X-Received: by 2002:a05:6402:909:b0:435:a8b:5232 with SMTP id g9-20020a056402090900b004350a8b5232mr58549125edz.240.1657183481284; Thu, 07 Jul 2022 01:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657183481; cv=none; d=google.com; s=arc-20160816; b=D559rkol5JuX9kbvJ66N4s75PVjTi+vDgB0+wB0plerPMU/PjhYN34CWaco0TnBrnG c9DQ9HZwds99db+5BPlUJWQ8669OxfbdiKcQVBfpXvREPzWdAsnYLWA0/wCPpD4/jqqK Ywg1dU0VWy+eaj3RoOdXjW4XUZr5cu4kri9A13FsXFlwry0lZoariQXXu5OtxmmUKmRO vH1avLke9sfamLE3ytQ7g/8twOJatKJIxC5569Aw3IMohS+bFD1SSayGQmqkZWC6WDLe Pfd9CkSzFgUdq7RTlH8JETQ2EmNxwFTczZxSCNncOWy80i7f1CxfU3wAcO1/zlAeaSQk sLbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=agB4s4WADpNkKagZMVxc6n5C9p1szKTvYPMmkV5M5Qw=; b=TMQu5W0AZnJXa0GP4Ai9iI3t/62DA5WMwNmdhdUwHBWiKKvE3VbB0F0DQq0y6u+rAc CaL3X23QikBUTlifIoUaA4R879tgK6TdhgLJH87FjQRXlgIrN0UtKzAUsscxLG4xF5Us EuhpAP9apCxiDbxCnNfMWD8Z6IU0G2o7YdvdkaiqU0w9SYsxqSFNch0tmi7nfdF8zW7C bxnAJZi3Q3mu3PlyfBgAO8R5ZNAEOzYJOEPLQyP20L7K8s10i7OoK5GNPPqHXSxjJcQ5 DwDTpOAlSQVzSE46oT/livVqjEuZ/euOQRmoDsFYYSOrg0ZMIpLvdzKA43ugqtjYPktS Xa0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xwIPqH5c; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=k24qG0ny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j26-20020a056402239a00b0043a7a694992si863536eda.203.2022.07.07.01.44.16; Thu, 07 Jul 2022 01:44:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xwIPqH5c; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=k24qG0ny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235324AbiGGISS (ORCPT + 99 others); Thu, 7 Jul 2022 04:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235473AbiGGIRi (ORCPT ); Thu, 7 Jul 2022 04:17:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F024D4E4 for ; Thu, 7 Jul 2022 01:15:54 -0700 (PDT) Date: Thu, 07 Jul 2022 08:15:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1657181753; 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=agB4s4WADpNkKagZMVxc6n5C9p1szKTvYPMmkV5M5Qw=; b=xwIPqH5cDAVMXzR9PScT60mjMLZoywE9Fm19Eeb74vY8LrED0tB7DZo51Fm2+iUG0/M+Dc mKfETsVyVMabrBx1aqgm9Z8UzISfIO01andoaZC/0ufgTpcFN0m3kRxRqELFPPSMrZjTt1 /ujIMXw8LJ1STav4bMyMQdcgqXBNu1m3pxNlK2oz/Enz4VnHN0R4HHEBGYq2bAIc9pdCt4 Ep2D5P6oEAG2W5OVke1HFitWF4qWYzyLGed872CqDD7qb8b5e23NWnCTy1Ha6D9/TWaLyv dgP0ayIQ3AkExjX0Obw5r+pbBNdDe2UqZ6EgDh0oyByvttx6UZstzXfzcygeFg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1657181753; 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=agB4s4WADpNkKagZMVxc6n5C9p1szKTvYPMmkV5M5Qw=; b=k24qG0nyWHpqQPcExStzS5MUYFQe3tzMbWyCzWi0Y6K1tbnvmN7r6E+J8ACbXWFUMT2cCB g7yaCBKeazmSnLCA== From: "irqchip-bot for Antonio Borneo" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] irqchip/stm32-exti: Prevent illegal read due to unbounded DT value Cc: Antonio Borneo , Marc Zyngier , tglx@linutronix.de In-Reply-To: <20220606162757.415354-4-antonio.borneo@foss.st.com> References: <20220606162757.415354-4-antonio.borneo@foss.st.com> MIME-Version: 1.0 Message-ID: <165718175212.15455.3837977774030321982.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/irqchip-next branch of irqchip: Commit-ID: c16ae609214e835692c33b1a090b5a15bf1b9e7e Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c16ae609214e835692c33b1a090b5a15bf1b9e7e Author: Antonio Borneo AuthorDate: Mon, 06 Jun 2022 18:27:54 +02:00 Committer: Marc Zyngier CommitterDate: Thu, 07 Jul 2022 09:07:44 +01:00 irqchip/stm32-exti: Prevent illegal read due to unbounded DT value The value hwirq is received from DT. If it exceeds the maximum valid value it causes the code to address unexisting irq chips reading outside the array boundary. Check the value of hwirq before using it. Signed-off-by: Antonio Borneo Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220606162757.415354-4-antonio.borneo@foss.st.com --- drivers/irqchip/irq-stm32-exti.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 1145f06..e2722e4 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c @@ -713,6 +713,9 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm, int bank; hwirq = fwspec->param[0]; + if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK) + return -EINVAL; + bank = hwirq / IRQS_PER_BANK; chip_data = &host_data->chips_data[bank];