Received: by 10.192.165.148 with SMTP id m20csp2475631imm; Sun, 22 Apr 2018 07:50:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48NyzpJgC8PjYEHranQy92/bJ9dwTj5AJ1XNJhurKszFStAh4oXDvDqSXdtkG10NpnN5pku X-Received: by 10.98.70.8 with SMTP id t8mr16847729pfa.185.1524408601719; Sun, 22 Apr 2018 07:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408601; cv=none; d=google.com; s=arc-20160816; b=u8uSWuOfhr9HeBw3BFXELjqNkCS9xJ591N64JEfCWVNWYn/CIaRNsi8WqGJIAKfD1c wh32O02F/Q1sxrNnD6La7klSWGdLFWds2ZiX6fe/S8l2byku05bQGKfoqOUKtX88Evng xwFsZQaPEGZbElulBXLx8xqh/AxXud9VTmoJwhkIZeaHP1aqTbvSD6ptisb+T9gN4eEj 5A0d+hzfTm8AWr3HZ1SFUodlmplGyR47H1eyyPuwYXRvdd9f9CmC9SMJ3YisjdRYhzif njoZPpflb2/46DSpKgE0+gLOhMBsVUXhecJefefeskKUATWtMLJwa20MiNJvu55yMGP0 fuYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Mf10PwSaDY7K9yuZiI0/o4SFsrMLY7VN8Gi8sYaltOI=; b=LfTueJdFCXS28hSDDy9qtWT0x/mxCslAhpCtuWcZah5bDXK4FH6+qzRy/H+6zopf5k XEC7n81tyqNySE1IBrgRg56Kti6TnWBzONYiAGAbjSqEtymuejtl7Dea/xSySUyOP9L9 /2HiCabqY4XMNU5VMaNYg17Qe5YDjNy5AihaQkQ4L777/tWsZuWP3bcG0Vh8gDSEph8N XBSQYLlvyj5cRDCSObieygsdM6S7dyYZ9BQwcD8JZBZVGEAPMOJM99u0iYcnxLjzUiS8 y3yNQAlRqQimvbv7pG5gKo9y9OuXo3Any1/X93B1oAVNyf1IVRgI/7v5ONxXghR561b3 ceFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si8112597pgr.117.2018.04.22.07.49.47; Sun, 22 Apr 2018 07:50:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757307AbeDVOsM (ORCPT + 99 others); Sun, 22 Apr 2018 10:48:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57130 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932199AbeDVOP5 (ORCPT ); Sun, 22 Apr 2018 10:15:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0251CC79; Sun, 22 Apr 2018 14:15:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.4 02/97] parisc: Fix out of array access in match_pci_device() Date: Sun, 22 Apr 2018 15:52:40 +0200 Message-Id: <20180422135304.767319689@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Helge Deller commit 615b2665fd20c327b631ff1e79426775de748094 upstream. As found by the ubsan checker, the value of the 'index' variable can be out of range for the bc[] array: UBSAN: Undefined behaviour in arch/parisc/kernel/drivers.c:655:21 index 6 is out of range for type 'char [6]' Backtrace: [<104fa850>] __ubsan_handle_out_of_bounds+0x68/0x80 [<1019d83c>] check_parent+0xc0/0x170 [<1019d91c>] descend_children+0x30/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019cd54>] parse_tree_node+0x40/0x54 [<1019d86c>] check_parent+0xf0/0x170 [<1019d91c>] descend_children+0x30/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019d938>] descend_children+0x4c/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019cd54>] parse_tree_node+0x40/0x54 [<1019cffc>] hwpath_to_device+0xa4/0xc4 Signed-off-by: Helge Deller Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/parisc/kernel/drivers.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -648,6 +648,10 @@ static int match_pci_device(struct devic (modpath->mod == PCI_FUNC(devfn))); } + /* index might be out of bounds for bc[] */ + if (index >= 6) + return 0; + id = PCI_SLOT(pdev->devfn) | (PCI_FUNC(pdev->devfn) << 5); return (modpath->bc[index] == id); }