]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PCI: tegra194: Fix possible array out of bounds access
authorSumit Gupta <sumitg@nvidia.com>
Thu, 11 May 2023 17:32:09 +0000 (23:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Aug 2023 12:23:22 +0000 (14:23 +0200)
commitcc159083085947c0d8466b2fd63699d0ad87b3cd
tree8b90096d60046792121ed955282b422de2164774
parente2d10f1de1fac24e6e41bed71301d7a95aea43c6
PCI: tegra194: Fix possible array out of bounds access

[ Upstream commit 205b3d02d57ce6dce96f6d2b9c230f56a9bf9817 ]

Add check to fix the possible array out of bounds violation by
making speed equal to GEN1_CORE_CLK_FREQ when its value is more
than the size of "pcie_gen_freq" array. This array has size of
four but possible speed (CLS) values are from "0 to 0xF". So,
"speed - 1" values are "-1 to 0xE".

Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://lore.kernel.org/lkml/72b9168b-d4d6-4312-32ea-69358df2f2d0@nvidia.com/
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/controller/dwc/pcie-tegra194.c