]> git.hungrycats.org Git - linux/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>
Mon, 24 Oct 2022 07:58:25 +0000 (09:58 +0200)
commit038e4aa71281d0cbc8aeb56ba05ff7fc5653a106
tree0bc8879f20d46c9144b1b3ff1cb53df32b489e34
parentb737f60538abfeb343ac7ead216068f9fa3b087a
power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()

[ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ]

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