bcmdhd: use the wiphy from private data structure (i.e., wl_priv)
Mursalin Akon [Fri, 7 Sep 2012 17:57:02 +0000 (10:57 -0700)]
problem:
The macro wiphy_from_scan retrieves wiphy from
wl_priv->escan_info.wiphy which is in turn set by
a 'scan' initiated from kernel space (like
scheduled scan) or from user space (like iwlist command).
Without a scan, a 'connect' crashes in function
wl_inform_single_bss, with NULL pointer access,
as the variable wiphy (in turn, wl->escan_info.wiphy)
is not initialized properly.

solution:
wireless_device data structures maintained for both
STA and P2P mode point to the same wiphy (see,
wl_cfgp2p_register_ndev in wl_cfgp2p.c). So,
irrespective of whatever wireless_device is in
use, a scan will always set wl_priv->escan_info.wiphy
to the same wiphy. There is no point in getting
wiphy using wl_priv->escan_info.wiphy, rather use
the wiphy referred by all wireless_device structures.

Bug 1029792
Bug 1029733

Change-Id: I6d744950d3a053642ffa998b3c3f3ba60c0cb687
Signed-off-by: Mursalin Akon <makon@nvidia.com>
Reviewed-on: http://git-master/r/141629
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/net/wireless/bcmdhd/wl_cfg80211.c
drivers/net/wireless/bcmdhd/wl_cfg80211.h

index 7f3e332..2c4e9a6 100644 (file)
@@ -4693,7 +4693,7 @@ static s32 wl_inform_bss(struct wl_priv *wl)
 
 static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
 {
-       struct wiphy *wiphy = wiphy_from_scan(wl);
+       struct wiphy *wiphy = wl_to_wiphy(wl);
        struct ieee80211_mgmt *mgmt;
        struct ieee80211_channel *channel;
        struct ieee80211_supported_band *band;
index 37c8e58..21446dc 100644 (file)
@@ -612,7 +612,6 @@ wl_get_profile_by_netdev(struct wl_priv *wl, struct net_device *ndev)
 #define iscan_to_wl(i) ((struct wl_priv *)(i->data))
 #define wl_to_iscan(w) (w->iscan)
 #define wl_to_conn(w) (&w->conn_info)
-#define wiphy_from_scan(w) (w->escan_info.wiphy)
 #define wl_get_drv_status_all(wl, stat) \
        (wl_get_status_all(wl, WL_STATUS_ ## stat))
 #define wl_get_drv_status(wl, stat, ndev)  \