tty: rocket: Fix possible buffer overwrite on register_PCI
authorAnton Vasilyev <vasilyev@ispras.ru>
Fri, 27 Jul 2018 13:39:31 +0000 (16:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:43:40 +0000 (22:43 +0200)
commitca21de151016d69c3415d95731761c9dd0bf1e00
treeaf317a1cca0256d953f0b03963a0fb24c9d98806
parent4bb1d3ec658c9a1f071bab691c6e5778860efb6a
tty: rocket: Fix possible buffer overwrite on register_PCI

[ Upstream commit 0419056ec8fd01ddf5460d2dba0491aad22657dd ]

If number of isa and pci boards exceed NUM_BOARDS on the path
rp_init()->init_PCI()->register_PCI() then buffer overwrite occurs
in register_PCI() on assign rcktpt_io_addr[i].

The patch adds check on upper bound for index of registered
board in register_PCI.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/rocket.c