diff options
author | Xinming Hu <huxm@marvell.com> | 2015-09-18 15:32:07 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-09-29 09:47:33 +0200 |
commit | 02421dd3f6af1b6becb6d9a690a2b70c73c03a7a (patch) | |
tree | cc6f94292ec9413dc08484fa827ccde5739848b4 /drivers/net/wireless/mwifiex/scan.c | |
parent | mwifiex: fix driver init failure under memory pressure (diff) | |
download | linux-02421dd3f6af1b6becb6d9a690a2b70c73c03a7a.tar.xz linux-02421dd3f6af1b6becb6d9a690a2b70c73c03a7a.zip |
mwifiex: NULL check for cfg80211_inform_bss()
cfg80211_inform_bss would return null in some cases, such as
memory allocation failure.
This patch adds sanity check for this case, to avoid possible
issues when above corner case is hit.
Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 5847863a2d6b..3675730fc3b5 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c @@ -1839,14 +1839,18 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info, bssid, timestamp, cap_info_bitmap, beacon_period, ie_buf, ie_len, rssi, GFP_KERNEL); - bss_priv = (struct mwifiex_bss_priv *)bss->priv; - bss_priv->band = band; - bss_priv->fw_tsf = fw_tsf; - if (priv->media_connected && - !memcmp(bssid, priv->curr_bss_params.bss_descriptor - .mac_address, ETH_ALEN)) - mwifiex_update_curr_bss_params(priv, bss); - cfg80211_put_bss(priv->wdev.wiphy, bss); + if (bss) { + bss_priv = (struct mwifiex_bss_priv *)bss->priv; + bss_priv->band = band; + bss_priv->fw_tsf = fw_tsf; + if (priv->media_connected && + !memcmp(bssid, priv->curr_bss_params. + bss_descriptor.mac_address, + ETH_ALEN)) + mwifiex_update_curr_bss_params(priv, + bss); + cfg80211_put_bss(priv->wdev.wiphy, bss); + } if ((chan->flags & IEEE80211_CHAN_RADAR) || (chan->flags & IEEE80211_CHAN_NO_IR)) { |