mwifiex: fix a possible double free issue
authorAmitkumar Karwar <akarwar@marvell.com>
Tue, 26 May 2015 13:34:28 +0000 (06:34 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 2 Jun 2015 20:15:56 +0000 (23:15 +0300)
As drv_info_dump pointer doesn't get reset, we may end up
freeing the allocated memory twice.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/main.c

index fdf38d06a0aaa7a674a545c56b223586aa2137db..df7fdc09d38c7f1e326b59ad8fd0a9ea53485f74 100644 (file)
@@ -435,6 +435,7 @@ mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
 
        if (adapter->drv_info_dump) {
                vfree(adapter->drv_info_dump);
+               adapter->drv_info_dump = NULL;
                adapter->drv_info_size = 0;
        }
 
index 138c1cccf7d390727edc498374adc66ac06f9e67..cb0097890d3fdfe6b7ea43a42febbe1b85a227fd 100644 (file)
@@ -886,6 +886,7 @@ void mwifiex_dump_drv_info(struct mwifiex_adapter *adapter)
 
        if (adapter->drv_info_dump) {
                vfree(adapter->drv_info_dump);
+               adapter->drv_info_dump = NULL;
                adapter->drv_info_size = 0;
        }