]> git.baikalelectronics.ru Git - kernel.git/commit
ath9k: fix OOB read ar9300_eeprom_restore_internal
authorZekun Shen <bruceshenzk@gmail.com>
Sat, 19 Jun 2021 13:29:14 +0000 (09:29 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:36 +0000 (12:26 +0200)
commited52e4933e13754ef196297209d95fa53e3ecf83
tree2659ae2641a2e5df0b705525c18496ad5aaaee50
parent6f14f8704814c485ec8545fdf8667d4510aaf84e
ath9k: fix OOB read ar9300_eeprom_restore_internal

[ Upstream commit 23151b9ae79e3bc4f6a0c4cd3a7f355f68dad128 ]

Bad header can have large length field which can cause OOB.
cptr is the last bytes for read, and the eeprom is parsed
from high to low address. The OOB, triggered by the condition
length > cptr could cause memory error with a read on
negative index.

There are some sanity check around length, but it is not
compared with cptr (the remaining bytes). Here, the
corrupted/bad EEPROM can cause panic.

I was able to reproduce the crash, but I cannot find the
log and the reproducer now. After I applied the patch, the
bug is no longer reproducible.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/YM3xKsQJ0Hw2hjrc@Zekuns-MBP-16.fios-router.home
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c