aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-02-01 23:41:44 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:55:50 -0500
commit477778bb0e7c671860528946b412294684337c5e (patch)
tree896e8ba8725599e6ecb9c4b1618a89139017ae38
parent197a4e4e1f7ef11458f09b4dd74397baf6758133 (diff)
mwifiex: fix NULL pointer dereference in set_channel()
In set_channel() callback handler, "priv" pointer is derived from net_device. Sometimes net_device pointer coming from the stack is NULL which causes kernel crash. This patch fixes the problem by deriving "priv" from wiphy when net_device pointer is NULL. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 6fef4925d13a..54e45c829c53 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -376,7 +376,12 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
376 struct ieee80211_channel *chan, 376 struct ieee80211_channel *chan,
377 enum nl80211_channel_type channel_type) 377 enum nl80211_channel_type channel_type)
378{ 378{
379 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 379 struct mwifiex_private *priv;
380
381 if (dev)
382 priv = mwifiex_netdev_get_priv(dev);
383 else
384 priv = mwifiex_cfg80211_get_priv(wiphy);
380 385
381 if (priv->media_connected) { 386 if (priv->media_connected) {
382 wiphy_err(wiphy, "This setting is valid only when station " 387 wiphy_err(wiphy, "This setting is valid only when station "