]> git.baikalelectronics.ru Git - kernel.git/commit
rsi: Fix failure to load firmware after memory leak fix and fix the leak
authorMike Looijmans <mike.looijmans@topic.nl>
Tue, 28 Jul 2015 05:51:01 +0000 (07:51 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 31 Jul 2015 06:22:44 +0000 (09:22 +0300)
commit6c1855c1f57c6aa7aeb3309025226a6a1ee1d8a6
treedb6d7ab079c89f4e3f7bbc884540a8db8988d7eb
parent58698846f55f911aaff75f568a0e795d1fe74429
rsi: Fix failure to load firmware after memory leak fix and fix the leak

Fixes commit 67672dcea07f ("rsi: fix memory leak in rsi_load_ta_instructions()")
which stopped the driver from functioning.

Firmware data has been allocated using vmalloc(), resulting in memory
that cannot be used for DMA. Hence the firmware was first copied to a
buffer allocated with kmalloc() in the original code. This patch reverts
the commit and only calls "kfree()" to release the buffer after sending
the data. This fixes the memory leak without breaking the driver.

Add a comment to the kmemdup() calls to explain why this is done, and abort
if memory allocation fails.

Tested on a Topic Miami-Florida board which contains the rsi SDIO chip.

Also added the same kfree() call to the USB glue driver. This was not
tested on actual hardware though, as I only have the SDIO version.

Fixes: 67672dcea07f ("rsi: fix memory leak in rsi_load_ta_instructions()")
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Cc: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
drivers/net/wireless/rsi/rsi_91x_usb_ops.c