diff mbox

[Xenial,2/2] mwifiex: do not dereference invalid pointer

Message ID 1503559816-21538-2-git-send-email-jesse.sung@canonical.com
State New
Headers show

Commit Message

Wen-chien Jesse Sung Aug. 24, 2017, 7:30 a.m. UTC
BugLink: https://launchpad.net/bugs/1712746

Check priv->wdev.wiphy before dereference.

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
---
 drivers/net/wireless/mwifiex/cfp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

AceLan Kao Aug. 24, 2017, 7:39 a.m. UTC | #1
Pretty simple and straightforward, should have no regression concern.
Acked-By: AceLan Kao <acelan.kao@canonical.com>
AceLan Kao Aug. 24, 2017, 7:40 a.m. UTC | #2
Pretty simple and straightforward, should have no regression concern.
Acked-By: AceLan Kao <acelan.kao@canonical.com>
diff mbox

Patch

diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index 09fae27..47eb725 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -324,7 +324,9 @@  mwifiex_get_cfp(struct mwifiex_private *priv, u8 band, u16 channel, u32 freq)
 	if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG)
 		sband = priv->wdev.wiphy->bands[IEEE80211_BAND_2GHZ];
 	else
-		sband = priv->wdev.wiphy->bands[IEEE80211_BAND_5GHZ];
+		sband = priv->wdev.wiphy ?
+				priv->wdev.wiphy->bands[IEEE80211_BAND_5GHZ] :
+				NULL;
 
 	if (!sband) {
 		mwifiex_dbg(priv->adapter, ERROR,