aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2013-05-06 22:46:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-05-08 17:15:08 -0400
commitf16fdc9d2dc1e5b270e9a08377587e831e0d36ac (patch)
tree44f4aec9e330308b99af023cde45f031f7e284e6 /drivers/net/wireless
parent48795424acff7215d5eac0b52793a2c1eb3a6283 (diff)
mwifiex: fix memory leak issue when driver unload
After unregister_netdevice() call the request is queued and reg_state is changed to NETREG_UNREGISTERING. As we check for NETREG_UNREGISTERED state, free_netdev() never gets executed causing memory leak. Initialize "dev->destructor" to free_netdev() to free device data after unregistration. Cc: <stable@vger.kernel.org> Reported-by: Daniel Drake <dsd@laptop.org> Tested-by: Daniel Drake <dsd@laptop.org> 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')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c3
-rw-r--r--drivers/net/wireless/mwifiex/main.c1
2 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a0cb0770d319..636145d1708b 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2234,9 +2234,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
2234 if (wdev->netdev->reg_state == NETREG_REGISTERED) 2234 if (wdev->netdev->reg_state == NETREG_REGISTERED)
2235 unregister_netdevice(wdev->netdev); 2235 unregister_netdevice(wdev->netdev);
2236 2236
2237 if (wdev->netdev->reg_state == NETREG_UNREGISTERED)
2238 free_netdev(wdev->netdev);
2239
2240 /* Clear the priv in adapter */ 2237 /* Clear the priv in adapter */
2241 priv->netdev = NULL; 2238 priv->netdev = NULL;
2242 2239
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 121443a0f2a1..2eb88ea9acf7 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -655,6 +655,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,
655 struct net_device *dev) 655 struct net_device *dev)
656{ 656{
657 dev->netdev_ops = &mwifiex_netdev_ops; 657 dev->netdev_ops = &mwifiex_netdev_ops;
658 dev->destructor = free_netdev;
658 /* Initialize private structure */ 659 /* Initialize private structure */
659 priv->current_key_index = 0; 660 priv->current_key_index = 0;
660 priv->media_connected = false; 661 priv->media_connected = false;