All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: add missing sanity check on diag download
@ 2018-09-21 20:42 ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2018-09-21 20:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless, Carl Huang, Brian Norris

ath10k_hw_diag_fast_download() generally has good boundary checking, but
it misses verifying that the next metadata header actually fits in the
remaining buffer space. Add such a check.

Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377.")
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/net/wireless/ath/ath10k/hw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
index 2c2870e3e84d..af8ae8117c62 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -1044,6 +1044,12 @@ int ath10k_hw_diag_fast_download(struct ath10k *ar,
 	left = length - sizeof(*hdr);
 
 	while (left > 0) {
+		if (left < sizeof(*metadata)) {
+			ath10k_warn(ar, "firmware segment is truncated: %d\n",
+				    left);
+			ret = -EINVAL;
+			break;
+		}
 		base_addr = __le32_to_cpu(metadata->addr);
 		base_len = __le32_to_cpu(metadata->length);
 		buf = metadata->data;
-- 
2.19.0.444.g18242da7ef-goog

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

* [PATCH] ath10k: add missing sanity check on diag download
@ 2018-09-21 20:42 ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2018-09-21 20:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Brian Norris, Carl Huang, linux-wireless, ath10k

ath10k_hw_diag_fast_download() generally has good boundary checking, but
it misses verifying that the next metadata header actually fits in the
remaining buffer space. Add such a check.

Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377.")
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/net/wireless/ath/ath10k/hw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
index 2c2870e3e84d..af8ae8117c62 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -1044,6 +1044,12 @@ int ath10k_hw_diag_fast_download(struct ath10k *ar,
 	left = length - sizeof(*hdr);
 
 	while (left > 0) {
+		if (left < sizeof(*metadata)) {
+			ath10k_warn(ar, "firmware segment is truncated: %d\n",
+				    left);
+			ret = -EINVAL;
+			break;
+		}
 		base_addr = __le32_to_cpu(metadata->addr);
 		base_len = __le32_to_cpu(metadata->length);
 		buf = metadata->data;
-- 
2.19.0.444.g18242da7ef-goog


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: add missing sanity check on diag download
  2018-09-21 20:42 ` Brian Norris
  (?)
@ 2018-10-02  4:50 ` Kalle Valo
  -1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-10-02  4:50 UTC (permalink / raw)
  To: Brian Norris; +Cc: ath10k, linux-wireless, Carl Huang, Brian Norris

Brian Norris <briannorris@chromium.org> wrote:

> ath10k_hw_diag_fast_download() generally has good boundary checking, but
> it misses verifying that the next metadata header actually fits in the
> remaining buffer space. Add such a check.
> 
> Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377.")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

e720ba1dcc33 ath10k: add missing sanity check on diag download

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

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


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

* Re: [PATCH] ath10k: add missing sanity check on diag download
  2018-09-21 20:42 ` Brian Norris
  (?)
  (?)
@ 2018-10-02  4:50 ` Kalle Valo
  -1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-10-02  4:50 UTC (permalink / raw)
  To: Brian Norris; +Cc: Carl Huang, linux-wireless, ath10k

Brian Norris <briannorris@chromium.org> wrote:

> ath10k_hw_diag_fast_download() generally has good boundary checking, but
> it misses verifying that the next metadata header actually fits in the
> remaining buffer space. Add such a check.
> 
> Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377.")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

e720ba1dcc33 ath10k: add missing sanity check on diag download

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

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


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

end of thread, other threads:[~2018-10-02  4:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 20:42 [PATCH] ath10k: add missing sanity check on diag download Brian Norris
2018-09-21 20:42 ` Brian Norris
2018-10-02  4:50 ` Kalle Valo
2018-10-02  4:50 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.