ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Aug 2020 14:12:53 +0000 (17:12 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:07:03 +0000 (09:07 +0100)
commitc602739b70f1e73ba680aa401e839cc5817347ce
treea049bdface39f28497056788dbcaa6a2ea5e091f
parent3dd51af5f967795f90a4b27a1483ea9c1528575d
ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()

[ Upstream commit 2705cd7558e718a7240c64eb0afb2edad5f8c190 ]

The value of "htc_hdr->endpoint_id" comes from skb->data so Smatch marks
it as untrusted so we have to check it before using it as an array
offset.

This is similar to a bug that syzkaller found in commit e4ff08a4d727
("ath9k: Fix use-after-free Write in ath9k_htc_rx_msg") so it is
probably a real issue.

Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200813141253.GA457408@mwanda
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath9k/htc_hst.c