aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/main.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2013-11-14 22:10:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-11-15 14:29:31 -0500
commitbec568ff51078276109e21b5521829e2dd60a7fa (patch)
tree146e3c17d648eb70d375bff711903c1e6634c3d5 /drivers/net/wireless/mwifiex/main.c
parent68b76e99d1f7b696d49b5e99286401150072987a (diff)
mwifiex: failure path handling in mwifiex_add_virtual_intf()
1) If register_netdevice() is failed, we are freeing netdev pointer, but priv->netdev is not cleared. This gives kernel paging request error when driver is unloaded or interface is deleted. Fix the problem by clearing the pointer. 2) Fix memory leak issue by freeing 'wdev' in failure paths. Also, clear priv->wdev pointer. As mwifiex_add_virtual_intf() successfully handles the failure conditions, redundant code under err_add_intf label is removed in this patch. Reported-by: Ujjal Roy <royujjal@gmail.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/main.c')
-rw-r--r--drivers/net/wireless/mwifiex/main.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 7c7da3ea55a9..9236b42007fb 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -411,7 +411,7 @@ static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter)
411 */ 411 */
412static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) 412static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
413{ 413{
414 int ret, i; 414 int ret;
415 char fmt[64]; 415 char fmt[64];
416 struct mwifiex_private *priv; 416 struct mwifiex_private *priv;
417 struct mwifiex_adapter *adapter = context; 417 struct mwifiex_adapter *adapter = context;
@@ -479,6 +479,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
479 NL80211_IFTYPE_STATION, NULL, NULL); 479 NL80211_IFTYPE_STATION, NULL, NULL);
480 if (IS_ERR(wdev)) { 480 if (IS_ERR(wdev)) {
481 dev_err(adapter->dev, "cannot create default STA interface\n"); 481 dev_err(adapter->dev, "cannot create default STA interface\n");
482 rtnl_unlock();
482 goto err_add_intf; 483 goto err_add_intf;
483 } 484 }
484 rtnl_unlock(); 485 rtnl_unlock();
@@ -488,16 +489,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
488 goto done; 489 goto done;
489 490
490err_add_intf: 491err_add_intf:
491 for (i = 0; i < adapter->priv_num; i++) {
492 priv = adapter->priv[i];
493
494 if (!priv)
495 continue;
496
497 if (priv->wdev && priv->netdev)
498 mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev);
499 }
500 rtnl_unlock();
501err_register_cfg80211: 492err_register_cfg80211:
502 wiphy_unregister(adapter->wiphy); 493 wiphy_unregister(adapter->wiphy);
503 wiphy_free(adapter->wiphy); 494 wiphy_free(adapter->wiphy);