提交 f16fdc9d 编写于 作者: A Amitkumar Karwar 提交者: John W. Linville

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: NDaniel Drake <dsd@laptop.org>
Tested-by: NDaniel Drake <dsd@laptop.org>
Signed-off-by: NAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: NBing Zhao <bzhao@marvell.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 48795424
...@@ -2234,9 +2234,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) ...@@ -2234,9 +2234,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
if (wdev->netdev->reg_state == NETREG_REGISTERED) if (wdev->netdev->reg_state == NETREG_REGISTERED)
unregister_netdevice(wdev->netdev); unregister_netdevice(wdev->netdev);
if (wdev->netdev->reg_state == NETREG_UNREGISTERED)
free_netdev(wdev->netdev);
/* Clear the priv in adapter */ /* Clear the priv in adapter */
priv->netdev = NULL; priv->netdev = NULL;
......
...@@ -655,6 +655,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, ...@@ -655,6 +655,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,
struct net_device *dev) struct net_device *dev)
{ {
dev->netdev_ops = &mwifiex_netdev_ops; dev->netdev_ops = &mwifiex_netdev_ops;
dev->destructor = free_netdev;
/* Initialize private structure */ /* Initialize private structure */
priv->current_key_index = 0; priv->current_key_index = 0;
priv->media_connected = false; priv->media_connected = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册