]> 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)
commitf774cfeb3414823a523b82ead6bc95a2ef81218a
treedb6d7ab079c89f4e3f7bbc884540a8db8988d7eb
parentebb337f0324d3f81f8705f74120b15fc5932c5a5
rsi: Fix failure to load firmware after memory leak fix and fix the leak

Fixes commit 2d409a3f1e82 ("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: 2d409a3f1e82 ("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