]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 27 Aug 2022 07:32:23 +0000 (07:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:56 +0000 (13:22 +0200)
commite245f9f30062bc84c5da108a76130f1ee728df2e
tree5ff4af39c649cd779a5ea3e04cce5a23fcf624d0
parent7797b8a825fd34c5c92bc2660d8810eac785da56
power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()

[ Upstream commit 850a7bca9f8278c9b3913e56d8acbe1ab14af08a ]

ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length
of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements
beyond the end of the adp5061_chg_type[] array.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/adp5061.c