Commit 019f45f2 authored by Franky Lin's avatar Franky Lin Committed by Greg Kroah-Hartman

staging: brcm80211: clean up rtnl_lock in fullmac

rtnl lock is used improperly in fullmac. This patch intends to clean
them up.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarSukesh Srikakula <sukeshs@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c18692e7
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <net/cfg80211.h> #include <net/cfg80211.h>
#include <net/rtnetlink.h>
#include <defs.h> #include <defs.h>
#include <brcmu_utils.h> #include <brcmu_utils.h>
#include <brcmu_wifi.h> #include <brcmu_wifi.h>
...@@ -1240,7 +1241,9 @@ void brcmf_detach(struct brcmf_pub *drvr) ...@@ -1240,7 +1241,9 @@ void brcmf_detach(struct brcmf_pub *drvr)
ifp = drvr_priv->iflist[0]; ifp = drvr_priv->iflist[0];
if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
rtnl_lock();
brcmf_netdev_stop(ifp->ndev); brcmf_netdev_stop(ifp->ndev);
rtnl_unlock();
unregister_netdev(ifp->ndev); unregister_netdev(ifp->ndev);
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <net/cfg80211.h> #include <net/cfg80211.h>
#include <net/rtnetlink.h>
#include <brcmu_utils.h> #include <brcmu_utils.h>
#include <defs.h> #include <defs.h>
...@@ -2223,10 +2222,8 @@ static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2223,10 +2222,8 @@ static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv)
s32 err = 0; s32 err = 0;
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
rtnl_lock();
brcmf_inform_bss(cfg_priv); brcmf_inform_bss(cfg_priv);
brcmf_notify_iscan_complete(iscan, false); brcmf_notify_iscan_complete(iscan, false);
rtnl_unlock();
return err; return err;
} }
...@@ -2248,10 +2245,8 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2248,10 +2245,8 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv)
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan;
s32 err = 0; s32 err = 0;
rtnl_lock();
brcmf_inform_bss(cfg_priv); brcmf_inform_bss(cfg_priv);
brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE); brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE);
rtnl_unlock();
/* Reschedule the timer */ /* Reschedule the timer */
mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
iscan->timer_on = 1; iscan->timer_on = 1;
...@@ -2265,9 +2260,7 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2265,9 +2260,7 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv)
s32 err = 0; s32 err = 0;
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
rtnl_lock();
brcmf_notify_iscan_complete(iscan, true); brcmf_notify_iscan_complete(iscan, true);
rtnl_unlock();
return err; return err;
} }
...@@ -2286,12 +2279,10 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work) ...@@ -2286,12 +2279,10 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
iscan->timer_on = 0; iscan->timer_on = 0;
} }
rtnl_lock();
if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) { if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) {
status = BRCMF_SCAN_RESULTS_ABORTED; status = BRCMF_SCAN_RESULTS_ABORTED;
WL_ERR("Abort iscan\n"); WL_ERR("Abort iscan\n");
} }
rtnl_unlock();
el->handler[status](cfg_priv); el->handler[status](cfg_priv);
} }
...@@ -2408,9 +2399,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -2408,9 +2399,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
* generated due to DISASSOC call to the fw to keep * generated due to DISASSOC call to the fw to keep
* the state fw and WPA_Supplicant state consistent * the state fw and WPA_Supplicant state consistent
*/ */
rtnl_unlock();
brcmf_delay(500); brcmf_delay(500);
rtnl_lock();
} }
set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
...@@ -2978,7 +2967,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -2978,7 +2967,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
u16 flags = be16_to_cpu(e->flags); u16 flags = be16_to_cpu(e->flags);
enum nl80211_key_type key_type; enum nl80211_key_type key_type;
rtnl_lock();
if (flags & BRCMF_EVENT_MSG_GROUP) if (flags & BRCMF_EVENT_MSG_GROUP)
key_type = NL80211_KEYTYPE_GROUP; key_type = NL80211_KEYTYPE_GROUP;
else else
...@@ -2986,7 +2974,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -2986,7 +2974,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
cfg80211_michael_mic_failure(ndev, (u8 *)&e->addr, key_type, -1, cfg80211_michael_mic_failure(ndev, (u8 *)&e->addr, key_type, -1,
NULL, GFP_KERNEL); NULL, GFP_KERNEL);
rtnl_unlock();
return 0; return 0;
} }
...@@ -3563,8 +3550,7 @@ static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -3563,8 +3550,7 @@ static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv)
return wl_update_wiphybands(cfg_priv); return wl_update_wiphybands(cfg_priv);
} }
static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
bool need_lock)
{ {
struct net_device *ndev; struct net_device *ndev;
struct wireless_dev *wdev; struct wireless_dev *wdev;
...@@ -3576,8 +3562,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3576,8 +3562,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
ndev = cfg_to_ndev(cfg_priv); ndev = cfg_to_ndev(cfg_priv);
wdev = ndev->ieee80211_ptr; wdev = ndev->ieee80211_ptr;
if (need_lock)
rtnl_lock();
brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME, brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME,
WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME); WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME);
...@@ -3607,8 +3591,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3607,8 +3591,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
/* -EINPROGRESS: Call commit handler */ /* -EINPROGRESS: Call commit handler */
default_conf_out: default_conf_out:
if (need_lock)
rtnl_unlock();
cfg_priv->dongle_up = true; cfg_priv->dongle_up = true;
...@@ -3658,7 +3640,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -3658,7 +3640,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv)
brcmf_debugfs_add_netdev_params(cfg_priv); brcmf_debugfs_add_netdev_params(cfg_priv);
err = brcmf_config_dongle(cfg_priv, false); err = brcmf_config_dongle(cfg_priv);
if (err) if (err)
return err; return err;
...@@ -3683,9 +3665,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -3683,9 +3665,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
generated due to DISASSOC call to the fw to keep generated due to DISASSOC call to the fw to keep
the state fw and WPA_Supplicant state consistent the state fw and WPA_Supplicant state consistent
*/ */
rtnl_unlock();
brcmf_delay(500); brcmf_delay(500);
rtnl_lock();
} }
set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
......
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