Commit 003d87cb authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by John W. Linville

mwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak

Currently it is in mwifiex_adapter_cleanup() which doesn't get
called if driver initialization is failed causing memory leak.

scan_delay_timer is initialized in mwifiex_register(), so it
should be deleted in mwifiex_unregister(). Hence it has been
moved to appropriate place.
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 43ba6b9f
......@@ -378,18 +378,11 @@ static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
static void
mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
{
int i;
if (!adapter) {
pr_err("%s: adapter is NULL\n", __func__);
return;
}
for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i])
del_timer_sync(&adapter->priv[i]->scan_delay_timer);
}
mwifiex_cancel_all_pending_cmd(adapter);
/* Free lock variables */
......
......@@ -197,6 +197,7 @@ static int mwifiex_unregister(struct mwifiex_adapter *adapter)
for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i]) {
mwifiex_free_curr_bcn(adapter->priv[i]);
del_timer_sync(&adapter->priv[i]->scan_delay_timer);
kfree(adapter->priv[i]);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment