OpenCloudOS-Kernel/drivers/net/wireless/marvell
Tom Rix 53708f4fd9 mwifiex: fix double free
clang static analysis reports this problem:

sdio.c:2403:3: warning: Attempt to free released memory
        kfree(card->mpa_rx.buf);
        ^~~~~~~~~~~~~~~~~~~~~~~

When mwifiex_init_sdio() fails in its first call to
mwifiex_alloc_sdio_mpa_buffer, it falls back to calling it
again.  If the second alloc of mpa_tx.buf fails, the error
handler will try to free the old, previously freed mpa_rx.buf.
Reviewing the code, it looks like a second double free would
happen with mwifiex_cleanup_sdio().

So set both pointers to NULL when they are freed.

Fixes: 5e6e3a92b9 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201004131931.29782-1-trix@redhat.com
2020-10-08 13:46:25 +03:00
..
libertas net: libertas: Use netif_rx_any_context() 2020-09-29 14:02:55 -07:00
libertas_tf net: libertas libertas_tf: Remove in_interrupt() from debug macro. 2020-09-29 14:02:55 -07:00
mwifiex mwifiex: fix double free 2020-10-08 13:46:25 +03:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mwl8k.c mwl8k: convert tasklets to use new tasklet_setup() API 2020-08-27 16:22:10 +03:00