rt2x00: fix NULL pointer exception
PATCH 1/1 rt2x00: fix NULL pointer exception
This will fix a NULL pointer exception when working in master mode. When a master mode interface is added, the bssid is initialized, when config_interface() is called the bssid is invalid (only with master mode) so we cannot use that, instead the bssid inside the interface structure should be used.
Signed-off-by Ivo van Doorn <[email protected]>
---
drivers/net/wireless/mac80211/rt2x00/rt2x00lib.c +4 -3
@@ -480,6 +480,7 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id, struct ieee80211_if_conf *conf) {struct rt2x00_dev *rt2x00dev = hw->priv; +struct interface *intf = &rt2x00dev->interface;/* * Monitor mode does not need configuring.
@@ -488,7 +489,7 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id,*/ if (conf->type ==IEEE80211_IF_TYPE_MNTR )return 0 ; -else if (conf->type != rt2x00dev->interface.type) +else if (conf->type != intf->type)return -EINVAL ;/*
@@ -497,13 +498,13 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id,* should now be set. */ if (conf->type !=IEEE80211_IF_TYPE_AP ) -memcpy (&rt2x00dev->interface.bssid, conf->bssid,ETH_ALEN ); +memcpy (&intf->bssid, conf->bssid,ETH_ALEN );/* * Enable configuration. */ rt2x00dev->lib_ops->config_type (rt2x00dev, conf->type); - rt2x00dev->lib_ops->config_bssid (rt2x00dev, conf->bssid); + rt2x00dev->lib_ops->config_bssid (rt2x00dev, intf->bssid);return 0 ; }