PCI: pci-bridge-emul: Fix array overruns, improve safety
stable inclusion from stable-5.10.20 commit c2f17201d0e23110918ffac5ef220843e84cb2ff bugzilla: 50608 -------------------------------- [ Upstream commit f8ee579d ] We allow up to PCI_EXP_SLTSTA2 registers to be accessed, but the pcie_cap_regs_behavior[] array only covers up to PCI_EXP_RTSTA. Expand this array to avoid walking off the end of it. Do the same for pci_regs_behavior for consistency[], and add a BUILD_BUG_ON() to also check the bridge->conf structure size. Fixes: 23a5fba4 ("PCI: Introduce PCI bridge emulated config space common logic") Link: https://lore.kernel.org/r/E1l6z9W-0006Re-MQ@rmk-PC.armlinux.org.uk Signed-off-by:Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by:
Bjorn Helgaas <bhelgaas@google.com> Reviewed-by:
Pali Rohár <pali@kernel.org> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Chen Jun <chenjun102@huawei.com> Acked-by:
Xie XiuQi <xiexiuqi@huawei.com> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>
Loading
Please sign in to comment