Skip to content

Commit 0419056

Browse files
Druidosgregkh
authored andcommitted
tty: rocket: Fix possible buffer overwrite on register_PCI
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 784c29e commit 0419056

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/rocket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ static __init int register_PCI(int i, struct pci_dev *dev)
18811881
ByteIO_t UPCIRingInd = 0;
18821882

18831883
if (!dev || !pci_match_id(rocket_pci_ids, dev) ||
1884-
pci_enable_device(dev))
1884+
pci_enable_device(dev) || i >= NUM_BOARDS)
18851885
return 0;
18861886

18871887
rcktpt_io_addr[i] = pci_resource_start(dev, 0);

0 commit comments

Comments
 (0)