kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
@ 2020-08-13 14:12 Dan Carpenter
  2020-08-17 10:24 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-08-13 14:12 UTC (permalink / raw)
  To: QCA ath9k Development
  Cc: Kalle Valo, Jakub Kicinski, Vasanthakumar Thiagarajan,
	John W. Linville, Senthil Balasubramanian, Sujith,
	linux-wireless, kernel-janitors

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>
---
 drivers/net/wireless/ath/ath9k/htc_hst.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index d2e062eaf561..510e61e97dbc 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -339,6 +339,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
 
 	if (skb) {
 		htc_hdr = (struct htc_frame_hdr *) skb->data;
+		if (htc_hdr->endpoint_id >= ARRAY_SIZE(htc_handle->endpoint))
+			goto ret;
 		endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id];
 		skb_pull(skb, sizeof(struct htc_frame_hdr));
 
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
  2020-08-13 14:12 [PATCH] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() Dan Carpenter
@ 2020-08-17 10:24 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-08-17 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: QCA ath9k Development, Jakub Kicinski, Vasanthakumar Thiagarajan,
	John W. Linville, Senthil Balasubramanian, Sujith,
	linux-wireless, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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>

Patch applied to ath-next branch of ath.git, thanks.

2705cd7558e7 ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()

-- 
https://patchwork.kernel.org/patch/11712553/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-17 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 14:12 [PATCH] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() Dan Carpenter
2020-08-17 10:24 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).