]> git.baikalelectronics.ru Git - kernel.git/commit
ath10k: pci: fix memcpy size of bmi response
authorZekun Shen <bruceshenzk@gmail.com>
Tue, 16 Jun 2020 13:25:43 +0000 (09:25 -0400)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 23 Jun 2020 07:43:17 +0000 (10:43 +0300)
commit0d3d3fd12cb0d38ee2c6d42287875370f3323ac6
treeb79809879d435080423278c2872e758acdd33ae2
parentb89394839128eead7fa12e960fe489aff0ec0005
ath10k: pci: fix memcpy size of bmi response

A compromized ath10k peripheral is able to control the size argument
of memcpy in ath10k_pci_hif_exchange_bmi_msg.

The min result from previous line is not used as the size argument
for memcpy. Instead, xfer.resp_len comes from untrusted stream dma
input. The value comes from "nbytes" in ath10k_pci_bmi_recv_data,
which is set inside _ath10k_ce_completed_recv_next_nolock with the line

nbytes = __le16_to_cpu(sdesc.nbytes);

sdesc is a stream dma region which device can write to.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200616132544.17478-1-bruceshenzk@gmail.com
drivers/net/wireless/ath/ath10k/pci.c