]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: davinci: Validate the obtained number of IRQs
authorAleksandr Mishin <amishin@t-argos.ru>
Tue, 18 Jun 2024 14:43:44 +0000 (17:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jul 2024 07:33:53 +0000 (09:33 +0200)
commit2d83492259ad746b655f196cd5d1be4b3d0a3782
treeef6af65062aa71d2d7f4e92c25be6ab3da398085
parent0ca8656457becbb4fb17a6b8af91a36541c0d7fa
gpio: davinci: Validate the obtained number of IRQs

[ Upstream commit 7aa9b96e9a73e4ec1771492d0527bd5fc5ef9164 ]

Value of pdata->gpio_unbanked is taken from Device Tree. In case of broken
DT due to any error this value can be any. Without this value validation
there can be out of chips->irqs array boundaries access in
davinci_gpio_probe().

Validate the obtained nirq value so that it won't exceed the maximum
number of IRQs per bank.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Link: https://lore.kernel.org/r/20240618144344.16943-1-amishin@t-argos.ru
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-davinci.c