From: Dmitry Shmidt Date: Fri, 29 Jun 2012 16:31:18 +0000 (-0700) Subject: net: wireless: bcmdhd: Add mutex to wl_update_wiphybands() X-Git-Tag: firefly_0821_release~7613^2~81 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fa98f042f17bedb9f714193354cef67d3b253176;p=firefly-linux-kernel-4.4.55.git net: wireless: bcmdhd: Add mutex to wl_update_wiphybands() Signed-off-by: Dmitry Shmidt --- diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c index 28c92417b519..121f3bb90986 100644 --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c @@ -7149,11 +7149,15 @@ s32 wl_update_wiphybands(struct wl_priv *wl) int nmode = 0; int bw_cap = 0; int index = 0; + bool rollback_lock = false; WL_DBG(("Entry")); - if (wl == NULL) + if (wl == NULL) { wl = wlcfg_drv_priv; + mutex_lock(&wl->usr_sync); + rollback_lock = true; + } dev = wl_to_prmry_ndev(wl); memset(bandlist, 0, sizeof(bandlist)); @@ -7161,7 +7165,7 @@ s32 wl_update_wiphybands(struct wl_priv *wl) sizeof(bandlist), false); if (unlikely(err)) { WL_ERR(("error read bandlist (%d)\n", err)); - return err; + goto end_bands; } wiphy = wl_to_wiphy(wl); nband = bandlist[0]; @@ -7183,7 +7187,7 @@ s32 wl_update_wiphybands(struct wl_priv *wl) if (err) { WL_ERR(("wl_construct_reginfo() fails err=%d\n", err)); if (err != BCME_UNSUPPORTED) - return err; + goto end_bands; /* Ignore error if "chanspecs" command is not supported */ err = 0; } @@ -7212,6 +7216,9 @@ s32 wl_update_wiphybands(struct wl_priv *wl) } wiphy_apply_custom_regulatory(wiphy, &brcm_regdom); +end_bands: + if (rollback_lock) + mutex_unlock(&wl->usr_sync); return err; }