]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
parisc: Fix out of array access in match_pci_device()
authorHelge Deller <deller@gmx.de>
Sun, 25 Mar 2018 21:53:22 +0000 (23:53 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 22 May 2018 14:18:21 +0000 (16:18 +0200)
commit8bf70e6b14d80f27afb8ae0ddb0944fe449d5a26
treeeb5bffe5f78b26e255d16c73d125a1dbe3fffa6b
parent9226a148852ca56f5cc352db3a94c7cc91ba107c
parisc: Fix out of array access in match_pci_device()

BugLink: http://bugs.launchpad.net/bugs/1769723
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 <deller@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/parisc/kernel/drivers.c