ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem
authorCarl Huang <cjhuang@codeaurora.org>
Thu, 11 Oct 2018 07:55:26 +0000 (15:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:13:20 +0000 (09:13 +0100)
commit9c7f98086f0bca48b988826f98372a990b0a1d5a
treea07331bd8258f32e62bacf601824c8d8b01cafa9
parent3bbeacffa14dd5b85dfb30543533eb3855989304
ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem

[ Upstream commit 0738b4998c6d1caf9ca2447b946709a7278c70f1 ]

ath10k_pci_diag_write_mem may allocate big size of the dma memory
based on the parameter nbytes. Take firmware diag download as
example, the biggest size is about 500K. In some systems, the
allocation is likely to fail because it can't acquire such a large
contiguous dma memory.

The fix is to allocate a small size dma memory. In the loop,
driver copies the data to the allocated dma memory and writes to
the destination until all the data is written.

Tested with QCA6174 PCI with
firmware-6.bin_WLAN.RM.4.4.1-00119-QCARMSWP-1, this also affects
QCA9377 PCI.

Signed-off-by: Carl Huang <cjhuang@codeaurora.org>
Reviewed-by: Brian Norris <briannorris@chomium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath10k/pci.c